Hi all,
I think I have a fairly basic question. I have a matrix and I would like to find the eigenvalues and eigenvector. In both MatLAB and Python (pylab) I can use the eig() function.
Can anyone explain the reason for the differing answers?
MatLAB Code
>> A = [10 -20 -20; -20 10 -20; -20 -20 10]
A =
10 -20 -20
-20 10 -20
-20 -20 10
>> [v, D] = eig(A)
v =
0.5774 -0.4082 0.7071
0.5774 -0.4082 -0.7071
0.5774 0.8165 0
D =
-30 0 0
0 30 0
0 0 30
>>
---------------------------------------------------
Python Code
>>> import pylab
>>> A = pylab.matrix('10 -20 -20; -20 10 -20; -20 -20 10')
>>> A
matrix([[ 10, -20, -20],
[-20, 10, -20],
[-20, -20, 10]])
>>> [v, D] = pylab.eig(A)
>>> v
array([ 30., -30., 30.])
>>> D
matrix([[ 0.81649658, -0.57735027, -0.0493825 ],
[-0.40824829, -0.57735027, -0.68112106],
[-0.40824829, -0.57735027, 0.73050357]])
>>>