# Getting exact answers when using eigenvectors_right()

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 close merge delete

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.

( 2023-01-30 19:45:52 +0200 )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...).

( 2023-01-30 20:15:31 +0200 )edit

Sort by » oldest newest most voted
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)

more

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)
[]

( 2023-01-30 20:15:16 +0200 )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,

( 2023-01-30 20:48:57 +0200 )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.

( 2023-01-30 21:55:29 +0200 )edit