R friends, I need to find the determinant of this matrix x 1 0 0 1 x 1 0 0 1 x 1 0 0 1 x det yields x^4-3x^2+1 I can then use polyroot to find the roots of the coefficients. The question is about the use of "x", which is what I'm solving for. thanks in advance, and this is a back-burner question. Apologies if I have posted this incorrectly/to the wrong place, I'm a newbie to this list... -- Robert Gotwals, Chemistry Educator gotwals at ncssm.edu The North Carolina School of Science and Mathematics 1219 Broad Street (919) 416-2774
On Mar 20, 2009, at 9:09 AM, Bob Gotwals wrote:> > I need to find the determinant of this matrix > > x 1 0 0 > 1 x 1 0 > 0 1 x 1 > 0 0 1 x > > det yields x^4-3x^2+1 > > I can then use polyroot to find the roots of the coefficients. > > The question is about the use of "x", which is what I'm solving for.If you are asking how to use R for symbolic algebra, then the answer might be investigate package Ryacas.>David Winsemius, MD Heritage Laboratories West Hartford, CT
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>