HW-Power Method Lkhagva

1916 days ago by bigdata2016

POWER METHOD

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.

[12.487229810116454?, -6.802980732708530? - 1.304865105006044?*I, -6.802980732708530? + 1.304865105006044?*I, 1.908779240516565? - 8.07377046124450?*I, 1.908779240516565? + 8.07377046124450?*I, 2.650586587133738? - 3.004431070390483?*I, 2.650586587133738? + 3.004431070390483?*I]

This is my 7 x 7 matrix created by Sage randomly.

[12.487229810116454?, -6.802980732708530? - 1.304865105006044?*I, -6.802980732708530? + 1.304865105006044?*I, 1.908779240516565? - 8.07377046124450?*I, 1.908779240516565? + 8.07377046124450?*I, 2.650586587133738? - 3.004431070390483?*I, 2.650586587133738? + 3.004431070390483?*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)))) 
       

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 :

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 :