Are eigenvectors not eigenvectors?

I did some matrix calculations and wanted to calculate the eigenvalues ​​and eigenvectors of this particular matrix:

enter image description here

I found my eigenvalues ​​and eigenvectors analytically and wanted to confirm my answer using numpy.linalg.eigh, since this matrix is ​​symmetric. Here is the problem: I find the expected eigenvalues, but the corresponding eigenvectors, apparently, are not eigenvectors for all

Here is a small piece of code that I used:

import numpy as n
def createA():
#create the matrix A
    m=3
    T = n.diag(n.ones(m-1.),-1.) + n.diag(n.ones(m)*-4.) +\
    n.diag(n.ones(m-1.),1.)
    I = n.identity(m)
    A = n.zeros([m*m,m*m])
    for i in range(m):
        a, b, c = i*m, (i+1)*m, (i+2)*m
        A[a:b, a:b] = T
        if i < m - 1:
            A[b:c, a:b] = A[a:b, b:c] = I
    return A

A = createA()
ev,vecs = n.linalg.eigh(A)
print vecs[0]
print n.dot(A,vecs[0])/ev[0]

So, for the first pair of eigenvalues ​​/ eigenvector this gives:

[  2.50000000e-01   5.00000000e-01  -5.42230975e-17  -4.66157689e-01
3.03192985e-01   2.56458619e-01  -7.84539156e-17  -5.00000000e-01
2.50000000e-01]

[ 0.14149052  0.21187998 -0.1107808  -0.35408209  0.20831606  0.06921674
0.14149052 -0.37390646  0.18211242]

In my understanding of the eigenvalue problem, it turns out that this vector lacks the equation A.vec = ev.vec, and therefore this vector is not an eigenvalue at all.

, . , :

rvec = [0.25,-0.35355339,0.25,-0.35355339,0.5,-0.35355339,0.25,
-0.35355339,0.25]
b = n.dot(A,rvec)/ev[0]
print n.allclose(real,b)

True.

- ? ? ?

( : . .)

+4
1

, . , vecs[:,0] vecs[0]

, ( eig, A )

import numpy as np
import numpy.linalg as LA
import numpy.random

A = numpy.random.randint(10,size=(4,4))
# array([[4, 7, 7, 7],
#        [4, 1, 9, 1],
#        [7, 3, 7, 7],
#        [6, 4, 6, 5]])

eval,evec = LA.eig(A)

evec[:,0]
# array([ 0.55545073+0.j,  0.37209887+0.j,  0.56357432+0.j,  0.48518131+0.j])

np.dot(A,evec[:,0]) / eval[0]
# array([ 0.55545073+0.j,  0.37209887+0.j,  0.56357432+0.j,  0.48518131+0.j])
+4

Source: https://habr.com/ru/post/1584033/


All Articles