Ask Your Question

Revision history [back]

Note that you can also work over the field QQbar of algebraic numbers.

Here is how you would factor your polynomial there and find its roots.

sage: P.<x> = QQbar[]
sage: p = x^2 - 30*x + 2817
sage: p.factor()
(x - 15.00000000000000? - 50.91168824543143?*I) * (x - 15.00000000000000? + 50.91168824543143?*I)
sage: p.roots()
[(15.00000000000000? - 50.91168824543143?*I, 1),
 (15.00000000000000? + 50.91168824543143?*I, 1)]

If you want a radical expression for the roots:

sage: for r in p.roots():
....:     print(r[0].radical_expression())
....:     
-36*I*sqrt(2) + 15
36*I*sqrt(2) + 15