First time here? Check out the FAQ!

Ask Your Question
1

Computing the root construction of a real algebraic number

asked 8 years ago

this post is marked as community wiki

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()[0]
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)[2]
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?

Preview: (hide)

Comments

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.

nbruin gravatar imagenbruin ( 8 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 8 years ago

B r u n o gravatar image

updated 8 years ago

You can use radical_expression:

sage: P = matrix([[1,1,0],[0,1,1],[1,0,0]])
sage: lamda = P.eigenvectors_right()[0][0]
sage: lamda
1.754877666246693?
sage: lamda.radical_expression()
(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)[0]
sage: mu
1.167303978261419?
sage: mu.radical_expression()
1.167303978261419?
Preview: (hide)
link

Comments

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

sage: a=QQbar(2^(1/5))
sage: (a+a^2).radical_expression()
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.

nbruin gravatar imagenbruin ( 8 years ago )

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.

B r u n o gravatar imageB r u n o ( 8 years ago )

The ValueError issue is now #21556

nbruin gravatar imagenbruin ( 8 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 8 years ago

Seen: 470 times

Last updated: Sep 20 '16