# Computing the root construction of a real algebraic number

asked 2016-09-19 07:52:52 -0500 This post is a wiki. Anyone with karma >750 is welcome to improve it.

Starting from some real algebraic number

sage: P
[1 1 0]
[0 1 1]
[1 0 0]
sage: lamda, (v,), m = P.eigenvectors_right()
sage: lamda
1.754877666246693?


Other than starting from skratch calling solve on a symbolic version of the minimal polynomial:

sage: lamda.minpoly()
x^3 - 2*x^2 + x - 1
sage: x = var('x')
sage: p = x^3 - 2*x^2 + x - 1
sage: solve(p, x)
x == (1/18*sqrt(23)*sqrt(3) + 25/54)^(1/3) + 1/9/(1/18*sqrt(23)*sqrt(3) + 25/54)^(1/3) + 2/3


is there a method in Sage to get the expression of lamda as roots (if it exists) directly form lamda?

edit retag close merge delete

The "lambda" that you get originally is explicit for basically all computational and numerical questions. You may also know that generally the roots of a polynomial cannot be expressed in roots. So I expect that "solve" (which uses maxima) is the only place in Sage that exposes Cardano's formulas.

Sort by » oldest newest most voted

You can use radical_expression:

sage: P = matrix([[1,1,0],[0,1,1],[1,0,0]])
sage: lamda = P.eigenvectors_right()
sage: lamda
1.754877666246693?
(1/18*sqrt(23)*sqrt(3) + 25/54)^(1/3) + 1/9/(1/18*sqrt(23)*sqrt(3) + 25/54)^(1/3) + 2/3
sage: type(_)
<type 'sage.symbolic.expression.Expression'>


By the way, the behavior if the algebraic number has no radical expression :

sage: x = ZZ['x'].gen()
sage: mu = (x^5 - x - 1).roots(QQbar, multiplicities=False)
sage: mu
1.167303978261419?
1.167303978261419?

more

Nice! Unfortunately, it doesn't work quite reliably:

sage: a=QQbar(2^(1/5))
2.468206265769930?


So you shouldn't take failure as proof that no radical expression exists. Also, the routine should really raise "ValueError: Cannot determine radical expression for number" instead of returning the original element.

I agree with you on both points: For the first one, it seems that from the beginning the choice of design is the one used currently. I urge you to open a ticket and/or a discussion on sage-devel (to see whether a consensus holds). For the second one, see ticket #17516.