# Revision history [back]

If you type A.eigenvalues? you will get the document of this method that says " If the eigenvalues are roots of polynomials in QQ, then QQbar elements are returned that represent each separate root." which means that you will get the eigenvalues as algebraic numbers.

sage: [r.parent() for r in A.eigenvalues()]
[Algebraic Field, Algebraic Field, Algebraic Field]


Now, when you write H=A.charpoly() you define a polynomial over the integers:

sage: H=A.charpoly()
sage: H.parent()
Univariate Polynomial Ring in x over Integer Ring


In particular, the roots will be provided in this ring, and there is no integer root for this polynomial. If you want the algebraic roots, you can write:

sage: H.roots(ring=QQbar)
[(-2.439311671683875?, 1), (-0.6611203141265045?, 1), (3.100431985810380?, 1)]


You can check that the two lists are equal :

sage: H.roots(ring=QQbar, multiplicities=False) == A.eigenvalues()
True


If you type A.eigenvalues? you will get the document documentation of this method that says " If the eigenvalues are roots of polynomials in QQ, then QQbar elements are returned that represent each separate root." which means that you will get the eigenvalues as algebraic numbers.

sage: [r.parent() for r in A.eigenvalues()]
[Algebraic Field, Algebraic Field, Algebraic Field]


Now, when you write H=A.charpoly() you define a polynomial over the integers:

sage: H=A.charpoly()
sage: H.parent()
Univariate Polynomial Ring in x over Integer Ring


In particular, the roots will be provided in this ring, and there is no integer root for this polynomial. If you want the algebraic roots, you can write:

sage: H.roots(ring=QQbar)
[(-2.439311671683875?, 1), (-0.6611203141265045?, 1), (3.100431985810380?, 1)]


You can check that the two lists are equal :

sage: H.roots(ring=QQbar, multiplicities=False) == A.eigenvalues()
True


If you type A.eigenvalues? you will get the documentation of this method that says " If the eigenvalues are roots of polynomials in QQ, then QQbar elements are returned that represent each separate root." which means that you will get the eigenvalues as algebraic numbers.

sage: [r.parent() for r in A.eigenvalues()]
[Algebraic Field, Algebraic Field, Algebraic Field]


Now, when you write H=A.charpoly() you define a polynomial over the integers:

sage: H=A.charpoly()
sage: H.parent()
Univariate Polynomial Ring in x over Integer Ring


In particular, the roots will be provided in this ring, and there is no integer root for this polynomial. If you want the algebraic roots, you can write:

sage: H.roots(ring=QQbar)
[(-2.439311671683875?, 1), (-0.6611203141265045?, 1), (3.100431985810380?, 1)]


You can check that the two lists are equal :

sage: H.roots(ring=QQbar, multiplicities=False) == A.eigenvalues()
True


As for your last polynomial, you define it over the symbolic, which explains why you get the roots as symbolic expressions.