{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 }{CSTYLE " " -1 256 "" 1 24 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 1 24 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 1 24 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT 256 27 "An introduction to Map le's " }{TEXT 257 6 "linalg" }{TEXT 258 8 " package" }}{PARA 0 "" 0 " " {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }{MPLTEXT 1 0 0 "" } }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "Getting started" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "You need to enter the following command b efore using the linear algebra package:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "Define a m by n matrix A with the command " }}{PARA 0 "" 0 "" {TEXT -1 70 "A:=array(1..m,1..n,[entries of first row],[second ro w],...,[mth row]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "A:=array(1..4 ,1..5,[[12,-7,11,-9,5],[-9,4,-8,7,-3],[-6,11,-7,3,-9],[4,-6,10,-5,12]] );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'MATRIXG6#7&7'\"#7!\"(\" #6!\"*\"\"&7'F-\"\"%!\")\"\"(!\"$7'!\"'F,F+\"\"$F-7'F0F5\"#5!\"&F*" }} }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 16 "Row manipulation" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "Use the command addrow(A,R1,R2,t); \+ to replace R2 by R2+t R1" }}{PARA 0 "" 0 "" {TEXT -1 59 "If your inpu t ends with a colon, the result is not printed." }{MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "A1:=addrow(A,1,2,9/12): A2:=addrow( A1,1,3,1/2):\nA3:=addrow(A2,1,4,-1/3);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#A3G-%'MATRIXG6#7&7'\"#7!\"(\"#6!\"*\"\"&7'\"\"!#!\"&\"\"%#\" \"\"F3F4#\"\"$F37'F0#\"#:\"\"##!\"$F;F<#!#8F;7'F0#!#6F7#\"#>F7!\"##\"# JF7" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "Use the command mulrow( A,R1,m); to multiply row R1 of A by m" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "A4:=mulrow(A3,1,1/12): A5:=mulrow(A4,2,-4 /5);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#A5G-%'MATRIXG6#7&7'\"\"\"#! \"(\"#7#\"#6F-#!\"$\"\"%#\"\"&F-7'\"\"!F*#!\"\"F4F7#F1F47'F6#\"#:\"\"# #F1F=F>#!#8F=7'F6#!#6\"\"$#\"#>FD!\"##\"#JFD" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 91 "Use the command pivot(A,i,j) to row-manipulate the \+ matrix so that the entries above and" }}{PARA 0 "" 0 "" {TEXT -1 45 "b elow the pivot position (i,j) are equal to 0" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "A6:=pivot(A5,2,2);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #>%#A6G-%'MATRIXG6#7&7'\"\"\"\"\"!#\"\"%\"\"&#!#8\"#:#F*F17'F+F*#!\"\" F.F4#!\"$F.7'F+F+F+F+!\"#7'F+F+#\"#GF.#!#TF1#\"$A\"F1" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "Use the command swaprow(A,R1,R2); to swap rows R1 and R2 of A" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "A7:=swaprow(A6,3,4);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#A7G-%'MATRIXG6#7&7'\"\"\"\"\"!#\"\"%\"\"&#!#8\"#:#F*F17'F+F*#!\" \"F.F4#!\"$F.7'F+F+#\"#GF.#!#TF1#\"$A\"F17'F+F+F+F+!\"#" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "A8:=mulrow(A7,3,5/28):A9:=pivot(A8, 3,3);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#A9G-%'MATRIXG6#7&7'\"\"\" \"\"!F+#!#5\"#@#!#BF.7'F+F*F+#!#D\"#%)#!#8\"#U7'F+F+F*#!#TF4#\"#hF77'F +F+F+F+!\"#" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "A10:=mulrow( A9,4,-1/2);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$A10G-%'MATRIXG6#7&7' \"\"\"\"\"!F+#!#5\"#@#!#BF.7'F+F*F+#!#D\"#%)#!#8\"#U7'F+F+F*#!#TF4#\"# hF77'F+F+F+F+F*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "We finally obt ain the row-reduced form of the matrix A." }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "A11:=pivot(A10,4,5);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$A11G-%'MATRIXG6#7&7'\"\"\"\"\"!F+#!#5\"#@F+7'F+F*F+# !#D\"#%)F+7'F+F+F*#!#TF2F+7'F+F+F+F+F*" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 44 "Row reduced form of a matrix and column span" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 83 "Maple has a routine which performs row-re duction for you: use the command rref(A)" }{MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "R:=rref(A);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"RG-%'MATRIXG6#7&7'\"\"\"\"\"!F+#!#5\"#@F+7'F+F*F+#! #D\"#%)F+7'F+F+F*#!#TF2F+7'F+F+F+F+F*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "You can obtain vectors which span the column space of the matrix with the command colspan(A)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "colspan(A);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<&-%'VECTORG6#7 &!\"(\"\"%\"#6!\"'-F%6#7&\"\"!F/\"#C!##*-F%6#7&F/F/F/\"#!)-F%6#7&F/\" \"\"\"\")!#a" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 164 "The span of the \+ columns of A is the span of the pivot columns. If we remove the fourth column of A (using the command delcols(A,4..4)), the span does not change." }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "B:=d elcols(A,4..4); colspan(B);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"BG- %'MATRIXG6#7&7&\"#7!\"(\"#6\"\"&7&!\"*\"\"%!\")!\"$7&!\"'F,F+F/7&F0F4 \"#5F*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<&-%'VECTORG6#7&!\"(\"\"%\"# 6!\"'-F%6#7&\"\"!\"\"\"\"\")!#a-F%6#7&F/F/\"#C!##*-F%6#7&F/F/F/!$o\"" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 35 "How to enter a matrix interac tively" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 92 "You can also enter a mat rix interactively using the command entermatrix(M) after having" }}{PARA 0 "" 0 "" {TEXT -1 21 "defined the matrix M:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "M:=array(1..2,1..2);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"MG-%&arrayG6%;\"\"\"\"\"#F(7\"" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "entermatrix(M);" }}}{EXCHG {PARA 0 "enter element 1,1 > " 0 "" {MPLTEXT 1 0 2 "1;" }}}{EXCHG {PARA 0 "enter element 1,2 > " 0 "" {MPLTEXT 1 0 2 "2;" }}}{EXCHG {PARA 0 "enter element 2,1 > " 0 "" {MPLTEXT 1 0 2 "3;" }}}{EXCHG {PARA 0 "enter element 2,2 > " 0 "" {MPLTEXT 1 0 2 "4;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'MATRIXG6#7$7$\"\"\"\"\"#7$\"\"$\"\"%" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 29 "Solution of a matrix equation" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "b:=vector([1,2,3,4]);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG-%'VECTORG6#7&\"\"\"\"\"#\"\"$\" \"%" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "Use the command linsolve (A,b) to solve the linear system " }{XPPEDIT 18 0 "A x = b" "/*&%\"A G\"\"\"%\"xGF%%\"bG" }{TEXT -1 46 ". The free variables, if any, are i n the form " }{XPPEDIT 18 0 "_t[1], _t[2]" "6$&%#_tG6#\"\"\"&F$6#\"\"# " }{TEXT -1 7 ", ..., " }{XPPEDIT 18 0 "_t[k]" "&%#_tG6#%\"kG" }{TEXT -1 1 " " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "sol:=linsolve(A,b);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%$solG-%'VECTORG6#7'&%#_tG6#\"\"\",&F )#\"\"&\"\")#\"\"(\"\"%F,,&F)#\"#T\"#S#\"$6&\"#?F,,&F)#\"#@\"#5#\"$@\" F/F,!#5" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "To find a particular s olution, set the free variable(s) to 0" }{MPLTEXT 1 0 0 "" }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 28 "subs(_t[1]=0,linsolve(A,b));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECTORG6#7'\"\"!#\"\"(\"\"%#\"$6&\"#?#\"$@\"\" \"&!#5" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 286 "To find the \"vector a ssociated with each free variable\", substract the particular solution from the general solution and then set the corresponding free variabl e to one and all of the others (if any) to 0. You can use the command \+ matadd(v,w,c1,c2) to compute the vector c1 v + c2 w" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "subs(_t[1]=1,matadd(linsolve(A,b),subs(_t[1]= 0,linsolve(A,b)),1,-1));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'VECTORG 6#7'\"\"\"#\"\"&\"\")#\"#T\"#S#\"#@\"#5\"\"!" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 112 "This is better achieved by finding the verctors in the kernel (or null space) of A, with the command kernel(A)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "kernel(A);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#<#-%'VECTORG6#7'\"\"\"#\"\"&\"\")#\"#T\"#S#\"#@\"#5\"\"!" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 41 "Eigenvalues, eigenvectors and Jor dan form" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Consider the following matrix" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "A:=ar ray(1..3,1..3,[[11,-2,-1],[0,12,-4],[1,2,5]]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'MATRIXG6#7%7%\"#6!\"#!\"\"7%\"\"!\"#7!\"%7%\" \"\"\"\"#\"\"&" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 93 "To find its eig envalues, we can use the command charpoly(A,lambda) and factor th e result" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "fact or(charpoly(A,lambda));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*&,&%'lambd aG\"\"\"!#7F&F&,&F%F&!\")F&\"\"#" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "We can also use the command eigenvalues(A)" }{MPLTEXT 1 0 0 "" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "eigenvalues(A);" }}{PARA 11 "" 1 " " {XPPMATH 20 "6%\"#7\"\")F$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 " The command eigenvectors(A) returns lists showing each eigenvalue, i ts multiplicity, and the corresponding eigenvector(s)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "eigenvectors(A);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6$7%\"#7\"\"\"<#-%'VECTORG6#7%!\"#F%\"\"!7%\"\")\"\"#<#-F(6#7%F%F% F%" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 "We now reduce A to its Jor dan form, first by finding a generalized eigenvector. We then solve th e equation " }{XPPEDIT 18 0 "v[2] = (A - lambda* I )*v[3]" "/&%\"vG6# \"\"#*&,&%\"AG\"\"\"*&%'lambdaGF*%\"IGF*!\"\"F*&F$6#\"\"$F*" }{TEXT -1 8 ", where " }{XPPEDIT 18 0 "v[2]=[1,1,1]" "/&%\"vG6#\"\"#7%\"\"\" \"\"\"\"\"\"" }{TEXT -1 22 " is an eigenvector of " }{XPPEDIT 18 0 "A " "I\"AG6\"" }{TEXT -1 19 " with eigenvalue 8." }{MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "I3:=array(1..3,1..3,identity);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%#I3G-%&arrayG6&%)identityG;\"\"\"\" \"$F)7\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "v[2]=subs(_t[1] =0,linsolve(A-8*I3,[1,1,1]));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/&%\" vG6#\"\"#-%'VECTORG6#7%#\"\"\"F'#F-\"\"%\"\"!" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "We can then define the Jordan form J" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "J:=array(1..3,1..3,[[12,0,0],[ 0,8,1],[0,0,8]]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"JG-%'MATRIXG6 #7%7%\"#7\"\"!F+7%F+\"\")\"\"\"7%F+F+F-" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "and the matrix " }{XPPEDIT 18 0 "M" "I\"MG6\"" }{TEXT -1 19 " whose columns are " }{XPPEDIT 18 0 "v[1]" "&%\"vG6#\"\"\"" } {TEXT -1 20 ", an eigenvector of " }{XPPEDIT 18 0 "A" "I\"AG6\"" } {TEXT -1 21 " with eigenvalue 12; " }{XPPEDIT 18 0 "v[2]" "&%\"vG6#\" \"#" }{TEXT -1 6 ", and " }{XPPEDIT 18 0 "v[3]" "&%\"vG6#\"\"$" } {TEXT -1 1 "." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "M:=array(1..3,1..3 ,[[-2,1,1/2],[1,1,1/4],[0,1,0]]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#> %\"MG-%'MATRIXG6#7%7%!\"#\"\"\"#F+\"\"#7%F+F+#F+\"\"%7%\"\"!F+F2" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "To check that " }{XPPEDIT 18 0 "A \+ = M*J*M^(-1)" "/%\"AG*(%\"MG\"\"\"%\"JGF&)F%,$\"\"\"!\"\"F&" }{TEXT -1 28 ", we compute the inverse of " }{XPPEDIT 18 0 "M" "I\"MG6\"" } {TEXT -1 2 " :" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "inverse(M);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#-%'MATRIXG6#7%7%#!\"\"\"\"%#\"\"\"\"\" #F(7%\"\"!F/F,7%F,F-!\"$" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "evalu ate the product of the 3 matrices" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "C:=evalm(M&*J&*inverse(M));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"CG-%'MATRIXG6#7%7%\"#6!\"#!\"\"7%\"\"!\"#7!\"%7%\" \"\"\"\"#\"\"&" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "and substract t he result from the matrix " }{XPPEDIT 18 0 "A" "I\"AG6\"" }{TEXT -1 2 ". " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalm(A-C);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'MATRIXG6#7%7%\"\"!F(F(F'F'" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 48 "A more direct way of obtaining a Jordan form of " }{XPPEDIT 18 0 "A" "I\"AG6\"" }{TEXT -1 67 " is to use the command jo rdan(A,P), which returns the Jordan form " }{XPPEDIT 18 0 "J" "I\"JG6 \"" }{TEXT -1 32 " of A, together with the matrix " }{XPPEDIT 18 0 "P " "I\"PG6\"" }{TEXT -1 11 " such that " }{XPPEDIT 18 0 "J =inverse(P)* A*P" "/%\"JG*(-%(inverseG6#%\"PG\"\"\"%\"AGF)F(F)" }{TEXT -1 1 "." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "jordan(A,P);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'MATRIXG6#7%7%\"#7\"\"!F)7%F)\"\")\"\"\"7%F)F)F+" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "print(P);" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#-%'MATRIXG6#7%7%#\"\"\"\"\"#F)F(7%#!\"\"\"\"%F)#F)F.7 %\"\"!F)F1" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK " 6 0 0" 32 }{VIEWOPTS 1 1 0 1 1 1803 }