Power Method

525 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 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)))) 
       

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 :

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 :