Ask Your Question

Revision history [back]

Using the method radical_expression for algebraic real field element, you can sometimes obtain a result. Its doc says Attempt to obtain a symbolic expression using radicals. If no exact symbolic expression can be found, the algebraic number will be returned without modification:

sage: AA
Algebraic Real Field
sage: AA(cos(2*pi/5)).radical_expression()
1/4*sqrt(5) - 1/4
sage: AA(cos(2*pi/7)).radical_expression()
(7/144*I*sqrt(3) + 7/432)^(1/3) + 7/36/(7/144*I*sqrt(3) + 7/432)^(1/3) - 1/6

But it does not work for n=17 and n=257:

sage: AA(cos(2*pi/17)).radical_expression()
0.9324722294043558?
sage: AA(cos(2*pi/257)).radical_expression()
0.9997011578430937?