Ask Your Question
0

Getting exact answers when using eigenvectors_right()

asked 2023-01-30 19:09:59 +0100

Tati gravatar image

I am trying to compute complex eigenvectors for a matrix that has two distinct complex eigenvalues. Is there a way to get the exact coefficients?

For example: A=matrix(QQ,2,2,[3, -13, 5,1]) A.eigenvectors_right()

Gives me: [(2 + 8I, [ (1, 0.07692307692307692? - 0.6153846153846154?I) ], 1), (2 - 8I, [ (1, 0.07692307692307692? + 0.6153846153846154?I) ], 1)]

Is there any way to make it give me integer or rational Re and Im for the eigenvectors?

Thank you!

edit retag flag offensive close merge delete

Comments

1

These numbers (with a final ?) are algebraic numbers. They are exact, but cannot be displayed entirely because they have an infinite decimal expansion. You can use parent(z) to understand what a number z lives in.

FrédéricC gravatar imageFrédéricC ( 2023-01-30 19:45:52 +0100 )edit
2

To compliment @FrédéricC's answer (who should turn his comment into an answer), you may try to retrieve (a) radical expression of (some) of these algebraic numbers with the .radical_expression method. For example :

sage: [u[1][0][1].radical_expression() for u in A.eigenvectors_right()]
[8/13*I + 1/13, -8/13*I + 1/13]

Of course, some algebraic numbers can be perfectly defined, printable to any desired precision, and have no radical ecpression ; for exemple, roots of polynomials of degree greater than 4 have, in general, no radical expression (Abel dixit, see Galois for explanations...).

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2023-01-30 20:15:31 +0100 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2023-01-30 20:00:15 +0100

achrzesz gravatar image
A=matrix(SR,2,2,[3, -13, 5,1]) 
eig=A.eigenvectors_right();
eig

[(-8*I + 2, [(1, 8/13*I + 1/13)], 1), (8*I + 2, [(1, -8/13*I + 1/13)], 1)]

(Replace QQ by SR)

edit flag offensive delete link more

Comments

1

...thus losing the advantages of working with the methods of the ring of olynomials over QQ(bar)... A square matrix larger than 4x4 will have in general polynomials of degree 5 or larger as characteristic polynomials, and therefore, have in general no symbolic expressions of their eigenvalues (or eigenvector components).

In such case, Sage's solvemay return a numerical approximation, which will not be exact in the sens of being of arbitrary precision. or nothing... Compare :

sage: (x^5+4*x^4-x^3+x^2-1).roots(ring=QQbar)
[(-4.284878055270617?, 1),
 (-0.5967098650359152?, 1),
 (0.6541113183679899?, 1),
 (0.1137383009692710? - 0.7648454192197090?*I, 1),
 (0.1137383009692710? + 0.7648454192197090?*I, 1)]
sage: (x^5+4*x^4-x^3+x^2-1).roots(ring=SR)
[]
Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2023-01-30 20:15:16 +0100 )edit

To illustrate the latter comment :

sage: bar = matrix([[0, 1, -1/2, -1/2, -2], [1, -1/2, 1, 1, -1], [-1, 0, 0, 0, 1], [-1, -1, 1/2, 1/2, -2], [1/2, 0, 2, 0, 2]]) ; bar
[   0    1 -1/2 -1/2   -2]
[   1 -1/2    1    1   -1]
[  -1    0    0    0    1]
[  -1   -1  1/2  1/2   -2]
[ 1/2    0    2    0    2]

sage: bar.eigenvalues()
[2.877056452812543?, -1.107420325241056? - 0.7067754188282322?*I, -1.107420325241056? + 0.7067754188282322?*I, 0.6688920988347839? - 1.031014956397786?*I, 0.6688920988347839? + 1.031014956397786?*I]

sage: solve(SR(bar.charpoly()), x)
[0 == 8*x^5 - 16*x^4 - 18*x^3 + 2*x^2 - 3*x - 60]

SR solver cannot find a solution, whereas polunomial methods can...

How I built bar is left as an exercise to the reader ;-)

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2023-01-30 20:48:57 +0100 )edit
1

Thank you all! SR is what I was looking for for my current purposes, but thank you for all the explanation of pro's and con's on calculation over different rings.

Tati gravatar imageTati ( 2023-01-30 21:55:29 +0100 )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: 2023-01-30 19:09:59 +0100

Seen: 177 times

Last updated: Jan 30 '23