I Getting eigenvalues of an arbitrary matrix with programming

Trollfaz
Messages
143
Reaction score
14
I have learnt about the power iteration for any matrix say A.
How it works is that we start with a random compatible vector v0. We define vn+1 as
vn+1=( Avn)/|max(Avn)|
After an arbitrary large number of iterations vn will slowly converge to the eigenvector associated with the dominant eigenvalue of A. To get the dominant eigenvalue, simply divide Avn by vn. The inverse power iteration can be used to find the least dominant eigenvalue of A by performing the iterations on A-1 assuming A is not singular else, the least dominant eigenvalue of A is automatically 0.
Heres how my function looks like on python:
def dominant_eigen(matrix,precision):
v=random_vector(len(matrix))
for i in range(precision):
v=matrix_vector_product(matrix,v) #takes in A and v and returns Av
v=tuple(map(lambda x:x/infinity_norm_v(v),v)) #infinity_norm_v returns magnitude of the dominant row entry
Av=matrix_vector_product(matrix,v)
return {'eigenvector':v,'eigenvalue':Av[0]/v[0]}
Are there computer methods to get all the eigenvalues of any matrices?
 
Physics news on Phys.org
Thread 'How to define a vector field?'
Hello! In one book I saw that function ##V## of 3 variables ##V_x, V_y, V_z## (vector field in 3D) can be decomposed in a Taylor series without higher-order terms (partial derivative of second power and higher) at point ##(0,0,0)## such way: I think so: higher-order terms can be neglected because partial derivative of second power and higher are equal to 0. Is this true? And how to define vector field correctly for this case? (In the book I found nothing and my attempt was wrong...

Similar threads

Replies
33
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K