# Revision history [back]

I agree that there is some issue here, and it should somehow be translated into a bug report, though i am not sure of where is the error coming from. Anyway, thanks for reporting !

That said, if you want to work with polynomials, you whould work in a well defined polynomial ring, instead of a symbolic blob:

So first define the polynomial ring you want to work in:

sage: R.<x> = PolynomialRing(QQ)


This defines both the ring R and the undetermined x. Then you can define the polynomial P, and look for its roots in the rational field QQ (and check that no root is rational):

sage: P = x^10 - 10*x^8 + 35*x^6 + x^5 - 50*x^4 - 5*x^3 + 25*x^2 + 5*x - 1
sage: P.roots()
[]


Or in the field of algebraic numbers (to get all of them as algebraic numbers):

sage: P.roots(QQbar)
[(-1.984229402628956?, 1),
(-1.859552971776503?, 1),
(-1.274847979497380?, 1),
(-0.8515585831301453?, 1),
(-0.3747626291714493?, 1),
(0.1255810390586268?, 1),
(1.071653589957994?, 1),
(1.457937254842823?, 1),
(1.752613360087727?, 1),
(1.937166322257263?, 1)]


Or only real ones (as floating-point approximations):

sage: P.roots(RDF)
[(-1.984229402628939, 1),
(-1.85955297177652, 1),
(-1.274847979497381, 1),
(-0.8515585831301442, 1),
(-0.3747626291714496, 1),
(0.1255810390586268, 1),
(1.0716535899579935, 1),
(1.4579372548428182, 1),
(1.7526133600877463, 1),
(1.9371663222572437, 1)]


And you can check that all roots are actually real (w.r.t. complex):

sage: len(P.roots(QQbar)) == len(P.roots(RDF))
True


I agree that there is some issue here, and it should somehow be translated into a bug report, though i am not sure of where is the error coming from. Anyway, thanks for reporting !

That said, if you want to work with polynomials, you whould work in a well defined polynomial ring, instead of a symbolic blob:blob.

So first define the polynomial ring you want to work in:

sage: R.<x> = PolynomialRing(QQ)


This defines both the ring R and the undetermined x. Then you can define the polynomial P, and look for its roots in the rational field QQ (and check that no root is rational):

sage: P = x^10 - 10*x^8 + 35*x^6 + x^5 - 50*x^4 - 5*x^3 + 25*x^2 + 5*x - 1
sage: P.roots()
[]


Or in the field of algebraic numbers (to get all of them as algebraic numbers):

sage: P.roots(QQbar)
[(-1.984229402628956?, 1),
(-1.859552971776503?, 1),
(-1.274847979497380?, 1),
(-0.8515585831301453?, 1),
(-0.3747626291714493?, 1),
(0.1255810390586268?, 1),
(1.071653589957994?, 1),
(1.457937254842823?, 1),
(1.752613360087727?, 1),
(1.937166322257263?, 1)]


Or only You can see that all roots are simple (the second number 1 stands for the multiplicity). If you don't care about multiplicities, you can ge rid of them as follows:

sage: P.roots(QQbar, multiplicities=False)
[-1.984229402628956?,
-1.859552971776503?,
-1.274847979497380?,
-0.8515585831301453?,
-0.3747626291714493?,
0.1255810390586268?,
1.071653589957994?,
1.457937254842823?,
1.752613360087727?,
1.937166322257263?]


You can also ask for real ones (as roots as numerical floating-point approximations):approximations:

sage: P.roots(RDF)
[(-1.984229402628939, 1),
(-1.85955297177652, 1),
(-1.274847979497381, 1),
(-0.8515585831301442, 1),
(-0.3747626291714496, 1),
(0.1255810390586268, 1),
(1.0716535899579935, 1),
(1.4579372548428182, 1),
(1.7526133600877463, 1),
(1.9371663222572437, 1)]


And you can check that in this case all roots are actually real (w.r.t. complex):

sage: len(P.roots(QQbar)) == len(P.roots(RDF))
True