Find an eigenvector for a given eigenvalue R

I have a 100x100 matrix, and I found it to be the largest eigenvalue. Now I need to find an eigenvector corresponding to this eigenvalue. How can i do this?

+6
source share
2 answers

eigen Function does not give you what you are looking for?

 > B <- matrix(1:9, 3) > eigen(B) $values [1] 1.611684e+01 -1.116844e+00 -4.054214e-16 $vectors [,1] [,2] [,3] [1,] -0.4645473 -0.8829060 0.4082483 [2,] -0.5707955 -0.2395204 -0.8164966 [3,] -0.6770438 0.4038651 0.4082483 
+9
source

Reading the actual help of the state of the eigenfunction that $vectors is: is a "p * p-matrix whose columns contain eigenvectors x". The actual vector corresponding to the largest eigenvalue is the 1st column of $vectors . To get it straight:

 > B <- matrix(1:9, 3) > eig <- eigen(B) > eig$vectors[,which.max(eig$values)] [1] -0.4645473 -0.5707955 -0.6770438 # equivalent to: > eig$vectors[,1] [1] -0.4645473 -0.5707955 -0.6770438 

Note that @ user2080209's answer does not work: it will return the first line.

+3
source

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


All Articles