Reputation: 1009
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]]
Upvotes: 2
Views: 9057
Reputation: 548
It is important to note that normalizing eigenvectors can also change the direction/sign of the vectors. This could have consequences for some applications and the programmer should double check to ensure the signs make sense.
Upvotes: 1
Reputation: 1567
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]])]
Upvotes: 5
Reputation: 11201
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).
Upvotes: 3