# Is it possible to get normalised eigenvectors using eigenmatrix_right()?

I am trying to find out the diagonalizing matrix for a matrix using eigenmatrix_right(). The problem is that the eigenvector matrix returned by sage is not normalized. I have been writing a couple of for loops to normalize the eigenvectors. I was wondering whether there is a easier way maybe a option in eigenmatrix_right() which would give me an eigenmatrix with normalized eigenvectors?

edit retag close merge delete

Sort by » oldest newest most voted

If you use RDF matrices, the eigenvectors are normalized, since scipy by default normalizes eigenvectors:

sage: m=random_matrix(RDF, 3)
sage: D,P=m.eigenmatrix_right()
sage: P
[                    0.772199899036                     0.772199899036                    -0.343345671023]
[-0.293125911736 - 0.444881864588*I -0.293125911736 + 0.444881864588*I                     0.612459302127]
[ 0.174684604473 + 0.298914588669*I  0.174684604473 - 0.298914588669*I                     0.712044488377]
sage: P.column(0).norm()
1.0
sage: P.column(1).norm()
1.0
sage: P.column(2).norm()
1.0

more

Try the following:

M = Matrix(2,2,range(4)) # or any matrix you have around
M.eigenmatrix_right??


This will show the source code for eigenmatrix_right -- there, you'll see that eigenmatrix_right is defined by calling eigenmatrix_left on the transpose . . . checking

M.eigenmatrix_left??


will show you that eigenmatrix_left just builds a matrix from the vectors in eigenvectors_left . . .

M.eigenvectors_left??


does some real work: it gets the eigenspaces from eigenspaces_left and performs some further checks on the basis for each eigenspace.

So the short answer to your question is "No, there is not an option for eigenmatrix_right which will return normalized eigenvectors". However, you might be able to get them easily by getting the basis of eigenspaces_right and normailzing it yourself.

Good luck :)

more