Skip to content

Finding determinants of x-loaded matrix?

3 messages · Bob Gotwals, David Winsemius, Richard M. Heiberger

#
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...
#
On Mar 20, 2009, at 9:09 AM, Bob Gotwals wrote:
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.
[,1] [,2] [,3] [,4]
[1,]    0    1    0    0
[2,]    1    0    1    0
[3,]    0    1    0    1
[4,]    0    0    1    0
$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
[1]  8.881784e-16 -3.774758e-15  1.776357e-15 -3.108624e-14