eigenvectors created by numpy.linalg.eig don't seem correct

后端 未结 2 1255
闹比i
闹比i 2021-01-12 00:51

I create an arbitrary 2x2 matrix:

In [87]: mymat = np.matrix([[2,4],[5,3]])

In [88]: mymat
Out[88]: 
matrix([[2, 4],
        [5, 3]])

I at

2条回答
  •  -上瘾入骨i
    2021-01-12 01:19

    No, it's true. numpy does not work correctly. Example:

    A
    Out[194]: 
    matrix([[-3,  3,  2],
            [ 1, -1, -2],
            [-1, -3,  0]])
    
    E = np.linalg.eig(A)
    
    E
    Out[196]: 
    (array([ 2., -4., -2.]),
     matrix([[ -2.01889132e-16,   9.48683298e-01,   8.94427191e-01],
             [  5.54700196e-01,  -3.16227766e-01,  -3.71551690e-16],
             [ -8.32050294e-01,   2.73252305e-17,   4.47213595e-01]]))
    
    A*E[1] / E[1]
    Out[205]: 
    matrix([[ 6.59900617, -4.        , -2.        ],
            [ 2.        , -4.        , -3.88449298],
            [ 2.        ,  8.125992  , -2.        ]])
    

提交回复
热议问题