# Power Method

## 774 days ago by mathmodel2017

n=7 A=random_matrix(ZZ,n) html('<p>This is my %s x %s matrix $A = %s$ created by Sage randomly.<p>'%(n,n,latex(A))) A.eigenvalues()
 This is my 7 x 7 matrix $A = \left(\begin{array}{rrrrrrr} -1 & 1 & 2 & -1 & -1 & -1 & 0 \\ 0 & 0 & 8 & -2 & 1 & 7 & 0 \\ 6 & 0 & -1 & -1 & -1 & -1 & 7 \\ 0 & -1 & 3 & 0 & -3 & 1 & 1 \\ -6 & -2 & 2 & -1 & -316 & 0 & 6 \\ -4 & -1 & 9 & 2 & -19 & -1 & 1 \\ -1 & 0 & -3 & 2 & -9 & 1 & 5 \end{array}\right)$ created by Sage randomly. [-315.8480438990963?, -5.466807806843260?, -0.8336577437784123?, -0.4677262960079723? - 6.101855031874144?*I, -0.4677262960079723? + 6.101855031874144?*I, 4.541981020866961? - 1.702829559873898?*I, 4.541981020866961? + 1.702829559873898?*I] This is my 7 x 7 matrix created by Sage randomly. [-315.8480438990963?, -5.466807806843260?, -0.8336577437784123?, -0.4677262960079723? - 6.101855031874144?*I, -0.4677262960079723? + 6.101855031874144?*I, 4.541981020866961? - 1.702829559873898?*I, 4.541981020866961? + 1.702829559873898?*I]
x= vector([1,1,1,1,1,1,1]) k=10 html('<p>$x_0 =%s$<p>'%( latex(x) ) ) for i in range(k): y=A*x ymod=y.apply_map(abs) c1=max(ymod) x=y/c1 print "Iteration number", i+1 html('$c_1=%s$ and $x_%s=%s$' %(c1.n(digits=7),i+1,latex(x.n(digits=7))) ) html('Dominant eigenvalue :$\lambda_{1} \\approx %s$'%(latex(c1.n(digits=5)))) html('Dominant eigenvector :$x \\approx %s$'%(latex(x.column().n(digits=2))))
 $x_0 =\left(1,\,1,\,1,\,1,\,1,\,1,\,1\right)$ Iteration number 1 $c_1=317.0000$ and $x_1=\left(-0.003154574,\,0.04416404,\,0.02839117,\,0.003154574,\,-1.000000,\,-0.04100946,\,-0.01577287\right)$ Iteration number 2 $c_1=315.8896$ and $x_2=\left(0.003615047,\,-0.003375376,\,0.002786183,\,0.009447057,\,1.000000,\,0.06095649,\,0.02787182\right)$ Iteration number 3 $c_1=315.8516$ and $x_3=\left(-0.003393434,\,0.004527730,\,-0.002711390,\,-0.009179747,\,-1.000000,\,-0.06015547,\,-0.02783828\right)$ Iteration number 4 $c_1=315.8480$ and $x_4=\left(0.003393510,\,-0.004509827,\,0.002712754,\,0.009179555,\,1.000000,\,0.06015108,\,0.02784194\right)$ Iteration number 5 $c_1=315.8480$ and $x_5=\left(-0.003393431,\,0.004509765,\,-0.002712661,\,-0.009179601,\,-1.000000,\,-0.06015108,\,-0.02784191\right)$ Iteration number 6 $c_1=315.8480$ and $x_6=\left(0.003393431,\,-0.004509762,\,0.002712663,\,0.009179602,\,1.000000,\,0.06015108,\,0.02784191\right)$ Iteration number 7 $c_1=315.8480$ and $x_7=\left(-0.003393431,\,0.004509762,\,-0.002712663,\,-0.009179602,\,-1.000000,\,-0.06015108,\,-0.02784191\right)$ Iteration number 8 $c_1=315.8480$ and $x_8=\left(0.003393431,\,-0.004509762,\,0.002712663,\,0.009179602,\,1.000000,\,0.06015108,\,0.02784191\right)$ Iteration number 9 $c_1=315.8480$ and $x_9=\left(-0.003393431,\,0.004509762,\,-0.002712663,\,-0.009179602,\,-1.000000,\,-0.06015108,\,-0.02784191\right)$ Iteration number 10 $c_1=315.8480$ and $x_10=\left(0.003393431,\,-0.004509762,\,0.002712663,\,0.009179602,\,1.000000,\,0.06015108,\,0.02784191\right)$ Dominant eigenvalue :$\lambda_{1} \approx 315.85$ Dominant eigenvector :$x \approx \left(\begin{array}{r} 0.0034 \\ -0.0045 \\ 0.0027 \\ 0.0092 \\ 1.0 \\ 0.060 \\ 0.028 \end{array}\right)$  Iteration number 1 and Iteration number 2 and Iteration number 3 and Iteration number 4 and Iteration number 5 and Iteration number 6 and Iteration number 7 and Iteration number 8 and Iteration number 9 and Iteration number 10 and Dominant eigenvalue : Dominant eigenvector :