Ask Your Question
1

Computing the root construction of a real algebraic number

asked 2016-09-19 14:52:52 +0100

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?

edit retag flag offensive close merge delete

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 ( 2016-09-19 16:57:25 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-09-20 17:39:08 +0100

B r u n o gravatar image

updated 2016-09-20 17:43:00 +0100

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?
edit flag offensive delete link more

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 ( 2016-09-20 20:32:17 +0100 )edit

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 ( 2016-09-21 10:57:39 +0100 )edit

The ValueError issue is now #21556

nbruin gravatar imagenbruin ( 2016-09-21 17:25:53 +0100 )edit

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: 2016-09-19 14:52:52 +0100

Seen: 459 times

Last updated: Sep 20 '16