This is an eigenvalue problem with 0 on the main diagonal.
It is almost always inefficient to find the determinant
as an intermediate step.  The original poster is looking for the
ngative of the eigenvalues of the matrix with the x replaced by zeros.

> tmp <- matrix(c(0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0),4,4)
> tmp
     [,1] [,2] [,3] [,4]
[1,]    0    1    0    0
[2,]    1    0    1    0
[3,]    0    1    0    1
[4,]    0    0    1    0
> eigen(tmp)
$values
[1]  1.618034  0.618034 -0.618034 -1.618034

$vectors
         [,1]      [,2]      [,3]      [,4]
[1,] 0.371748  0.601501  0.601501  0.371748
[2,] 0.601501  0.371748 -0.371748 -0.601501
[3,] 0.601501 -0.371748 -0.371748  0.601501
[4,] 0.371748 -0.601501  0.601501 -0.371748

> ee <- eigen(tmp)
> ee$values^4 - 3*ee$values^2 + 1
[1]  8.881784e-16 -3.774758e-15  1.776357e-15 -3.108624e-14
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to