"Diary" file---log of computer applications in class. Math 310, Applied Linear Algebra Fall 2003, S. Smith ...to begin below, as of Monday 10 January 2005: >> 'wed 12 jan 05' ans = wed 12 jan 05 >> 'I forgot to set the job log on during class. Here is what I had done:' ans = I forgot to set the job log on during class. Here is what I had done: >> >> a = [1 2 ; 3 4 ] a = 1 2 3 4 >> b = [5 6]' b = 5 6 >> aug = [a,b] aug = 1 2 5 3 4 6 >> rref(aug) ans = 1.0000 0 -4.0000 0 1.0000 4.5000 >> b = aug b = 1 2 5 3 4 6 >> b(2,:) = -3 * b(1,:) + b(2,:) b = 1 2 5 0 -2 -9 >> quit >> 'start fri 14 jan 05' ans = start fri 14 jan 05 >> 'lets do gauss-jordan on 5f though instructions are just gauss there' ans = lets do gauss-jordan on 5f though instructions are just gauss there >> a = [1 -1 2; 2 3 -1; 7 3 4] a = 1 -1 2 2 3 -1 7 3 4 >> b = [4 1 7]' b = 4 1 7 >> aug = [a,b] aug = 1 -1 2 4 2 3 -1 1 7 3 4 7 >> rref(aug) ans = 1 0 1 0 0 1 -1 0 0 0 0 1 >> aug aug = 1 -1 2 4 2 3 -1 1 7 3 4 7 >> b = au ??? Undefined function or variable 'au'. >> b = augg ??? Undefined function or variable 'augg'. >> b = aug b = 1 -1 2 4 2 3 -1 1 7 3 4 7 >> b(2,:) = -2 * b(1,:) + b(2,:) b = 1 -1 2 4 0 5 -5 -7 7 3 4 7 >> b(3,:) = -7 * b(1,:) + b(3,:) b = 1 -1 2 4 0 5 -5 -7 0 10 -10 -21 >> b(2,:) = (1/5) * b(2,:) b = 1.0000 -1.0000 2.0000 4.0000 0 1.0000 -1.0000 -1.4000 0 10.0000 -10.0000 -21.0000 >> b(1,:) = 1 * b(2,:) + b(1,:) b = 1.0000 0 1.0000 2.6000 0 1.0000 -1.0000 -1.4000 0 10.0000 -10.0000 -21.0000 >> b(3,:) = -10 * b(2,:) + b(3,:) b = 1.0000 0 1.0000 2.6000 0 1.0000 -1.0000 -1.4000 0 0 0 -7.0000 >> 'end fri 14 jan 05' ans = end fri 14 jan 05 >> quit >> 'start Wed 19 jan' ans = start Wed 19 jan >> a = [1 -1 0 0; 1 0 0 1; 0 1 -1 0; 0 0 1 0] a = 1 -1 0 0 1 0 0 1 0 1 -1 0 0 0 1 0 >> b = [ 50 870 -120 350] b = 50 870 -120 350 >> aaug = [a,b] ??? Error using ==> horzcat All matrices on a row in the bracketed expression must have the same number of rows. >> Interrupt >> >> >> >> >> >> b = b' b = 50 870 -120 350 >> aug = [a,b] aug = 1 -1 0 0 50 1 0 0 1 870 0 1 -1 0 -120 0 0 1 0 350 >> rref(aug) ans = 1 0 0 0 280 0 1 0 0 230 0 0 1 0 350 0 0 0 1 590 >> 'this was no 13 of sec 1.2' ans = this was no 13 of sec 1.2 >> 'doing appl3 on p.25' ans = doing appl3 on p.25 >> a = [1 0 0 -6; 0 2 0 -12; 2 1 -2 -6] a = 1 0 0 -6 0 2 0 -12 2 1 -2 -6 >> b = [ 0 0 0]' b = 0 0 0 >> aug = [a,b] aug = 1 0 0 -6 0 0 2 0 -12 0 2 1 -2 -6 0 >> rref(aug) ans = 1 0 0 -6 0 0 1 0 -6 0 0 0 1 -6 0 >> 'appl4 p.26' ans = appl4 p.26 >> a = [-1/4 1/3 1/2; 1/4 -2/3 1/4 ; 1/4 1/3 -3/4] a = -0.2500 0.3333 0.5000 0.2500 -0.6667 0.2500 0.2500 0.3333 -0.7500 >> b b = 0 0 0 >> aug = [a,b] aug = -0.2500 0.3333 0.5000 0 0.2500 -0.6667 0.2500 0 0.2500 0.3333 -0.7500 0 >> rref(aug) ans = 1 0 0 0 0 1 0 0 0 0 1 0 >> a(1,1) = -1/2 a = -0.5000 0.3333 0.5000 0.2500 -0.6667 0.2500 0.2500 0.3333 -0.7500 >> aug = [a,b] aug = -0.5000 0.3333 0.5000 0 0.2500 -0.6667 0.2500 0 0.2500 0.3333 -0.7500 0 >> rref(aug) ans = 1.0000 0 -1.6667 0 0 1.0000 -1.0000 0 0 0 0 0 >> 'end wed 19 jan' ans = end wed 19 jan >> quit >> 'start fri 21 jan 05' ans = start fri 21 jan 05 >> a = [3 2 -1 ; 1 -2 2 ; 11 2 1] a = 3 2 -1 1 -2 2 11 2 1 >> b = [4 1 14]' b = 4 1 14 >> aug = [a,b] aug = 3 2 -1 4 1 -2 2 1 11 2 1 14 >> rref(aug) ans = 1.0000 0 0.2500 1.2500 0 1.0000 -0.8750 0.1250 0 0 0 0 >> a = [ 1 2 3; 4 5 6] a = 1 2 3 4 5 6 >> b = [ 2 0 ; 1 1 ; 0 2] b = 2 0 1 1 0 2 >> a * b ans = 4 8 13 17 >> a = [1 2 ; 2 4] a = 1 2 2 4 >> b = [3 2 ; 1 7] b = 3 2 1 7 >> a * b ans = 5 16 10 32 >> b *a ans = 7 14 15 30 >> a * b - b * a ans = -2 2 -5 2 >> a = [1 2 3; 2 3 5; 3 7 18] a = 1 2 3 2 3 5 3 7 18 >> eye(3) ans = 1 0 0 0 1 0 0 0 1 >> inv(a) ans = -2.3750 1.8750 -0.1250 2.6250 -1.1250 -0.1250 -0.6250 0.1250 0.1250 >> a * inv(a) ans = 1.0000 -0.0000 0 0 1.0000 0 0 -0.0000 1.0000 >> 'end fri 21 jan ' ans = end fri 21 jan >> quit >> 'start mon 24 jan 05' ans = start mon 24 jan 05 >> 'start of prob 6 of sec 1.4' ans = start of prob 6 of sec 1.4 >> a = [2 1 1 ; 6 4 5; 4 1 3] a = 2 1 1 6 4 5 4 1 3 >> e = eye(3) e = 1 0 0 0 1 0 0 0 1 >> e(2,1) = -2 e = 1 0 0 -2 1 0 0 0 1 >> e * a ans = 2 1 1 2 2 3 4 1 3 >> e(2,1) = -3 e = 1 0 0 -3 1 0 0 0 1 >> e * a ans = 2 1 1 0 1 2 4 1 3 >> e = eye(3) e = 1 0 0 0 1 0 0 0 1 >> e(1,:) = [0 1 0] e = 0 1 0 0 1 0 0 0 1 >> e(2,:) = [1 0 0] e = 0 1 0 1 0 0 0 0 1 >> inv(e) ans = 0 1 0 1 0 0 0 0 1 >> a = eye(3) a = 1 0 0 0 1 0 0 0 1 >> a(3,2) = -4 a = 1 0 0 0 1 0 0 -4 1 >> inv(a) ans = 1 0 0 0 1 0 0 4 1 >> a = [ 1 2 3; 4 5 6 ; 7 6 2] a = 1 2 3 4 5 6 7 6 2 >> b = eye(3) b = 1 0 0 0 1 0 0 0 1 >> aug = [a,b] aug = 1 2 3 1 0 0 4 5 6 0 1 0 7 6 2 0 0 1 >> rref(aug) ans = 1.0000 0 0 -2.8889 1.5556 -0.3333 0 1.0000 0 3.7778 -2.1111 0.6667 0 0 1.0000 -1.2222 0.8889 -0.3333 >> inv(a) ans = -2.8889 1.5556 -0.3333 3.7778 -2.1111 0.6667 -1.2222 0.8889 -0.3333 >> 'so we see that row-reducingg the big augmented matrix DID produce the inverse of A' ans = so we see that row-reducingg the big augmented matrix DID produce the inverse of A >> 'end mon 24 jan 05' ans = end mon 24 jan 05 >> quit >> 'start wed 26 jan' ans = start wed 26 jan >> a = [1 2; 1 3] a = 1 2 1 3 >> b = eye(2) b = 1 0 0 1 >> aug = [a,b] aug = 1 2 1 0 1 3 0 1 >> rref(aug0 ??? rref(aug0 | Error: ")" expected, "end of line" found. >> rref(aug) ans = 1 0 3 -2 0 1 -1 1 >> x = [3 -2 ; -1 1] x = 3 -2 -1 1 >> a * x ans = 1 0 0 1 >> inv(a) ans = 3 -2 -1 1 >> b b = 1 0 0 1 >> x x = 3 -2 -1 1 >> ] ??? ] | Error: "End of Input" expected, "]" found. >> x x = 3 -2 -1 1 >> inv(a) ans = 3 -2 -1 1 >> aug aug = 1 2 1 0 1 3 0 1 >> a a = 1 2 1 3 >> a(2,:) = [2 4] a = 1 2 2 4 >> aug = [a,b] aug = 1 2 1 0 2 4 0 1 >> rref(aug) ans = 1.0000 2.0000 0 0.5000 0 0 1.0000 -0.5000 >> x = [0 .5; 1 -.5] x = 0 0.5000 1.0000 -0.5000 >> a * x ans = 2.0000 -0.5000 4.0000 -1.0000 >> a = [ 1 1 1; 0 1 1; 0 0 1] a = 1 1 1 0 1 1 0 0 1 >> aug = [ a,eye(3)] aug = 1 1 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 1 >> rref(augg) ??? Undefined function or variable 'augg'. >> rref(aug) ans = 1 0 0 1 -1 0 0 1 0 0 1 -1 0 0 1 0 0 1 >> inv(a) ans = 1 -1 0 0 1 -1 0 0 1 >> b = [ 1 2 ; 24] ??? Error using ==> vertcat All rows in the bracketed expression must have the same number of columns. >> b = [ 1 2 ; 2 4] b = 1 2 2 4 >> inv(b) Warning: Matrix is singular to working precision. ans = Inf Inf Inf Inf >> 'prob 8 of sec 1.4' ans = prob 8 of sec 1.4 >> a = [ 1 0 1; 3 3 4; 2 2 3] a = 1 0 1 3 3 4 2 2 3 >> inv(a) ans = 1.0000 2.0000 -3.0000 -1.0000 1.0000 -1.0000 0.0000 -2.0000 3.0000 >> b = [1 1 1]' b = 1 1 1 >> aug = [a, b] aug = 1 0 1 1 3 3 4 1 2 2 3 1 >> rref(aug) ans = 1 0 0 0 0 1 0 -1 0 0 1 1 >> inv(a) * b ans = -0.0000 -1.0000 1.0000 >> inv(a) * aug ans = 1.0000 -0.0000 -0.0000 -0.0000 -0.0000 1.0000 -0.0000 -1.0000 0.0000 0.0000 1.0000 1.0000 >> 'prob 10' ans = prob 10 >> a = [3 1 ; 5 2] a = 3 1 5 2 >> b = [1 2 ; 3 4] b = 1 2 3 4 >> c = inv(a) c = 2.0000 -1.0000 -5.0000 3.0000 >> c * a ans = 1.0000 0 0.0000 1.0000 >> c * b ans = -1.0000 0 4.0000 2.0000 >> d = c * b d = -1.0000 0 4.0000 2.0000 >> a * d ans = 1.0000 2.0000 3.0000 4.0000 >> b b = 1 2 3 4 >> 'end wed 26 jan' ans = end wed 26 jan >> quit >> 'start fri 28 jan' ans = start fri 28 jan >> 'sec 1.4, doing 7c' ans = sec 1.4, doing 7c >> >> e1inv = [ 1 0 0 ; -3 1 0; 0 0 1] e1inv = 1 0 0 -3 1 0 0 0 1 >> e2inv = eye(3) e2inv = 1 0 0 0 1 0 0 0 1 >> e2inv(3,1) = -2 e2inv = 1 0 0 0 1 0 -2 0 1 >> e3inv(eye) ??? Undefined function or variable 'e3inv'. >> e3inv = eye(3) e3inv = 1 0 0 0 1 0 0 0 1 >> e3inv(3,2) = 2 e3inv = 1 0 0 0 1 0 0 2 1 >> l = e1inv * e2inv * e3inv l = 1 0 0 -3 1 0 -2 2 1 >> e1inv = eye(3) e1inv = 1 0 0 0 1 0 0 0 1 >> e1inv(2,1) = 3 e1inv = 1 0 0 3 1 0 0 0 1 >> l = e1inv * e2inv * e3inv l = 1 0 0 3 1 0 -2 2 1 >> u = [1 1 1; 0 2 3 ; 0 0 3] u = 1 1 1 0 2 3 0 0 3 >> l * u ans = 1 1 1 3 5 6 -2 2 7 >> a ??? Undefined function or variable 'a'. >> a = [ 1 1 1 ; 3 5 6; -2 2 7] a = 1 1 1 3 5 6 -2 2 7 >> lu ??? Error using ==> lu Not enough input arguments. >> l * u ans = 1 1 1 3 5 6 -2 2 7 >> a a = 1 1 1 3 5 6 -2 2 7 >> l * u - a ans = 0 0 0 0 0 0 0 0 0 >> l l = 1 0 0 3 1 0 -2 2 1 >> u u = 1 1 1 0 2 3 0 0 3 >> help lu LU LU factorization. [L,U] = LU(X) stores an upper triangular matrix in U and a "psychologically lower triangular matrix" (i.e. a product of lower triangular and permutation matrices) in L, so that X = L*U. X can be rectangular. [L,U,P] = LU(X) returns lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that P*X = L*U. LU(X), with one output argument, returns the output from LAPACK'S DGETRF or ZGETRF routine. LU(X,THRESH) controls pivoting in sparse matrices, where THRESH is a pivot threshold in [0,1]. Pivoting occurs when the diagonal entry in a column has magnitude less than THRESH times the magnitude of any sub-diagonal entry in that column. THRESH = 0 forces diagonal pivoting. THRESH = 1 is the default. See also LUINC, QR, RREF. >> a = [ 0 0 1; 0 2 3; 4 5 6] a = 0 0 1 0 2 3 4 5 6 >> [l,u] = lu(a) l = 0 0 1 0 1 0 1 0 0 u = 4 5 6 0 2 3 0 0 1 >> l * U ??? Undefined function or variable 'U'. >> l * u ans = 0 0 1 0 2 3 4 5 6 >> [l,u,p] = lu(a) l = 1 0 0 0 1 0 0 0 1 u = 4 5 6 0 2 3 0 0 1 p = 0 0 1 0 1 0 1 0 0 >> l * u ans = 4 5 6 0 2 3 0 0 1 >> a a = 0 0 1 0 2 3 4 5 6 >> p * a ans = 4 5 6 0 2 3 0 0 1 >> l * u ans = 4 5 6 0 2 3 0 0 1 >> p * a = l * u ??? Error: Assignment statements cannot produce a result. >> p * a - l * u ans = 0 0 0 0 0 0 0 0 0 >> a = [1 1 1; 3 5 6; -2 2 7] a = 1 1 1 3 5 6 -2 2 7 >> [l,u] = lu(a) l = 0.3333 -0.1250 1.0000 1.0000 0 0 -0.6667 1.0000 0 u = 3.0000 5.0000 6.0000 0 5.3333 11.0000 0 0 0.3750 >> [l,u,p] = lu(a) l = 1.0000 0 0 -0.6667 1.0000 0 0.3333 -0.1250 1.0000 u = 3.0000 5.0000 6.0000 0 5.3333 11.0000 0 0 0.3750 p = 0 1 0 0 0 1 1 0 0 >> p * a ans = 3 5 6 -2 2 7 1 1 1 >> l * u ans = 3 5 6 -2 2 7 1 1 1 >> p * a - l * u ans = 0 0 0 0 0 0 0 0 0 >> 'end fri 28 jan' ans = end fri 28 jan >> quit >> 'start mon 31 jan' ans = start mon 31 jan >> a = [ 1 2 3 ; 4 5 6; 7 6 2] a = 1 2 3 4 5 6 7 6 2 >> det(a) ans = 9 >> 'end mon 31 jan' ans = end mon 31 jan >> quit >> 'start wed 2 feb 05' ans = start wed 2 feb 05 >> '3f of sec 2.2' ans = 3f of sec 2.2 >> a = [ 1 1 1 1 ; 2 -1 3 2; 0 1 2 1; 0 0 7 3] a = 1 1 1 1 2 -1 3 2 0 1 2 1 0 0 7 3 >> det(a) ans = 0 >> 'end wed 2 feb' ans = end wed 2 feb >> quit >> 'start fri 4 feb' ans = start fri 4 feb >> a = [1 3 1; 2 1 1; -2 2 -1] a = 1 3 1 2 1 1 -2 2 -1 >> det(a) ans = 3 >> cof = [ -3 0 6 ; 5 1 -8 ; 2 1 -5] cof = -3 0 6 5 1 -8 2 1 -5 >> adj = cof' adj = -3 5 2 0 1 1 6 -8 -5 >> a * adj] ??? a * adj] | Error: Missing operator, comma, or semicolon. >> a * adj ans = 3 0 0 0 3 0 0 0 3 >> inv(a) ans = -1.0000 1.6667 0.6667 0 0.3333 0.3333 2.0000 -2.6667 -1.6667 >> 'above was 1c' ans = above was 1c >> 'below is 2c, cramers rule' ans = below is 2c, cramers rule >> a = [ 2 1 -3; 4 5 1; -2 -1 4] a = 2 1 -3 4 5 1 -2 -1 4 >> b = [0 8 2]' b = 0 8 2 >> 'old way first:' ans = old way first: >> aug = [a,b] aug = 2 1 -3 0 4 5 1 8 -2 -1 4 2 >> rref(aug) ans = 1 0 0 4 0 1 0 -2 0 0 1 2 >> c1 = a c1 = 2 1 -3 4 5 1 -2 -1 4 >> c1(:,1) = b c1 = 0 1 -3 8 5 1 2 -1 4 >> det(c1) ans = 24 >> det(a) ans = 6 >> x1 = det(c1) / det(a) x1 = 4 >> c2 = a c2 = 2 1 -3 4 5 1 -2 -1 4 >> c2(:,2) = b c2 = 2 0 -3 4 8 1 -2 2 4 >> x2 = det(c2) / det(a) x2 = -2 >> c3 = a c3 = 2 1 -3 4 5 1 -2 -1 4 >> c3(:,3) = b c3 = 2 1 0 4 5 8 -2 -1 2 >> x3 = det(c3) / det(a) x3 = 2 >> 'end fri 4 feb 05' ans = end fri 4 feb 05 >> quit >> 'start mon 7 feb 04' ans = start mon 7 feb 04 >> 'end 7 feb 05' ans = end 7 feb 05 >> quit >> 'start wed 9 feb' ans = start wed 9 feb >> 'exer 4b of sec 3.2, find nullspace' ans = exer 4b of sec 3.2, find nullspace >> a = [1 2 -3 -1; -2 -4 6 3] a = 1 2 -3 -1 -2 -4 6 3 >> b = [0 0]' b = 0 0 >> aug = [a,b] aug = 1 2 -3 -1 0 -2 -4 6 3 0 >> rref(aug) ans = 1 2 -3 0 0 0 0 0 1 0 >> 'end wed 9 feb 05' ans = end wed 9 feb 05 >> quit >> 'start fr 11 feb' ans = start fr 11 feb >> 'exer 11a of sec 3.2' ans = exer 11a of sec 3.2 >> x1 = [-1 2 3]' x1 = -1 2 3 >> x2 = [3 4 2]' x2 = 3 4 2 >> x = [2 6 6]' x = 2 6 6 >> a = [x1,x2] a = -1 3 2 4 3 2 >> aug = [a,b] ??? Undefined function or variable 'b'. >> b = x b = 2 6 6 >> aug [a,b] ??? aug [a,b] | Error: Missing operator, comma, or semicolon. >> aug = [a,b] aug = -1 3 2 2 4 6 3 2 6 >> rref(aug) ans = 1 0 0 0 1 0 0 0 1 >> 'so no solution, so x is NOT in span of x1 and x2' ans = so no solution, so x is NOT in span of x1 and x2 >> y = [-9 -2 5]' y = -9 -2 5 >> b = y b = -9 -2 5 >> aug = [a,b] aug = -1 3 -9 2 4 -2 3 2 5 >> rref(aug) ans = 1 0 3 0 1 -2 0 0 0 >> 'end fri 11 feb 05' ans = end fri 11 feb 05 >> quit >> 'start mon 14 feb' ans = start mon 14 feb >> no computer examples done today' ??? no computer examples done today' | Error: Missing operator, comma, or semicolon. >> 'no computer examples done today' ans = no computer examples done today >> 'end mon 14 feb' ans = end mon 14 feb >> quit >> 'start wed 16 feb 05' ans = start wed 16 feb 05 >> ] ??? ] | Error: "End of Input" expected, "]" found. >> 'sec 3.2, prob 1a' ans = sec 3.2, prob 1a >> a = [2 3 ; 1 2] a = 2 3 1 2 >> b = [ 0 0 ]' b = 0 0 >> aug = [a,b] aug = 2 3 0 1 2 0 >> rref(aug) ans = 1 0 0 0 1 0 >> aug = [ 1 0 0 ; 1 2 0 ; 3 1 0] aug = 1 0 0 1 2 0 3 1 0 >> rref(aug) ans = 1 0 0 0 1 0 0 0 0 >> >> A = [ 2 4 ; 3 6 ] A = 2 4 3 6 >> B = [ 0 0]' B = 0 0 >> aug = [a,b] aug = 2 3 0 1 2 0 >> a = [2 4; 3 6] a = 2 4 3 6 >> aug = [a,b] aug = 2 4 0 3 6 0 >> rref(aug) ans = 1 2 0 0 0 0 >> a = [ 1 0 2; 0 1 3; 0 0 0; 1 0 2] a = 1 0 2 0 1 3 0 0 0 1 0 2 >> b = [ 0 0 0 0]' b = 0 0 0 0 >> aug = [a,b] aug = 1 0 2 0 0 1 3 0 0 0 0 0 1 0 2 0 >> rref(aug) ans = 1 0 2 0 0 1 3 0 0 0 0 0 0 0 0 0 >> 'prob 6a' ans = prob 6a >> a = [1 0 -2; 0 0 0; 0 1 1] a = 1 0 -2 0 0 0 0 1 1 >> b = [0 0 0]' b = 0 0 0 >> aug = [a,b] aug = 1 0 -2 0 0 0 0 0 0 1 1 0 >> rref(aug) ans = 1 0 -2 0 0 1 1 0 0 0 0 0 >> 'end wed 16 feb 05' ans = end wed 16 feb 05 >> quit >> 'start fri 18 feb 05' ans = start fri 18 feb 05 >> 'sec 3.4, prob 3a' ans = sec 3.4, prob 3a >> a = [2 1; 4 3]' a = 2 4 1 3 >> b = [0 0 ]' b = 0 0 >> aug = [a,b] aug = 2 4 0 1 3 0 >> rref(aug) ans = 1 0 0 0 1 0 >> 'this shows LI' ans = this shows LI >> 'prob 5a' ans = prob 5a >> x1 = [2 1 3]' x1 = 2 1 3 >> x2 = [3 -1 4]' x2 = 3 -1 4 >> x3 = [2 6 4]' x3 = 2 6 4 >> a = [x1,x2,x3] a = 2 3 2 1 -1 6 3 4 4 >> b = [0 0 0]' b = 0 0 0 >> aug = [a,b] aug = 2 3 2 0 1 -1 6 0 3 4 4 0 >> rref(aug) ans = 1 0 4 0 0 1 -2 0 0 0 0 0 >> 'end fri 18 feb' ans = end fri 18 feb >> quit >> 'start mon 21 feb 05' ans = start mon 21 feb 05 >> 'sec 3.4, no 10' ans = sec 3.4, no 10 >> x1 = [1 2 2 ]' x1 = 1 2 2 >> a = [x1] a = 1 2 2 >> x2 = [2 5 4]' x2 = 2 5 4 >> a = [a,x2] a = 1 2 2 5 2 4 >> rref(aug) ??? Undefined function or variable 'aug'. >> rref(a) ans = 1 0 0 1 0 0 >> x3 = [1 3 2]' x3 = 1 3 2 >> a = [a,x3] a = 1 2 1 2 5 3 2 4 2 >> rref(a) ans = 1 0 -1 0 1 1 0 0 0 >> x4 = [ 2 7 4]' x4 = 2 7 4 >> a = [x1,x2,x4] a = 1 2 2 2 5 7 2 4 4 >> rref(a) ans = 1 0 -4 0 1 3 0 0 0 >> x5 =[ 1 1 0] x5 = 1 1 0 >> a = [x1,x2,x5] ??? Error using ==> horzcat All matrices on a row in the bracketed expression must have the same number of rows. >> x5 = x5' x5 = 1 1 0 >> a = [x1,x2,x5] a = 1 2 1 2 5 1 2 4 0 >> rref(a) ans = 1 0 0 0 1 0 0 0 1 >> 'conclusion: x1 x2 x5 is a basis for R^3' ans = conclusion: x1 x2 x5 is a basis for R^3 >> 'end mon 21 feb 05' ans = end mon 21 feb 05 >> quit >> 'start wed 23 feb 05' ans = start wed 23 feb 05 >> a = [1 1; 1 -1] a = 1 1 1 -1 >> inv(a) ans = 0.5000 0.5000 0.5000 -0.5000 >> >> 'end wed 23 feb 05' ans = end wed 23 feb 05 >> quit >> 'start fri 25 feb 05' ans = start fri 25 feb 05 >> >> >> 'exer5 of sec 3.5' ans = exer5 of sec 3.5 >> u1 = [ 1 1 1]' u1 = 1 1 1 >> u2 = [1 2 2]' u2 = 1 2 2 >> u3 = [2 3 4]' u3 = 2 3 4 >> a = [u1,u2,u3] a = 1 1 2 1 2 3 1 2 4 >> trans = inv(a) trans = 2 0 -1 -1 2 -1 0 -1 1 >> a a = 1 1 2 1 2 3 1 2 4 >> v = [3 2 5]' v = 3 2 5 >> aug = [a,b] ??? Undefined function or variable 'b'. >> b = v b = 3 2 5 >> aug = [a,b] aug = 1 1 2 3 1 2 3 2 1 2 4 5 >> rref(aug) ans = 1 0 0 1 0 1 0 -4 0 0 1 3 >> trans * b ans = 1 -4 3 >> v1 = [4 6 7]' v1 = 4 6 7 >> a a = 1 1 2 1 2 3 1 2 4 >> aug = [a,v1] aug = 1 1 2 4 1 2 3 6 1 2 4 7 >> rref(aug) ans = 1 0 0 1 0 1 0 1 0 0 1 1 >> v2 = [0 1 1]' v2 = 0 1 1 >> aug = [a,v2] aug = 1 1 2 0 1 2 3 1 1 2 4 1 >> rref(aug) ans = 1 0 0 -1 0 1 0 1 0 0 1 0 >> a = [2 2 ; -1 1] a = 2 2 -1 1 >> inv(a) ans = 0.2500 -0.5000 0.2500 0.5000 >> aug = [-1 1 0; 2 2 1] aug = -1 1 0 2 2 1 >> rref(aug) ans = 1.0000 0 0.2500 0 1.0000 0.2500 >> a =[1 1 1 1; 0 1 1 1; 0 0 1 1; 0 0 0 1] a = 1 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 >> inv(a) ans = 1 -1 0 0 0 1 -1 0 0 0 1 -1 0 0 0 1 >> oldcoord = [2 3 4 5]' oldcoord = 2 3 4 5 >> inv(a) * oldcoord ans = -1 -1 -1 5 >> 'end fri 25 feb 05' ans = end fri 25 feb 05 >> quit] ??? quit] | Error: Missing operator, comma, or semicolon. >> quit >> 'start mon 28 feb 05' ans = start mon 28 feb 05 >> 'exer 1' ans = exer 1 >> '1b' ans = 1b >> a = [-3 1 3 4; 1 2 -1 -2; -3 8 4 2] a = -3 1 3 4 1 2 -1 -2 -3 8 4 2 >> rref(a) ans = 1.0000 0 0 -1.4286 0 1.0000 0 -0.2857 0 0 1.0000 0 >> b = a' b = -3 1 -3 1 2 8 3 -1 4 4 -2 2 >> c = rref(b) c = 1 0 0 0 1 0 0 0 1 0 0 0 >> d = c' d = 1 0 0 0 0 1 0 0 0 0 1 0 >> a a = -3 1 3 4 1 2 -1 -2 -3 8 4 2 >> rref(a) ans = 1.0000 0 0 -1.4286 0 1.0000 0 -0.2857 0 0 1.0000 0 >> 'exer 1a' ans = exer 1a >> a = [1 3 2; 2 1 4; 4 7 8 ] a = 1 3 2 2 1 4 4 7 8 >> rref(a) ans = 1 0 2 0 1 0 0 0 0 >> b = a' b = 1 2 4 3 1 7 2 4 8 >> c = rref(b) c = 1 0 2 0 1 1 0 0 0 >> d = c' d = 1 0 0 0 1 0 2 1 0 >> 'end mon 28 feb' ans = end mon 28 feb >> quit >> 'start fri 4 march' ans = start fri 4 march >> 'end fri 4 mar--no computer examples done today' ans = end fri 4 mar--no computer examples done today >> quit >> 'start mon 14 march 05' ans = start mon 14 march 05 >> 'sec 5.2, exer 1b' ans = sec 5.2, exer 1b >> a = [ 1 3 1; 2 4 0] a = 1 3 1 2 4 0 >> rref(a) ans = 1 0 -2 0 1 1 >> >> 'sec 5.3, exer 1a' ans = sec 5.3, exer 1a >> a = [1 1 ; 2 -3; 0 0] a = 1 1 2 -3 0 0 >> b = [3 1 2]' b = 3 1 2 >> aug =[a,b] aug = 1 1 3 2 -3 1 0 0 2 >> normaug = a' * aug normaug = 5 -5 5 -5 10 0 >> rref(normaug) ans = 1 0 2 0 1 1 >> x0 = [2 1]' x0 = 2 1 >> 'is our least squares solution' ans = is our least squares solution >> p = a * x0 p = 3 1 0 >> b b = 3 1 2 >> error = b - p error = 0 0 2 >> norm(error) ans = 2 >> 'end mon 14 mar 05' ans = end mon 14 mar 05 >> quit >> 'start wed 16 mar 05' ans = start wed 16 mar 05 >> 'sec 5.3, exer 1 b' ans = sec 5.3, exer 1 b >> a = [-1 1; 2 1 ; 1 -2] a = -1 1 2 1 1 -2 >> b = [10 5 20]' b = 10 5 20 >> aug = [a,b] aug = -1 1 10 2 1 5 1 -2 20 >> rref(aug) ans = 1 0 0 0 1 0 0 0 1 >> 'not solvable by ch1, as b is not in col.sp. of A' ans = not solvable by ch1, as b is not in col.sp. of A >> 'solve normal eqns' ans = solve normal eqns >> normaug = a' * aug normaug = 6 -1 20 -1 6 -25 >> rref(normaug) ans = 1.0000 0 2.7143 0 1.0000 -3.7143 >> x0 = [19/7 -26/7]' x0 = 2.7143 -3.7143 >> p = a * x0 p = -6.4286 1.7143 10.1429 >> error = b - p error = 16.4286 3.2857 9.8571 >> a' * error ans = 1.0e-14 * -0.1776 0.0888 >> 'inf solutions for x0 in exer 3, lets do part a' ans = inf solutions for x0 in exer 3, lets do part a >> a = [ 1 2 ; 2 4; -1 -2] a = 1 2 2 4 -1 -2 >> b = [3 2 1]' b = 3 2 1 >> aug = [a,b] aug = 1 2 3 2 4 2 -1 -2 1 >> rref(aug) ans = 1 2 0 0 0 1 0 0 0 >> 'so cant solve by ch1' ans = so cant solve by ch1 >> 'form normal equns' ans = form normal equns >> normaug = a' * aug normaug = 6 12 6 12 24 12 >> rref(normaug) ans = 1 2 1 0 0 0 >> x0 = [1 0] x0 = 1 0 >> p = a * x0 ??? Error using ==> * Inner matrix dimensions must agree. >> x0 = [1 0]' x0 = 1 0 >> p = a * x0 p = 1 2 -1 >> a * [-1 1]' ans = 1 2 -1 >> a * [-3 2]' ans = 1 2 -1 >> 'so many choices for x0, but all lead to same p' ans = so many choices for x0, but all lead to same p >> error = b - p error = 2 0 2 >> norm(error) ans = 2.8284 >> 'back to exer 1a, do with proj matrix ??? 'back to exer 1a, do with proj matrix | Error: "End of Input" expected, "incomplete string" found. >> a = [ -1 1; 2 1; 1 -2] a = -1 1 2 1 1 -2 >> b = [10 5 20]' b = 10 5 20 >> n = a' * a n = 6 -1 -1 6 >> rref(n) ans = 1 0 0 1 >> 'so n is invertible; and we can form proj matrix p' ans = so n is invertible; and we can form proj matrix p >> P = a * inv( n ) * a' P = 0.2857 -0.1429 -0.4286 -0.1429 0.9714 -0.0857 -0.4286 -0.0857 0.7429 >> p = P * b p = -6.4286 1.7143 10.1429 >> 'so this is what we got, doing it the general wayh' ans = so this is what we got, doing it the general wayh >> 'end wed 16 mar 05' ans = end wed 16 mar 05 >> quit >> >> 'start fri 18 mar 05' ans = start fri 18 mar 05 >> 'sec 5.4, exzer 5a' ans = sec 5.4, exzer 5a >> x = [ -1 0 1 2]' x = -1 0 1 2 >> ones = [1 1 1 1]' ones = 1 1 1 1 >> y = [ 0 1 3 9] y = 0 1 3 9 >> a = [ x,ones] a = -1 1 0 1 1 1 2 1 >> aug = [ a,y] ??? Error using ==> horzcat All matrices on a row in the bracketed expression must have the same number of rows. >> y = y' y = 0 1 3 9 >> aug = [a , y] aug = -1 1 0 0 1 1 1 1 3 2 1 9 >> rref(aug) ans = 1 0 0 0 1 0 0 0 1 0 0 0 >> 'so cant solve exactly by ch1' ans = so cant solve exactly by ch1 >> 'so applyh least squares' ans = so applyh least squares >> normaug = a' * aug normaug = 6 2 21 2 4 13 >> rref(normaug) ans = 1.0000 0 2.9000 0 1.0000 1.8000 >> 'exer 6' ans = exer 6 >> x x = -1 0 1 2 >> xsq = [ 1 0 1 4]' xsq = 1 0 1 4 >> a = [xsq, x, ones] a = 1 -1 1 0 0 1 1 1 1 4 2 1 >> aug = [a,y] aug = 1 -1 1 0 0 0 1 1 1 1 1 3 4 2 1 9 >> rref(aug) ans = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 >> 'so cannot solve by ch1, lets do least squares' ans = so cannot solve by ch1, lets do least squares >> normaug = a' * aug normaug = 18 8 6 39 8 6 2 21 6 2 4 13 >> rref(normaug) ans = 1.0000 0 0 1.2500 0 1.0000 0 1.6500 0 0 1.0000 0.5500 >> x x = -1 0 1 2 >> xcube = [ -1 0 1 8] xcube = -1 0 1 8 >> >> xcube = xcube'5~6~ ??? xcube = xcube'5~6~ | Error: Missing operator, comma, or semicolon. >> xcube = xcube' xcube = -1 0 1 8 >> a = [xcube, xsq, x, ones] a = -1 1 -1 1 0 0 0 1 1 1 1 1 8 4 2 1 >> aug = [a,y] aug = -1 1 -1 1 0 0 0 0 1 1 1 1 1 1 3 8 4 2 1 9 >> rref(aug) ans = 1.0000 0 0 0 0.5000 0 1.0000 0 0 0.5000 0 0 1.0000 0 1.0000 0 0 0 1.0000 1.0000 >> 'end fri 18 mar 05' ans = end fri 18 mar 05 >> quit >> 'start Mon 28 Mar 05' ans = start Mon 28 Mar 05 >> u1 = [ 1/(3*sqrt(2)) 1/(3*sqrt(2)) -4/(3*sqrt(2))]' u1 = 0.2357 0.2357 -0.9428 >> us = [2/3 2/3 1/3]' us = 0.6667 0.6667 0.3333 >> u2 = us u2 = 0.6667 0.6667 0.3333 >> u3= [1/sqrt(2) -1/sqrt(2) 0]' u3 = 0.7071 -0.7071 0 >> u1' * u2 ans = 0 >> u1' * u3 ans = 0 >> u2' * u3 ans = 0 >> u1' * u1 ans = 1.0000 >> norm(u1) ans = 1.0000 >> norm(u2)5 ??? norm(u2)5 | Error: Missing operator, comma, or semicolon. >> norm(u2) ans = 1 >> norm(u3) ans = 1.0000 >> x = [1 1 1]' x = 1 1 1 >> 'first, old ch1 2way' ans = first, old ch1 2way >> a = [u1,u2,u3] a = 0.2357 0.6667 0.7071 0.2357 0.6667 -0.7071 -0.9428 0.3333 0 >> aug = [a, x] aug = 0.2357 0.6667 0.7071 1.0000 0.2357 0.6667 -0.7071 1.0000 -0.9428 0.3333 0 1.0000 >> rref(aug) ans = 1.0000 0 0 -0.4714 0 1.0000 0 1.6667 0 0 1.0000 0 >> c1 = x'*u1 c1 = -0.4714 >> x'*u2 ans = 1.6667 >> x' * u3 ans = 0 >> 'exer 3' ans = exer 3 >> x = [1 2 2]' x = 1 2 2 >> c2 =x' * u2 c2 = 2.6667 >> c3 = x' *u3 c3 = -0.7071 >> x x = 1 2 2 >> c2*x2 + c3 * x3 ??? Undefined function or variable 'x2'. >> c2 * u2 + c3 * u3 ans = 1.2778 2.2778 0.8889 >> a = [u2,u3] a = 0.6667 0.7071 0.6667 -0.7071 0.3333 0 >> aug = [a,x][ ??? aug = [a,x][ | Error: Missing operator, comma, or semicolon. >> aug = [a,x] aug = 0.6667 0.7071 1.0000 0.6667 -0.7071 2.0000 0.3333 0 2.0000 >> normaug = a' * aug normaug = 1.0000 0 2.6667 0 1.0000 -0.7071 >> rref(normaug) ans = 1.0000 0 2.6667 0 1.0000 -0.7071 >> a * [2.6667 -0.7071]' ans = 1.2778 2.2778 0.8889 >> p ??? Undefined function or variable 'p'. >> p = c2 * u2 + c3 * u3 p = 1.2778 2.2778 0.8889 >> 'end mon 28 mar 05' ans = end mon 28 mar 05 >> quit >> 'start wed mar 30 05' ans = start wed mar 30 05 >> a = (1/2) * [ 1 1 1 1; -1 -1 1 1]' a = 0.5000 -0.5000 0.5000 -0.5000 0.5000 0.5000 0.5000 0.5000 >> 'doing exer 19a' ans = doing exer 19a >> b = [4 0 0 0]' b = 4 0 0 0 >> aug = [a,b] aug = 0.5000 -0.5000 4.0000 0.5000 -0.5000 0 0.5000 0.5000 0 0.5000 0.5000 0 >> normaug = a' * aug normaug = 1 0 2 0 1 -2 >> xhat = [2 -2]' xhat = 2 -2 >> p = a * xhat p = 2 2 0 0 >> a' * b ans = 2 -2 >> a' * a * b ??? Error using ==> * Inner matrix dimensions must agree. >> a' * a * b ??? Error using ==> * Inner matrix dimensions must agree. >> a * a' * b ans = 2 2 0 0 >> 'exer 20' ans = exer 20 >> p = a * a' p = 0.5000 0.5000 0 0 0.5000 0.5000 0 0 0 0 0.5000 0.5000 0 0 0.5000 0.5000 >> b b = 4 0 0 0 >> p * b ans = 2 2 0 0 >> 'end wed 30 mar 05' ans = end wed 30 mar 05 >> quit >> 'start fri 1 apr 05' ans = start fri 1 apr 05 >> v1 = [1 2 -2]' v1 = 1 2 -2 >> v2 = [4 3 2]' v2 = 4 3 2 >> v3 = [1 2 1]' v3 = 1 2 1 >> q1 =v1 q1 = 1 2 -2 >> q2 = v2 - ( (v2'*q1)/(q1*q1) ) * q1 ??? Error using ==> * Inner matrix dimensions must agree. >> q2 = v2 - ( (v2'*q1)/(q1'*q1) ) * q1 q2 = 3.3333 1.6667 3.3333 >> q3 = v3 - ( (v3'*q1)/q1'*q1) ) * q1 - ( (v3'*q2)/q2'*q2) ) * q2 ??? q3 = v3 - ( (v3'*q1)/q1'*q1) ) * q1 - ( (v3'*q2)/q2'*q2) ) * q2 | Error: Missing operator, comma, or semicolon. >> q3 = v3 - ( (v3'*q1)/(q1'*q1) ) * q1 - ( (v3'*q2)/(q2'*q2) ) * q2 q3 = -0.6667 0.6667 0.3333 >> q1 q2 q3 ??? q1 q2 q3 | Error: Missing operator, comma, or semicolon. >> q1,q2,q3 q1 = 1 2 -2 q2 = 3.3333 1.6667 3.3333 q3 = -0.6667 0.6667 0.3333 >> u1 = q1/norm(q1) u1 = 0.3333 0.6667 -0.6667 >> u2 = q2 / norm(q2) u2 = 0.6667 0.3333 0.6667 >> q3 q3 = -0.6667 0.6667 0.3333 >> u3 = q3 / norm(q3) u3 = -0.6667 0.6667 0.3333 >> 'end fri 1 apr 05' ans = end fri 1 apr 05 >> quit >> 'start mon 4 apr 05' ans = start mon 4 apr 05 >> a = [-1 1; 3 5]' a = -1 3 1 5 >> 'doing exer 2 for 1a' ans = doing exer 2 for 1a >> q = 1/sqrt(2) * [-1 1; 1 1]' q = -0.7071 0.7071 0.7071 0.7071 >> r = q' * a r = 1.4142 1.4142 0 5.6569 >> q * r ans = -1.0000 3.0000 1.0000 5.0000 >> a a = -1 3 1 5 >> q ,r q = -0.7071 0.7071 0.7071 0.7071 r = 1.4142 1.4142 0 5.6569 >> [q,r] = qr(a) q = -0.7071 0.7071 0.7071 0.7071 r = 1.4142 1.4142 0 5.6569 >> 'exer 5' ans = exer 5 >> a = [ 2 1 2; 1 1 1]' a = 2 1 1 1 2 1 >> b = [12 6 18]' b = 12 6 18 >> aug = [a,b] aug = 2 1 12 1 1 6 2 1 18 >> rref(aug) ans = 1 0 0 0 1 0 0 0 1 >> [q,r] = qr(a) q = -0.6667 0.2357 -0.7071 -0.3333 -0.9428 -0.0000 -0.6667 0.2357 0.7071 r = -3.0000 -1.6667 0 -0.4714 0 0 >> >> q = [q(:,1),q(:,2)] q = -0.6667 0.2357 -0.3333 -0.9428 -0.6667 0.2357 >> r = [r(1,:); r(2,:)] r = -3.0000 -1.6667 0 -0.4714 >> q * r ans = 2.0000 1.0000 1.0000 1.0000 2.0000 1.0000 >> a a = 2 1 1 1 2 1 >> q' * b ans = -22.0000 1.4142 >> simplenormaug = [r,q'*b] simplenormaug = -3.0000 -1.6667 -22.0000 0 -0.4714 1.4142 >> rref(simplenormaug) ans = 1.0000 0 9.0000 0 1.0000 -3.0000 >> 'end mon 4 april 05' ans = end mon 4 april 05 >> quit >> 'start mon 11 apr 05' ans = start mon 11 apr 05 >> 'problem example in class' ans = problem example in class >> a = [1 1; 1 -1] a = 1 1 1 -1 >> eig(a) ans = -1.4142 1.4142 >> [a,b] = eig(a) a = 0.3827 -0.9239 -0.9239 -0.3827 b = -1.4142 0 0 1.4142 >> [vec,val] = eig(a) vec = -0.5556 -0.8315 -0.8315 0.5556 val = -1 0 0 1 >> b = [1 1 ; 1 2] b = 1 1 1 2 >> eig(b) ans = 0.3820 2.6180 >> eig(a) ans = -1 1 >> a a = 0.3827 -0.9239 -0.9239 -0.3827 >> a = [1 1 ; 1 -1] a = 1 1 1 -1 >> rref(a - (-sqrt(2))*eye(2)) ans = 1.0000 0.4142 0 0 >> [vec,val] = eig(a) vec = 0.3827 -0.9239 -0.9239 -0.3827 val = -1.4142 0 0 1.4142 >> rref(a - sqrt(2)*eye(2)) ans = 1.0000 -2.4142 0 0 >> 'exer 1a' ans = exer 1a >> a = [ 1 1 ; -2 4] a = 1 1 -2 4 >> [vec,val] = eig(a) vec = -0.7071 -0.4472 -0.7071 -0.8944 val = 2 0 0 3 >> 'exer 2a' ans = exer 2a >> a = [-1 2 ; 2 -1] a = -1 2 2 -1 >> [vec,val] = eig(a) vec = 0.7071 0.7071 -0.7071 0.7071 val = -3 0 0 1 >> aug = [1 1 3; -1 1 -2] aug = 1 1 3 -1 1 -2 >> rref(aug) ans = 1.0000 0 2.5000 0 1.0000 0.5000 >> 'end mon 11 apr 05' ans = end mon 11 apr 05 >> quit >> 'start wed 13 apr 05' ans = start wed 13 apr 05 >> 'exer 1d of sec 6.2' ans = exer 1d of sec 6.2 >> a = [1 -1; 1 1] a = 1 -1 1 1 >> eig(a) ans = 1.0000 + 1.0000i 1.0000 - 1.0000i >> [vec,val] = eig(a) vec = 0.7071 0.7071 0 - 0.7071i 0 + 0.7071i val = 1.0000 + 1.0000i 0 0 1.0000 - 1.0000i >> >> 'exer 5a' ans = exer 5a >> a = [0 0 1 0; 0 0 0 1; 0 -2 0 0; 1 3 0 0] a = 0 0 1 0 0 0 0 1 0 -2 0 0 1 3 0 0 >> eig(a) ans = -1.4142 -1.0000 1.4142 1.0000 >> [vec,val] = eig(a) vec = -0.4082 0.6325 0.4082 -0.6325 0.4082 -0.3162 -0.4082 0.3162 0.5774 -0.6325 0.5774 -0.6325 -0.5774 0.3162 -0.5774 0.3162 val = -1.4142 0 0 0 0 -1.0000 0 0 0 0 1.4142 0 0 0 0 1.0000 >> vec(:,1)/.4082 ans = -1.0001 1.0001 1.4144 -1.4144 >> vec(:,2)/.3162 ans = 2.0002 -1.0001 -2.0002 1.0001 >> vec(:,3)/.4082 ans = 1.0001 -1.0001 1.4144 -1.4144 >> vec(:,4)/.3162 ans = -2.0002 1.0001 -2.0002 1.0001 >> 'exer 6' ans = exer 6 >> a = [ 0 0 1 0; 0 0 0 1; 0 -2 1 1; 2 0 2 -1] a = 0 0 1 0 0 0 0 1 0 -2 1 1 2 0 2 -1 >> [vec,val] = eig(a) vec = -0.3296 -0.5883 0.3320 + 0.0000i 0.3320 - 0.0000i 0.3973 0.3922 0.3662 - 0.2210i 0.3662 + 0.2210i 0.5468 0.5883 0.4414 + 0.2664i 0.4414 - 0.2664i -0.6592 -0.3922 0.6641 0.6641 val = -1.6590 0 0 0 0 -1.0000 0 0 0 0 1.3295 + 0.8023i 0 0 0 0 1.3295 - 0.8023i >> quit >> 'start fri 15 apr 05' ans = start fri 15 apr 05 >> 'exer 1a of sec 6.3' ans = exer 1a of sec 6.3 >> a = [0 1; 1 0] a = 0 1 1 0 >> [vec,val] = eig(a) vec = -0.7071 0.7071 0.7071 0.7071 val = -1 0 0 1 >> v1 =[-1 1]' v1 = -1 1 >> v2 = [1 1]' v2 = 1 1 >> s = [v1,v2] s = -1 1 1 1 >> inv(s) ans = -0.5000 0.5000 0.5000 0.5000 >> inv(s) * a * s ans = -1 0 0 1 >> s = vec s = -0.7071 0.7071 0.7071 0.7071 >> inv(s) ans = -0.7071 0.7071 0.7071 0.7071 >> inv(s) * a * s ans = -1 0 0 1 >> d = val d = -1 0 0 1 >> s * d * inv(s) ans = 0 1 1 0 >> a a = 0 1 1 0 >> 'exer 1f' ans = exer 1f >> a = [ 1 2 -1; 2 4 -2; 3 6 -3] a = 1 2 -1 2 4 -2 3 6 -3 >> eig(a) ans = 2.0000 -0.0000 0.0000 >> [vec,val] = eig(a) vec = -0.2673 0.2326 0.7879 -0.5345 0.3394 -0.0893 -0.8018 0.9114 0.6093 val = 2.0000 0 0 0 -0.0000 0 0 0 0.0000 >> 'eigenvectors partly by hand' ans = eigenvectors partly by hand >> rref(a - 2*eye(3)) ans = 1.0000 0 -0.3333 0 1.0000 -0.6667 0 0 0 >> rref(a) ans = 1 2 -1 0 0 0 0 0 0 >> s = [1 -2 1; 2 1 0; 3 0 1] s = 1 -2 1 2 1 0 3 0 1 >> inv(s) ans = 0.5000 1.0000 -0.5000 -1.0000 -1.0000 1.0000 -1.5000 -3.0000 2.5000 >> inv(s) * a * s ans = 2.0000 0 0 -0.0000 0 0 -0.0000 0 0 >> inv(vec) * a * vec ans = 2.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 >> vec vec = -0.2673 0.2326 0.7879 -0.5345 0.3394 -0.0893 -0.8018 0.9114 0.6093 >> inv(vec) ans = -1.8708 -3.7417 1.8708 -2.5790 -3.0436 2.8888 1.3959 -0.3708 -0.2181 >> d = vec d = -0.2673 0.2326 0.7879 -0.5345 0.3394 -0.0893 -0.8018 0.9114 0.6093 >> d = val d = 2.0000 0 0 0 -0.0000 0 0 0 0.0000 >> s * d * inv(s) ans = 1.0000 2.0000 -1.0000 2.0000 4.0000 -2.0000 3.0000 6.0000 -3.0000 >> >> a a = 1 2 -1 2 4 -2 3 6 -3 >> vec * d * inv(vec) ans = 1.0000 2.0000 -1.0000 2.0000 4.0000 -2.0000 3.0000 6.0000 -3.0000 >> vec vec = -0.2673 0.2326 0.7879 -0.5345 0.3394 -0.0893 -0.8018 0.9114 0.6093 >> 'exer 2, applying to 1f' ans = exer 2, applying to 1f >> s s = 1 -2 1 2 1 0 3 0 1 >> a a = 1 2 -1 2 4 -2 3 6 -3 >> d d = 2.0000 0 0 0 -0.0000 0 0 0 0.0000 >> s * d^6 * inv(s) ans = 32.0000 64.0000 -32.0000 64.0000 128.0000 -64.0000 96.0000 192.0000 -96.0000 >> a^6 ans = 32 64 -32 64 128 -64 96 192 -96 >> 'exer 4a' ans = exer 4a >> a = [2 1 ; -2 -1] a = 2 1 -2 -1 >> [vec,val] = eig(a) vec = 0.7071 -0.4472 -0.7071 0.8944 val = 1 0 0 0 >> d = val d = 1 0 0 0 >> e = [1 0 ; 0 0] e = 1 0 0 0 >> e1 = [-1 0 ; 0 0] e1 = -1 0 0 0 >> e * e -d ans = 0 0 0 0 >> e1 * e1 - d ans = 0 0 0 0 >> x = [1 -1; -1 2] x = 1 -1 -1 2 >> b = x * e * inv(x) b = 2 1 -2 -1 >> b * b - a ans = 0 0 0 0 >> b1 = x * e1 * inv(x) b1 = -2 -1 2 1 >> b1 * b1 - a ans = 0 0 0 0 >> 'end fri 15 apr' ans = end fri 15 apr >> quit >> 'start mon 18 apr 05' ans = start mon 18 apr 05 >> 'exer 8a, alpha = 0' ans = exer 8a, alpha = 0 >> a = [1 1 0 ;l 1 0 ; 0 0 0] ??? Undefined function or variable 'l'. >> a = [1 1 0 ; 1 1 0 ; 0 0 0] a = 1 1 0 1 1 0 0 0 0 >> rref(a) ans = 1 1 0 0 0 0 0 0 0 >> 'for eigenvalue 0' ans = for eigenvalue 0 >> rref(a - 2*eye(3)) ans = 1 -1 0 0 0 1 0 0 0 >> a a = 1 1 0 1 1 0 0 0 0 >> a a = 1 1 0 1 1 0 0 0 0 >> a(3,3) = 2 a = 1 1 0 1 1 0 0 0 2 >> 'now doing exer 8a, with alpha = 2' ans = now doing exer 8a, with alpha = 2 >> rref(a - 2 * eye(3) ) ans = 1 -1 0 0 0 0 0 0 0 >> rref(a) ans = 1 1 0 0 0 1 0 0 0 >> 'exer 8b, case alpha = 0' ans = exer 8b, case alpha = 0 >> rref(a) ans = 1 1 0 0 0 1 0 0 0 >> 'exer 8b, case alpha = 2' ans = exer 8b, case alpha = 2 >> a a = 1 1 0 1 1 0 0 0 2 >> a = [1 1 1; 1 1 1; 0 0 0] a = 1 1 1 1 1 1 0 0 0 >> 'above is matrix for exer 8b, case alpha = 0' ans = above is matrix for exer 8b, case alpha = 0 >> rref(s) ??? Undefined function or variable 's'. >> a a = 1 1 1 1 1 1 0 0 0 >> rref(a) ans = 1 1 1 0 0 0 0 0 0 >> a a = 1 1 1 1 1 1 0 0 0 >> 'exer 8b, alpha = 2' ans = exer 8b, alpha = 2 >> a(3,3) = 2 a = 1 1 1 1 1 1 0 0 2 >> rref(a - 2*eye(2) ) ??? Error using ==> - Matrix dimensions must agree. >> rref(a - 2 * eye(3) ) ans = 1 -1 0 0 0 1 0 0 0 >> 'exer 19' ans = exer 19 >> a = [.8 .3; .2 .7] a = 0.8000 0.3000 0.2000 0.7000 >> [vec,val] = eig(a) vec = 0.8321 -0.7071 0.5547 0.7071 val = 1.0000 0 0 0.5000 >> rref(a - 1*eye(2) ) ans = 1.0000 -1.5000 0 0 >> 'exer 20' ans = exer 20 >> a = [.7 .2 .1; .2 .7 .1; .1 .1 .8] a = 0.7000 0.2000 0.1000 0.2000 0.7000 0.1000 0.1000 0.1000 0.8000 >> eig(a) ans = 0.5000 0.7000 1.0000 >> [vec,val] = eig(a) vec = 0.7071 0.4082 0.5774 -0.7071 0.4082 0.5774 0.0000 -0.8165 0.5774 val = 0.5000 0 0 0 0.7000 0 0 0 1.0000 >> x = vec x = 0.7071 0.4082 0.5774 -0.7071 0.4082 0.5774 0.0000 -0.8165 0.5774 >> a a = 0.7000 0.2000 0.1000 0.2000 0.7000 0.1000 0.1000 0.1000 0.8000 >> d = val d = 0.5000 0 0 0 0.7000 0 0 0 1.0000 >> a a = 0.7000 0.2000 0.1000 0.2000 0.7000 0.1000 0.1000 0.1000 0.8000 >> x * d * inv(x) ans = 0.7000 0.2000 0.1000 0.2000 0.7000 0.1000 0.1000 0.1000 0.8000 >> a a = 0.7000 0.2000 0.1000 0.2000 0.7000 0.1000 0.1000 0.1000 0.8000 >> x = [150000 90000 60000]' x = 150000 90000 60000 >> 'end mon 18 apr' ans = end mon 18 apr >> quit >> 'start wed 20 apr 05' ans = start wed 20 apr 05 >> >> 'supplement to exer 19, sec 6.3; formula for a^n" ??? 'supplement to exer 19, sec 6.3; formula for a^n" | Error: "End of Input" expected, "incomplete string" found. >> a = [.8 .3 ; .2 .7] a = 0.8000 0.3000 0.2000 0.7000 >> [vec,valu] = eig(a) vec = 0.8321 -0.7071 0.5547 0.7071 valu = 1.0000 0 0 0.5000 >> s = [3 2; -1 1]'6~ ??? s = [3 2; -1 1]'6~ | Error: Missing operator, comma, or semicolon. >> s = [3 2 ; -1 1]' s = 3 -1 2 1 >> sinv = inv(s) sinv = 0.2000 0.2000 -0.4000 0.6000 >> 'diagonalize' ans = diagonalize >> sinv * a * s ans = 1.0000 -0.0000 0.0000 0.5000 >> 'exer 23a' ans = exer 23a >> a = [ 1 1 ; -1 -1]' a = 1 -1 1 -1 >> a = a' a = 1 1 -1 -1 >> a * a ans = 0 0 0 0 >> 'exer 24a' ans = exer 24a >> a = [-2 -1; 6 3] a = -2 -1 6 3 >> [vec,val] = eig(a) vec = -0.4472 0.3162 0.8944 -0.9487 val = 0 0 0 1 >> s =[ -1 1; 2 -3] s = -1 1 2 -3 >> sinv = inv(s) sinv = -3 -1 -2 -1 >> sinv * a * s ans = 0 0 0 1 >> exp(0) ans = 1 >> exp(1) ans = 2.7183 >> ed = [ 1 0 ; 0 exp(1)] ed = 1.0000 0 0 2.7183 >> ea = s * ed * invs ??? Undefined function or variable 'invs'. >> ea = s * ed * sinv ea = -2.4366 -1.7183 10.3097 6.1548 >> exp(a) ans = 0.1353 0.3679 403.4288 20.0855 >> a a = -2 -1 6 3 >> 'sec 6.4, exer 1a' ans = sec 6.4, exer 1a >> z = [4+2i; 4i] z = 4.0000 + 2.0000i 0 + 4.0000i >> z' ans = 4.0000 - 2.0000i 0 - 4.0000i >> w = [-2; 2+i] w = -2.0000 2.0000 + 1.0000i >> z' * w ans = -4.0000 - 4.0000i >> a = [1-i 2 ; 2 3] a = 1.0000 - 1.0000i 2.0000 2.0000 3.0000 >> a' ans = 1.0000 + 1.0000i 2.0000 2.0000 3.0000 >> 'not hermitian' ans = not hermitian >> a * a' ans = 6.0000 8.0000 - 2.0000i 8.0000 + 2.0000i 13.0000 >> a' * a ans = 6.0000 8.0000 + 2.0000i 8.0000 - 2.0000i 13.0000 >> 'not normal' ans = not normal >> inv(a) ans = -0.3000 + 0.9000i 0.2000 - 0.6000i 0.2000 - 0.6000i 0.2000 + 0.4000i >> a' ans = 1.0000 + 1.0000i 2.0000 2.0000 3.0000 >> 'not unitaryh' ans = not unitaryh >> 'exer 4 b' ans = exer 4 b >> a = [1 3+i; 3-i 4] a = 1.0000 3.0000 + 1.0000i 3.0000 - 1.0000i 4.0000 >> a' ans = 1.0000 3.0000 + 1.0000i 3.0000 - 1.0000i 4.0000 >> a' - a ans = 0 0 0 0 >> 'so hermitian' ans = so hermitian >> a * a' - a'*a ans = 0 0 0 0 >> 'so also normal' ans = so also normal >> inv(a) ans = -0.6667 - 0.0000i 0.5000 + 0.1667i 0.5000 - 0.1667i -0.1667 - 0.0000i >> a' ans = 1.0000 3.0000 + 1.0000i 3.0000 - 1.0000i 4.0000 >> 'not unitaryh' ans = not unitaryh >> 'end wed 20 apr 05' ans = end wed 20 apr 05 >> quit >> 'start fri 22 apr 05' ans = start fri 22 apr 05 >> clear >> >> 'example of a non-symmetric matrix' ans = example of a non-symmetric matrix >> a = [1 -1 ; 1 1] a = 1 -1 1 1 >> [vec,val] = eig(a) vec = 0.7071 0.7071 0 - 0.7071i 0 + 0.7071i val = 1.0000 + 1.0000i 0 0 1.0000 - 1.0000i >> a = [1 1; 2 2] a = 1 1 2 2 >> [vec,val] = eig(a) vec = -0.7071 -0.4472 0.7071 -0.8944 val = 0 0 0 3 >> eig(a) ans = 0 3 >> 'exer 5a' ans = exer 5a >> a = [2 1 ; 1 2] a = 2 1 1 2 >> eig(a) ans = 1 3 >> 'by hand, get orthonormal basis of eigenvectors' ans = by hand, get orthonormal basis of eigenvectors >> u = [-sqrt(2) sqrt(2) ; sqrt(2) sqrt(2) ]' u = -1.4142 1.4142 1.4142 1.4142 >> 'whoops, need to divide here by 2 to get unit vectors' ans = whoops, need to divide here by 2 to get unit vectors >> u = u/2 u = -0.7071 0.7071 0.7071 0.7071 >> 'does this diagonalize a?" ??? 'does this diagonalize a?" | Error: "End of Input" expected, "incomplete string" found. >> inv(u) * a * u ans = 1 0 0 3 >> 'is u an orthogonal matrix?' ans = is u an orthogonal matrix? >> inv(u) ans = -0.7071 0.7071 0.7071 0.7071 >> u' ans = -0.7071 0.7071 0.7071 0.7071 >> inv(j) - u' ans = 0.7071 - 1.0000i -0.7071 - 1.0000i -0.7071 - 1.0000i -0.7071 - 1.0000i >> inv(u) - u' ans = 1.0e-15 * 0.1110 -0.1110 -0.1110 -0.1110 >> 'so yes , the diagonalizing matrix is an orthogonal matrix' ans = so yes , the diagonalizing matrix is an orthogonal matrix >> 'exer 5b' ans = exer 5b >> a = [1 3+i; 3-i 4] a = 1.0000 3.0000 + 1.0000i 3.0000 - 1.0000i 4.0000 >> 'does method apply, that is, is the matrix a hermitian?' ans = does method apply, that is, is the matrix a hermitian? >> a a = 1.0000 3.0000 + 1.0000i 3.0000 - 1.0000i 4.0000 >> a' ans = 1.0000 3.0000 + 1.0000i 3.0000 - 1.0000i 4.0000 >> a - a' ans = 0 0 0 0 >> eig(a) ans = -1.0000 6.0000 >> [vec,val] = eig(a) vec = 0.8018 + 0.2673i 0.5071 + 0.1690i -0.5345 0.8452 val = -1.0000 0 0 6.0000 >> 'are the separate eigenspaces orthogonal ?' ans = are the separate eigenspaces orthogonal ? >> v1 = vec(:,1} ??? v1 = vec(:,1} | Error: ")" expected, "}" found. >> vec vec = 0.8018 + 0.2673i 0.5071 + 0.1690i -0.5345 0.8452 >> v1 = vec(:,1) v1 = 0.8018 + 0.2673i -0.5345 >> v2 = vec(:,2) v2 = 0.5071 + 0.1690i 0.8452 >> v2' * v1 ans = -3.2536e-17 + 1.9231e-17i >> 'up to computer roundoff, this is 0; so the eigenvectors WERE orthogonal' ans = up to computer roundoff, this is 0; so the eigenvectors WERE orthogonal >> 'are they unit vectors?' ans = are they unit vectors? >> norm(v1) ans = 1.0000 >> norm(v2) ans = 1 >> 'so we have an orthonormal basis of eigenvectors' ans = so we have an orthonormal basis of eigenvectors >> 'we do get diagonalization' ans = we do get diagonalization >> u = vec u = 0.8018 + 0.2673i 0.5071 + 0.1690i -0.5345 0.8452 >> inv(vec) * a * vec ans = -1.0000 + 0.0000i -0.0000 - 0.0000i -0.0000 + 0.0000i 6.0000 - 0.0000i >> val val = -1.0000 0 0 6.0000 >> inv(vec) * a * vec - val ans = 1.0e-15 * 0.3331 + 0.0155i -0.3724 - 0.0475i -0.3488 + 0.1956i 0.8882 - 0.0370i >> 'is u unitary?' ans = is u unitary? >> inv(u) ans = 0.8018 - 0.2673i -0.5345 + 0.0000i 0.5071 - 0.1690i 0.8452 + 0.0000i >> u' ans = 0.8018 - 0.2673i -0.5345 0.5071 - 0.1690i 0.8452 >> inv(u) - u' ans = 1.0e-16 * 0 0 + 0.1593i 0 - 0.2776i 0 + 0.1108i >> 'so yes, we do get a unitary matrix, from the matrix of orthonormal basis of eigenvectors' ans = so yes, we do get a unitary matrix, from the matrix of orthonormal basis of eigenvectors >> 'exer 5f' ans = exer 5f >> a = [1 1 1; 1 1 1; 1 1 1] a = 1 1 1 1 1 1 1 1 1 >> j ans = 0 + 1.0000i >> eig(a) ans = -0.0000 0.0000 3.0000 >> a a = 1 1 1 1 1 1 1 1 1 >> rref(a - 3 * eye(3) ) ans = 1 0 -1 0 1 -1 0 0 0 >> eig(a) ans = -0.0000 0.0000 3.0000 >> v1 = (1/sqrt(2)) * [-1 1 0]' v1 = -0.7071 0.7071 0 >> v2 = (1/sqrt(6)) * [-1 -1 2]' v2 = -0.4082 -0.4082 0.8165 >> v3 = (1/sqrt(3)) * [1 1 1]' v3 = 0.5774 0.5774 0.5774 >> u = [v1,v2,v3] u = -0.7071 -0.4082 0.5774 0.7071 -0.4082 0.5774 0 0.8165 0.5774 >> inv(u) * a * u ans = 0 0 -0.0000 0 0 -0.0000 0 0 3.0000 >> val val = -1.0000 0 0 6.0000 >> inv(u) - u' ans = 1.0e-15 * -0.1110 0.1110 -0.0305 0.0555 0.0555 -0.2220 -0.2220 -0.2220 -0.2220 >> [vec,val] = eig(a) vec = 0.4082 0.7071 0.5774 0.4082 -0.7071 0.5774 -0.8165 0 0.5774 val = -0.0000 0 0 0 0.0000 0 0 0 3.0000 >> u u = -0.7071 -0.4082 0.5774 0.7071 -0.4082 0.5774 0 0.8165 0.5774 >> 'end fri 22 apr 05' ans = end fri 22 apr 05 >> quit >> 'mon 25 apr 05' ans = mon 25 apr 05 >> 'continue exer 5f of sec 6.4 to proj matrices and spectral decomp of a' ans = continue exer 5f of sec 6.4 to proj matrices and spectral decomp of a >> a = [1 1 1; 1 1 1; 1 1 1] a = 1 1 1 1 1 1 1 1 1 >> eig(a) ans = -0.0000 0.0000 3.0000 >> u0 = [ -1/(sqrt(2)) 1/(sqrt(2)) 0 ; -1/(sqrt(6)) -1/(sqrt(6)) 2/(sqrt(6))]' u0 = -0.7071 -0.4082 0.7071 -0.4082 0 0.8165 >> u1 = [1 1 1]' u1 = 1 1 1 >> u1 / sqrt(3) ans = 0.5774 0.5774 0.5774 >> u1 = u1 / sqrt(3) u1 = 0.5774 0.5774 0.5774 >> u3 = u1 u3 = 0.5774 0.5774 0.5774 >> 'proj matrix for eigenspace of 0 is' ans = proj matrix for eigenspace of 0 is >> p0 = u0 * u0' p0 = 0.6667 -0.3333 -0.3333 -0.3333 0.6667 -0.3333 -0.3333 -0.3333 0.6667 >> 'projection matrix for eigenspace of 3 is ' ans = projection matrix for eigenspace of 3 is >> p3 = u3 * u3' p3 = 0.3333 0.3333 0.3333 0.3333 0.3333 0.3333 0.3333 0.3333 0.3333 >> 'to see decomposition of a' ans = to see decomposition of a >> p0 + p3 ans = 1.0000 0.0000 0 0.0000 1.0000 0 0 0 1.0000 >> a0 a * a0 ??? a0 a * a0 | Error: Missing operator, comma, or semicolon. >> a0 = a * p0 a0 = 0 0 0 0 0 0 0 0 0 >> a3 = a * p3 a3 = 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 >> a0 + a3 ans = 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 >> >> a a = 1 1 1 1 1 1 1 1 1 >> 'a version of exer 3a of sec 6.6' ans = a version of exer 3a of sec 6.6 >> a = [1 1/2 ; 1/2 1] a = 1.0000 0.5000 0.5000 1.0000 >> [vec,val] = eig(a) vec = -0.7071 0.7071 0.7071 0.7071 val = 0.5000 0 0 1.5000 >> 'end mon 25 apr' ans = end mon 25 apr >> quit >> 'start wed 27 apr 05' ans = start wed 27 apr 05 >> 'exer 6c of sec 6.6 ...by method of 6.6 or 6.7' ans = exer 6c of sec 6.6 ...by method of 6.6 or 6.7 >> a = [6 4 -2; 4 5 -3 ; -2 3 6] a = 6 4 -2 4 5 -3 -2 3 6 >> eig(a) ans = 9.0445 2.3117 5.6438 >> 'so pos def, using eigenvalues-positive test of sec 6.6.' ans = so pos def, using eigenvalues-positive test of sec 6.6. >> 'by det of principal minors test of sec 6.7:' ans = by det of principal minors test of sec 6.7: >> 'upper left 1x1 is 6, which is pos' ans = upper left 1x1 is 6, which is pos >> 'upper leftg2~2~2~ ??? 'upper leftg2~2~2~ | Error: "End of Input" expected, "incomplete string" found. >> >> >> 'upper left 2x2"' ans = upper left 2x2" >> a a = 6 4 -2 4 5 -3 -2 3 6 >> b = [6 4; 4 5] b = 6 4 4 5 >> det(b) ans = 14 >> 'upper left 3x3 is all of a' ans = upper left 3x3 is all of a >> det(a) ans = 118 >> 'so all 3 were pos, this is version from sec 6.7' ans = so all 3 were pos, this is version from sec 6.7 >> 'end wed 27 apr 05' ans = end wed 27 apr 05 >> quit >> 'start fri 29 apr 05' ans = start fri 29 apr 05 >> >> >> >> >> >> >> a = [1 -2 2; -2 1 -2; 2 -2 1] a = 1 -2 2 -2 1 -2 2 -2 1 >> a - a' ans = 0 0 0 0 0 0 0 0 0 >> aplusi = a + eye(3) aplusi = 2 -2 2 -2 2 -2 2 -2 2 >> rref(a) ans = 1 0 0 0 1 0 0 0 1 >> a a = 1 -2 2 -2 1 -2 2 -2 1 >> eig(a) ans = -1.0000 -1.0000 5.0000 >> aplusi aplusi = 2 -2 2 -2 2 -2 2 -2 2 >> rref(aplusi) ans = 1 -1 1 0 0 0 0 0 0 >> x = [1/sqrt(3) -1/sqrt(3) 1/sqrt(3); 1/sqrt(2) 1/sqrt(2) 0; -1/sqrt(6) 1/sqrt(6) 2/sqrt(6)]' x = 0.5774 0.7071 -0.4082 -0.5774 0.7071 0.4082 0.5774 0 0.8165 >> 'should be orthogonal, that is xinv should be x' ans = should be orthogonal, that is xinv should be x >> 'xinv should be xprime the transpose' ans = xinv should be xprime the transpose >> inv(x) ans = 0.5774 -0.5774 0.5774 0.7071 0.7071 0 -0.4082 0.4082 0.8165 >> x' ans = 0.5774 -0.5774 0.5774 0.7071 0.7071 0 -0.4082 0.4082 0.8165 >> inv(x) - x' ans = 1.0e-15 * -0.3331 0.1110 -0.2220 0.1110 0.1110 0 0.1110 -0.1110 -0.2220 >> 'no 4c of sec 6.7' ans = no 4c of sec 6.7 >> a = [16 8 4; 8 6 0 ; 4 0 7] a = 16 8 4 8 6 0 4 0 7 >> l = [1 0 0 ; 1/2 1 0; 1/4 -1 1] l = 1.0000 0 0 0.5000 1.0000 0 0.2500 -1.0000 1.0000 >> d = [16 0 0 ; 0 2 0 ; 0 0 4] d = 16 0 0 0 2 0 0 0 4 >> l * d * l' ans = 16 8 4 8 6 0 4 0 7 >> a a = 16 8 4 8 6 0 4 0 7 >> l * d * l' -a ans = 0 0 0 0 0 0 0 0 0 >> a = [5 -6 -6; -1 4 2; 3 -6 -4] a = 5 -6 -6 -1 4 2 3 -6 -4 >> rref(a - eye(3)) ans = 1.0000 0 -1.0000 0 1.0000 0.3333 0 0 0 >> rref(a - 2* eye(3)) ans = 1 -2 -2 0 0 0 0 0 0 >> 'end fri 29 apr 05' ans = end fri 29 apr 05 >> quit