Ask Your Question

Revision history [back]

Here are some hints:

sage: f = factor(ap)
sage: f
(x - 2.000000000000000?) * (x - 0.1476377979322930?) * (x + 3.965523492229398?) * (x^2 - 0.8178856942971048?*x + 1.708055247868697?)

sage: list(f)
[(x - 2.000000000000000?, 1),
 (x - 0.1476377979322930?, 1),
 (x + 3.965523492229398?, 1),
 (x^2 - 0.8178856942971048?*x + 1.708055247868697?, 1)]

sage: c = list(f)[1][0].coefficients()[0]
sage: c
-0.1476377979322930?

sage: c.radical_expression()
1/12*sqrt((36*(2/9*sqrt(7214)*sqrt(3) + 649/27)^(2/3) + 129*(2/9*sqrt(7214)*sqrt(3) + 649/27)^(1/3) - 284)/(2/9*sqrt(7214)*sqrt(3) + 649/27)^(1/3)) - 1/2*sqrt(-(2/9*sqrt(7214)*sqrt(3) + 649/27)^(1/3) + 71/9/(2/9*sqrt(7214)*sqrt(3) + 649/27)^(1/3) + 321/2/sqrt((36*(2/9*sqrt(7214)*sqrt(3) + 649/27)^(2/3) + 129*(2/9*sqrt(7214)*sqrt(3) + 649/27)^(1/3) - 284)/(2/9*sqrt(7214)*sqrt(3) + 649/27)^(1/3)) + 43/6) + 3/4

sage: c.radical_expression().parent()
Symbolic Ring

Then you should be able to loop over the factorization and the coefficients (do not forget multiplicities!) and reconstruct the symbolic polynomial

Note however, that some algebraic numbers can not be expressed by radicals (and note that even if it does, sometimes Sage is not able to do it...):

sage: d = list(f)[3][0].coefficients()[0]
sage: d
1.708055247868697?
sage: d.radical_expression()
1.708055247868697?
sage: d.degree()
6