Get non normalized eigenvectors in scipy

雨燕双飞 提交于 2019-12-22 11:20:57

问题


Scipy and Numpy returns eigenvectors normalized. I am trying to use the vectors for a physical application and I need them to not be normalized.

For example a = np.matrix('-3, 2; -1, 0') W,V = spl.eig(a)

scipy returns eigenvalues (W) of [-2,-1] and the modal matrix (V) (eigenvalues as columns) [[ 0.89442719 0.70710678][ 0.4472136 0.70710678]]

I need the original modal matrix [[2 1][1 1]]


回答1:


According to various related threads (1) (2) (3), there is no such thing as a "non normalized" eigenvector.

Indeed, an eigenvector v corresponding to the eigenvalue l of the matrix A is defined by,

A*v = l*v

and can therefore be multiplied by any scalar and remain valid.

While depending on the algorithm, the computed eigenvector can have a norm different from 1, this does not hold any particular meaning (physical or otherwise), and should not be relied on. It is customary to return a normalized eigenvector in most numerical libraries (scipy, R, matlab, etc).




回答2:


You should have a look at sympy. This package tries to solve this stuff by means of algebraic calculations instead of numeric ones (as numpy does).

import sympy as sp
sp.init_printing(use_unicode=True)

mat_a = sp.Matrix([[-3, 2], [-1, 0]])
mat_a.eigenvects()

Result is (eigenvalue, multiplicity, eigenvector):

[(-2, 1, [[2],[1]]), (-1, 1, [[1],[1]])]


来源:https://stackoverflow.com/questions/30946407/get-non-normalized-eigenvectors-in-scipy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!