python - numpy eigenvalues correct but eigenvectors wrong -
my code
print numpy.linalg.eig([[1, 2, 3], [5, 4, 9], [63, 7, 5]])
the output
(array([ 21.61455381, -9.76720959, -1.84734422]), array([[-0.17186028, -0.14352001, 0.03651047], [-0.48646994, -0.50447076, -0.8471429 ], [-0.85662772, 0.8514172 , 0.53010931]]))
i using online eigenvector calcualtor verify http://www.arndt-bruenner.de/mathe/scripts/engl_eigenwert2.htm gives following answer:
real eigenvalues: { -9.767209588804548 ; -1.8473442163236111 ; 21.61455380512816 }
eigenvectors:
for eigenvalue -9.767209588804548: [ -0.1685660264358372 ; -0.5925071319066865 ; 1 ]
for eigenvalue -1.8473442163236111: [ 0.06887346700751434 ; -1.5980532339710003 ; 1 ]
for eigenvalue 21.61455380512816: [ 0.20062423644695662 ; 0.5678895584242702 ; 1 ]
the values don't match. going wrong?
they match (sort of...).
these eigenvectors indeed same 1 another, ones online calculator not normalized (though should sake of convenience). eigenvectors of matrix can scaled scalar (a number) , still eigenvectors, not incorrect, convention keep them normalized, since more convenient other operations. quick check matlab (an independent source) shows eigenvalues of match ones returned numpy.
you notice numpy vectors satisfy property norm(eigenvector)=1
. if normalize vectors online calculator that
eigenvector <- eigenvector/norm(eigenvector)
you see match.
Comments
Post a Comment