{VERSION 3 0 "SUN SPARC SOLARIS" "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 "" 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 8 4 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 8 2 0 0 0 0 0 0 -1 0 }} {SECT 0 {SECT 1 {PARA 3 "" 0 "" {TEXT -1 57 "Computing the Perron Eige nvector of a Non-negative Matrix" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "with(linalg):\nDigits:=3; # \+ Now Maple only keeps 3 decimal places.\n" }{TEXT -1 256 "For the follo wing matrix M, which is a rearrangement of M2, we compute the egenvect or corresponding to the largest eigenvalue. We also do this for the t ranspose of M. If M = (M_\{ij\}), think of m_\{ij\} at the number of times football team i beat team j.\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 163 "M:= matrix([[0,4.0,5,1,5,5],[6,0,4,9,4,3],[5,6,0,8,3 ,6],\n[9,1,2,0,2,3],[5,6,7,8,0,8],[5,7,4,7,2,0]]);\nMt:=transpose(M); \nX:=vector([1,1,1,1,1,1]);\nW:=evalm(M&*X); " }{TEXT -1 31 "Number o f games each team won.\n" }{MPLTEXT 1 0 17 "L:=evalm(Mt&*X); " }{TEXT -1 35 "Number of games each team played. \n" }{MPLTEXT 1 0 17 "S:=eval m(W + L); " }{TEXT -1 34 "Number of games each team played. " }}}} {SECT 1 {PARA 4 "" 0 "" {TEXT -1 48 "Loop to compute MX and then norma lize the output" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 18 "With the matrix Q " }{TEXT -1 94 "do \"n\" iterations of: \nCompute QX, then normaliz e the output so the sum of the components is 1" }{MPLTEXT 1 0 1 "\n" } {TEXT -1 0 "" }{TEXT -1 0 "" }{MPLTEXT 1 0 90 "MainEigenvect := proc(Q ,n) \nlocal i,k,X,Y,Z,sum;\nX:=vector([1,1,1,1,1,1]);\nY:=evalm(X/6); \+ " }{TEXT -1 47 "Normalize so the sum of the elements of Y is 1." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 106 "for k from 1 to n\ndo\n X:=evalm( Q&*Y):\n sum:= X[1] + X[2] + X[3] + X[4] + X[5] + X[6];\n Y:=evalm(X /sum);" }{TEXT -1 47 "Normalize so the sum of the elements of Y is 1. " }{MPLTEXT 1 0 28 "\nod;\nRETURN(evalm(Y));\nend;\n" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "Do the computation." }}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 19 "MainEigenvect(M,4);" }{TEXT -1 55 " With the m atrix M do MainEigenvect with 4 iterations." }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "MainEigenvect(M,10);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "MainEigenvect(Mt,10);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "MainEigenvect(Mt,20);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "0" 0 } {VIEWOPTS 1 1 0 3 2 1804 }