Ask Your Question
2

Calculation of symbolic eigenvalues

asked 2014-12-12 18:17:24 +0200

kavir1698 gravatar image

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()

Many thanks for your support.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-12-12 19:18:16 +0200

slelievre gravatar image

updated 2014-12-13 10:34:53 +0200

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.

edit flag offensive delete link more

Comments

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!

kavir1698 gravatar imagekavir1698 ( 2014-12-12 22:04:54 +0200 )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.

Dima gravatar imageDima ( 2014-12-12 23:08:10 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-12-12 18:17:24 +0200

Seen: 1,778 times

Last updated: Dec 13 '14