# Calculation of symbolic eigenvalues

Hello, I am very new to Sage. In my first trial, I sought for eigenvalues of a symbolic matrix. However, Sage returns the following error: ArithmeticError: could not determine eigenvalues exactly using symbolic matrices; try using a different type of matrix via self.change_ring(), if possible

I have seen an example of eigenvalues of a symbolic matrix being calculated by Sage on another page. So I wonder what the problem is in this case. Below is my code:

var('s b')
A = matrix([[0,0,b,b,b,b,b,b,b,b],[s,0,0,0,0,0,0,0,0,0],[0,s,0,0,0,0,0,0,0,0],[0,0,s,0,0,0,0,0,0,0],[0,0,0,s,0,0,0,0,0,0],[0,0,0,0,s,0,0,0,0,0],[0,0,0,0,0,s,0,0,0,0],[0,0,0,0,0,0,s,0,0,0],[0,0,0,0,0,0,0,s,0,0],[0,0,0,0,0,0,0,0,s,0]]); A
A_evals = A.eigenvalues()


edit retag close merge delete

Sort by ยป oldest newest most voted

Hello, can you provide a link to the page where you saw eigenvalues of a symbolic matrix calculated?

What you could always compute is the characteristic polynomial, but unless the dimension is very low, how would you express the eigenvalues?

Below a computation of the characteristic polynomial. I use a polynomial ring instead of the symbolic ring, this is usually a better idea.

sage: R.<s,b> = QQ[]
sage: M = MatrixSpace(R,10)
sage: A = M([[0,0,b,b,b,b,b,b,b,b],
....:        [s,0,0,0,0,0,0,0,0,0],
....:        [0,s,0,0,0,0,0,0,0,0],
....:        [0,0,s,0,0,0,0,0,0,0],
....:        [0,0,0,s,0,0,0,0,0,0],
....:        [0,0,0,0,s,0,0,0,0,0],
....:        [0,0,0,0,0,s,0,0,0,0],
....:        [0,0,0,0,0,0,s,0,0,0],
....:        [0,0,0,0,0,0,0,s,0,0],
....:        [0,0,0,0,0,0,0,0,s,0]])
sage: A
[0 0 b b b b b b b b]
[s 0 0 0 0 0 0 0 0 0]
[0 s 0 0 0 0 0 0 0 0]
[0 0 s 0 0 0 0 0 0 0]
[0 0 0 s 0 0 0 0 0 0]
[0 0 0 0 s 0 0 0 0 0]
[0 0 0 0 0 s 0 0 0 0]
[0 0 0 0 0 0 s 0 0 0]
[0 0 0 0 0 0 0 s 0 0]
[0 0 0 0 0 0 0 0 s 0]
sage: A.charpoly()
x^10 - s^2*b*x^7 - s^3*b*x^6 - s^4*b*x^5 - s^5*b*x^4 - s^6*b*x^3 - s^7*b*x^2 - s^8*b*x - s^9*b


[Edited 2014-12-13 to take comments into account.]

The eigenvalues are the roots of the characteristic polynomial. As @Dima points out, for polynomials of degree up to three there are explicit formulas for finding the roots. In higher degree, some polynomials of very special types still will let you extract their roots with formulas, but most won't.

Here, the polynomial has a fairly simple form and is inviting us to play further.

more

Thanks a lot. Here is the link to the page where an example of symbolic eigenvalue is calculated. I tried it on my machine and it worked. I don't know how I should get the eigenvalues from the characteristic polynomial!

( 2014-12-12 15:04:54 -0500 )edit

in your link it works because the matrix is 3x3. Generally speaking, for matrices bigger than 4x4 it will fail, due to impossibility to have a general formula for roots of polynomials of degree bigger than 4.

( 2014-12-12 16:08:10 -0500 )edit