Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solving an equation of third degree works, since we have an exact formula. When asking for the roots of a polynomial of degree $>4$ there is no guarantee for the existence of "nice" roots. Sage generally wants to perform exact mathematics, so it delivers exact answers, as far as it can do it. In the above case...

sage: solve(1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1==0, x)
[0 == 1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1]

sage prefers to return an echo. Why? Since it cannot do better (in an exact manner). Well, W-Alpha is also not delivering exact results. It just gives some approximations. It is of course easy to get the approximations in sage, but we have to actively ask for numeric output. For instance:

sage: var('x');
sage: solve(1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1==0, x, to_poly_solve=True)
[x == -2.830429732868757,
 x == -0.7979018821351435,
 x == (-1.70710339378983e-07),
 x == (0.07496593632772452 - 1.149961450358518*I),
 x == (0.07496593632772452 + 1.149961450358518*I)]

Some more options are available when asking explicitly for the roots of an algebraic expression, of a polynomial:

sage: R.<x> = PolynomialRing(QQ)
sage: f = 1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1
sage: f.roots(ring=QQbar, multiplicities=False)
[-2.830429808252441?,
 -0.7979018936926834?,
 -1.707103246241551?e-7,
 0.0749659363277245? - 1.149961450358519?*I,
 0.0749659363277245? + 1.149961450358519?*I]

The above values are exact. Working with them means working with explicit exact elements in a number field. Each value is determined by an approximation and a minimal polynomial with (exact) integral coefficients.

Well, if numerical values are wanted...

sage: f.roots(ring=CC, multiplicities=False)
[-2.83042980825244,
 -0.797901893692683,
 -1.70710324624155e-7,
 0.0749659363277245 - 1.14996145035852*I,
 0.0749659363277245 + 1.14996145035852*I]

We can of course get more decimals...

sage: myC = ComplexField(200)
sage: f.roots(ring=myC, multiplicities=False)
[-2.8304298082524409357816792805082283665446973943656659043473,
 -0.79790189369268339504134957237465853264581932023615973080958,
 -1.7071032462415503949697879975157140476095973540086477715140e-7,
 0.074965936327724477489034174930843325380960737780780518010806 - 1.1499614503585182832508403555910655399898690410165816928866*I,
 0.074965936327724477489034174930843325380960737780780518010806 + 1.1499614503585182832508403555910655399898690410165816928866*I]

Note that sage comes also with a(n easy) way of seeing if the roots can be given by radicals. We ask for the Galois group of the involved polynomial. Is it solvable?

sage: R.<x> = PolynomialRing(QQ)
sage: f = 1953125*x^5 + 6793750*x^4 + 5942255*x^3 + 8749866*x^2 + 5857878*x + 1
sage: G = f.galois_group()
sage: G
Transitive group number 5 of degree 5
sage: G.structure_description()
'S5'
sage: G.order()
120
sage: G.is_solvable()
False

No, not solvable, so there is no chance to get the solutions by radicals.


Observation: Even in the case when we can obtain solutions written by radicals, e.g. for

sage: var('x');
sage: solve(x^5 -10*x^3 + 5*x^2 + 10*x +1 == 0, x)
[0 == x^5 - 10*x^3 + 5*x^2 + 10*x + 1]

sage: R.<x> = PolynomialRing(QQ)
sage: f = x^5 -10*x^3 + 5*x^2 + 10*x +1
sage: G = f.galois_group()
sage: G.is_solvable()
True

we cannot expect that sage "knows what we want", and gives us a way to digest the roots by using radicals.