{VERSION 3 0 "IBM RISC UNIX" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Lubi18" 1 18 0 0 0 0 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Fo nt 0" -1 256 1 {CSTYLE "" -1 -1 "Courr14" 1 14 0 0 0 0 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 2" -1 257 1 {CSTYLE "" -1 -1 "Lubi18" 1 18 0 0 0 0 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 3" -1 258 1 {CSTYLE "" -1 -1 "Co urr14" 1 14 0 0 0 0 2 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 31 "Load the linear algebra pa ckage" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(linalg);\n" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "A sample matrix; the following sta tements are equivalent:\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 229 "A := \+ hilbert(4); # the 4x4 Hilbert matrix\n\nA := matrix(4,4, [1/1,1/2,1/3 ,1/4,\n 1/2,1/3,1/4,1/5,\n 1/3,1/4,1 /5,1/6,\n 1/4,1/5,1/6,1/7 ]);\n\nA := matrix(4,4, (i, j) -> 1/(i+j-1) );\n " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 67 "Standar d matrix computations are all in the linear algebra package." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "inverse(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "det(A);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 9 "trace(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "AE := eigenvals(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 " allvalues(AE);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "eigs := v ector( [allvalues(AE)] );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 130 "Com pute the eigenvalues of A as floating-point values.\nNotice that the i maginary parts are negligible\nfor the 4x4 Hilbert matrix.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "map(evalf, eigs);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "eigs := vector(4, i -> evalf(Re(eigs[i])));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "Find the characteristic polynom ial of A, using the variable 'lambda':" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "charpoly(A,lambda);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "Fi nd the roots of the characteristic polynomial: " }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 11 "fsolve(\");\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "Create a vector; the following statements are equivalent " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "b := vector([1,2,3,4]);\nb := v ector(4, [1,2,3,4]);\nb := vector(4, i -> i );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Use the evalm() evaluator for matrix expressions" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "evalm( A &* b - b ); # not ice: \"&*\" is matrix multiplication" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Solve the linear system Ax = b for x, and print x:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "linsolve(A,b);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 52 "Compute x = A^(-1) b, giving another way to obtain x" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "evalm( inverse(A) &* b );" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "Maple makes it easy to evaluate ma trix expressions" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "evalm( A &* inv erse(A) );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 81 "Some concepts that \+ are very useful in error analysis:\ncondition number and norm. " }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "cond(A);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 8 "norm(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "norm(inverse(A));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "no rm(A) * norm(inverse(A));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "?norm" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "The Fourier transform m atrix" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "n := 4;\nomega := \+ exp(-2*Pi*I/n);\nF := matrix(n,n, (i,j) -> omega^((i-1)*(j-1));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 53 "The F matrix is unitary (if we sca le it by 1/sqrt(n))" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "eval m( F &* htranspose(F) ); # htranspose is Hermitian transpose\ndet(F) ;\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 95 "U := evalm( 1/sqrt(n ) * F );\nevalm( U &* htranspose(U) );\nevalm( htranspose(U) &* U );\n det(U);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Defining matrix prop erties like 'unitary'" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "is _unitary := A -> equal( htranspose(A), inverse(A) );" }}}}{MARK "31 0 \+ 0" 54 }{VIEWOPTS 1 1 0 1 1 1803 }