How does R 开发者_开发技巧represent complex eigenvectors? For example:
> eigen(matrix(c(2,1,0,2),2,2))
$values
[1] 2 2
$vectors
[,1] [,2]
[1,] 0 4.440892e-16
[2,] 1 -1.000000e+00
This does not indicate that eigenvector is complex. So how can I determine if eigenvector returned by R is real or not?
In your example matrix, the eigenvectors/eigenvalues are all real. Here's an example of complex numbers:
R> eigen(matrix(runif(16),4,4))
$values
[1] 1.5121+0.0000i -0.3047+0.2981i -0.3047-0.2981i -0.1300+0.0000i
$vectors
[,1] [,2] [,3] [,4]
[1,] 0.4991+0i -0.5511+0.0000i -0.5511+0.0000i -0.2186+0i
[2,] 0.6880+0i 0.2158+0.4949i 0.2158-0.4949i -0.8228+0i
[3,] 0.4389+0i 0.4253+0.1411i 0.4253-0.1411i 0.5096+0i
[4,] 0.2914+0i -0.0639-0.4471i -0.0639+0.4471i 0.1249+0i
You can always check for complex number using:
R> is.complex(1+2i)
[1] TRUE
精彩评论