Problem with eigenvalues



On Fri, 2010-02-05 at 12:13 -0600, Dustin Bortner wrote:

> I am simply trying to get the eigenvalues for a 6x6 Laplacian matrix (-R6) :
> 
> R6:matrix(
> [-16,10,1,1,3,1],
> [10,-(18),1,2,1,4],
> [1,1,-(2+3*8),8,8,8],
> [1,2,8,-(3+3*8),8,8],
> [3,1,8,8,-(4+3*8),8],
> [1,4,8,8,8,-(5+3*8)]
> );
> 
> eigenvalues(-R6);
>  -- an error. To debug this try: debugmode(true);

As the manual says:
"eigenvalues calls the function solve to find the roots of the
characteristic polynomial of the matrix. Sometimes solve may not be able
to find the roots of the polynomial; in that case some other functions
in this package"

You can obtain the characteristic polynomial with the charpoly function:

%i20) ratsimp(charpoly(-R6, x));
           6        5         4           3            2
(%o20)    x  - 144 x  + 8045 x  - 215572 x  + 2717524 x  - 12398724 x

solve will not be able to find its roots analytically, but you can use
"allroots" to find a numerical approximation to the eigenvalues:

(%o21) [x = 0.0, x = 10.27015921715914, x = 26.41600558396675,
   x = 34.44250311047909, x = 35.62420502908369, x = 37.24712705931132]
 
Regards,
Jaime