{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 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 1 }0 0 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 1 }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 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 0 "" }{TEXT 258 24 "Linear A lgebra Powertool" }}{PARA 256 "" 0 "" {TEXT 256 31 "Finding the Invers e of a Matrix" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 259 26 "Workshee t by Russell Blyth" }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "Enter matrix to be inverted" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "A:=matri x([[1,4,-1],[-2,0,3],[3,6,1]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "Augment the matrix by \+ appending the identity" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "K :=augment(A,[1,0,0],[0,1,0],[0,0,1]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "Reduce the au gmented matrix to reduced row echelon form" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 11 "K:=rref(K);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 145 "If the n x n identity appears in the first n columns of the matrix, the last n x n columns \+ is the inverse; extract it using the submatrix command" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "AINV:=submatrix(K,1..3,4..6);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "Check the result:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "evalm(A &* AINV);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "evalm(AINV &* A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "The linalg package has a built-i n inverse command" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "invers e(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "If the matrix has no inverse, the procedure ab ove will not give the nx n identity in the first n x n columns of K. H ere is how the inverse function behaves: " }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 25 "B:=matrix([[2,4],[4,8]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "in verse(B);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 157 "The linalg package \+ includes a routine to generate random matrices with integer entries, f or testing purposes. Let's use it to generate matrices and inverses." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "C:=randmatrix(4,4);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 11 "inverse(C);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 134 "By default, the entri es of the randomly generated matrix fall between -99 and 99. An option can be added to specify the allowed range." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "E:=randmatrix(4,4,entries=rand(-5..5));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "(The variable name D is protected, and is used for the di fferential operator)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "D(x^ 2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "inverse(E);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 2 1" 0 } {VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }