-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
project.org] On Behalf Of Arnau Mir
Sent: November-14-11 5:53 AM
To: r-help at r-project.org
Subject: [R] How to compute eigenvectors and eigenvalues?
Hello.
Consider the following matrix:
mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T)
[,1] [,2] [,3]
[1,] 0.00 0.25 0.25
[2,] 0.75 0.00 0.25
[3,] 0.25 0.75 0.50
The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is
not a diagonalizable matrix.
When you try to find the eigenvalues and eigenvectors with R, R
responses:
$values
[1] 1.00 -0.25 -0.25
$vectors
[,1] [,2] [,3]
[1,] 0.3207501 1.068531e-08 -1.068531e-08 [2,] 0.4490502 -7.071068e-01
-7.071068e-01 [3,] 0.8339504 7.071068e-01 7.071068e-01
The eigenvalues are correct but the eigenvectors aren't. Moreover, if
you try to compute the inverse of the matrix of eigenvectors, R is not
aware that this matrix is singular:
[,1] [,2] [,3]
[1,] 6.235383e-01 6.235383e-01 6.235383e-01 [2,] 3.743456e+07 -
9.358641e+06 -9.358640e+06 [3,] -3.743456e+07 9.358640e+06
9.358641e+06
My question is: how can I fix it?
Arnau.
------------------------------------------------------------
Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau.mir at uib.es
URL: http://dmi.uib.es/~arnau
------------------------------------------------------------
[[alternative HTML version deleted]]