ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 06 Apr 2017 21:23:47 +0200Solving a fifth degree polynomialhttps://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/I want to solve a fifth degree polynomial such as this:
x^5-5*x^4-10*x^3-10*x^2-5*x-1 == 0
I can't obtain any value, neither the exact value with radicals, nor approximation (with the solve command or the .roots(x) command).
How can I do ? ThxFri, 12 Aug 2016 19:44:34 +0200https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/Answer by nbruin for <p>I want to solve a fifth degree polynomial such as this:
x^5-5<em>x^4-10</em>x^3-10<em>x^2-5</em>x-1 == 0</p>
<p>I can't obtain any value, neither the exact value with radicals, nor approximation (with the solve command or the .roots(x) command).</p>
<p>How can I do ? Thx</p>
https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?answer=34454#post-id-34454Be specific on what kind of roots you want to find (rational ones? real ones? complex ones?)
sage: f=x^5-5*x^4-10*x^3-10*x^2-5*x-1
sage: f.roots(ring=RR)
[(6.72502395887258, 1)]
sage: f.roots(ring=CC)
[(6.72502395887258, 1),
(-0.461764344593279 - 0.161600091968187*I, 1),
(-0.461764344593279 + 0.161600091968187*I, 1),
(-0.400747634843009 - 0.678737070411573*I, 1),
(-0.400747634843009 + 0.678737070411573*I, 1)]
sage: f.roots(ring=QQbar)
[(6.725023958872576?, 1),
(-0.4617643445932788? - 0.1616000919681873?*I, 1),
(-0.4617643445932788? + 0.1616000919681873?*I, 1),
(-0.4007476348430091? - 0.6787370704115728?*I, 1),
(-0.4007476348430091? + 0.6787370704115728?*I, 1)]
Fri, 12 Aug 2016 21:36:55 +0200https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?answer=34454#post-id-34454Comment by Romuald_314 for <p>Be specific on what kind of roots you want to find (rational ones? real ones? complex ones?)</p>
<pre><code>sage: f=x^5-5*x^4-10*x^3-10*x^2-5*x-1
sage: f.roots(ring=RR)
[(6.72502395887258, 1)]
sage: f.roots(ring=CC)
[(6.72502395887258, 1),
(-0.461764344593279 - 0.161600091968187*I, 1),
(-0.461764344593279 + 0.161600091968187*I, 1),
(-0.400747634843009 - 0.678737070411573*I, 1),
(-0.400747634843009 + 0.678737070411573*I, 1)]
sage: f.roots(ring=QQbar)
[(6.725023958872576?, 1),
(-0.4617643445932788? - 0.1616000919681873?*I, 1),
(-0.4617643445932788? + 0.1616000919681873?*I, 1),
(-0.4007476348430091? - 0.6787370704115728?*I, 1),
(-0.4007476348430091? + 0.6787370704115728?*I, 1)]
</code></pre>
https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?comment=34512#post-id-34512All ones. Can I obtain the ones with the exact value (nth roots) instaid of approximations ?
Thanks for your answer, it already helps me.Thu, 18 Aug 2016 12:02:48 +0200https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?comment=34512#post-id-34512Comment by nbruin for <p>Be specific on what kind of roots you want to find (rational ones? real ones? complex ones?)</p>
<pre><code>sage: f=x^5-5*x^4-10*x^3-10*x^2-5*x-1
sage: f.roots(ring=RR)
[(6.72502395887258, 1)]
sage: f.roots(ring=CC)
[(6.72502395887258, 1),
(-0.461764344593279 - 0.161600091968187*I, 1),
(-0.461764344593279 + 0.161600091968187*I, 1),
(-0.400747634843009 - 0.678737070411573*I, 1),
(-0.400747634843009 + 0.678737070411573*I, 1)]
sage: f.roots(ring=QQbar)
[(6.725023958872576?, 1),
(-0.4617643445932788? - 0.1616000919681873?*I, 1),
(-0.4617643445932788? + 0.1616000919681873?*I, 1),
(-0.4007476348430091? - 0.6787370704115728?*I, 1),
(-0.4007476348430091? + 0.6787370704115728?*I, 1)]
</code></pre>
https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?comment=34536#post-id-34536Well, if you use ring=QQbar you get objects that are essentially carrying enough information to consider them "exact". However, for roots of fifth degree polynomials, there is likely no better "exact" description of them than "these are roots of this fifth degree polynomial". You can easily get arbitrarily good complex approximations out of elements of QQbar, though.Sat, 20 Aug 2016 06:28:25 +0200https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?comment=34536#post-id-34536Comment by Romuald_314 for <p>Be specific on what kind of roots you want to find (rational ones? real ones? complex ones?)</p>
<pre><code>sage: f=x^5-5*x^4-10*x^3-10*x^2-5*x-1
sage: f.roots(ring=RR)
[(6.72502395887258, 1)]
sage: f.roots(ring=CC)
[(6.72502395887258, 1),
(-0.461764344593279 - 0.161600091968187*I, 1),
(-0.461764344593279 + 0.161600091968187*I, 1),
(-0.400747634843009 - 0.678737070411573*I, 1),
(-0.400747634843009 + 0.678737070411573*I, 1)]
sage: f.roots(ring=QQbar)
[(6.725023958872576?, 1),
(-0.4617643445932788? - 0.1616000919681873?*I, 1),
(-0.4617643445932788? + 0.1616000919681873?*I, 1),
(-0.4007476348430091? - 0.6787370704115728?*I, 1),
(-0.4007476348430091? + 0.6787370704115728?*I, 1)]
</code></pre>
https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?comment=34579#post-id-34579Ok, because I didn't give this example at random, actually it has only one real root explainable with roots (I had read it in a document on polynomials on the web but I can't find it back, I wish I could show you). This is that root I wanted to find...Thu, 25 Aug 2016 09:45:53 +0200https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?comment=34579#post-id-34579Answer by dan_fulea for <p>I want to solve a fifth degree polynomial such as this:
x^5-5<em>x^4-10</em>x^3-10<em>x^2-5</em>x-1 == 0</p>
<p>I can't obtain any value, neither the exact value with radicals, nor approximation (with the solve command or the .roots(x) command).</p>
<p>How can I do ? Thx</p>
https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?answer=37200#post-id-37200We just see that the given polynomial is $2x^5-(x+1)^5$ and we are done.
If the computer is still needed, than the following lines investigate the factorization and the roots in sage:
sage: K.<z> = CyclotomicField( 5 )
sage: RK.<X> = K[]
sage: F.<a> = K.extension( X^5-2 )
sage: RF.<x> = F[]
sage: P = x^5 - 5*x^4 - 10*x^3 -10*x^2 - 5*x - 1
sage: for f in P.factor(): print f
(x + (z^3 + z^2 + z + 1)*a^4 - z^3*a^3 - z^2*a^2 - z*a - 1, 1)
(x - z^2*a^4 + (z^3 + z^2 + z + 1)*a^3 - z*a^2 - z^3*a - 1, 1)
(x - z*a^4 - z^2*a^3 - z^3*a^2 + (z^3 + z^2 + z + 1)*a - 1, 1)
(x - z^3*a^4 - z*a^3 + (z^3 + z^2 + z + 1)*a^2 - z^2*a - 1, 1)
(x - a^4 - a^3 - a^2 - a - 1, 1)
sage: P.roots( multiplicities=False)
[(-z^3 - z^2 - z - 1)*a^4 + z^3*a^3 + z^2*a^2 + z*a + 1,
z^2*a^4 + (-z^3 - z^2 - z - 1)*a^3 + z*a^2 + z^3*a + 1,
z*a^4 + z^2*a^3 + z^3*a^2 + (-z^3 - z^2 - z - 1)*a + 1,
z^3*a^4 + z*a^3 + (-z^3 - z^2 - z - 1)*a^2 + z^2*a + 1,
a^4 + a^3 + a^2 + a + 1]
In the above, $z$ is $\zeta=\zeta_5$, a primitive root of order $5$ of one. And $a$ is $2^{1/5}$.
The five roots are found manually by starting with the equation $2x^5=(x+1)^5$, dividing by $x^5$, so we get equivalently $\left(1+\frac 1x\right)^5=2$. So $\left(1+\frac 1x\right)^5=a\zeta^k$ for $k$ among $0,1,2,3,4$. This gives immediately:
$$ x = -\frac 1{1-a\zeta^k}
= \frac {1-(a\zeta^k)^5}{1-a\zeta^k}
= 1
+a\zeta^k
+a^2\zeta^{2k}
+a^3\zeta^{3k}
+a^4\zeta^{4k}\ .
$$
One of the roots is thus $1+a+a^2+a^3+a^4$. For $k=0$.
The others are obtained from it by replacing $a$ with a (conjugate) root of $X^5-2$.
Note:
If the coin is not immediately falling while typing the polynomial, then asking
sage: R.<x> = QQ[]
sage: P = x^5 - 5*x^4 - 10*x^3 -10*x^2 - 5*x - 1
sage: P.galois_group()
may help. I've got an error mess...
verbose 0 (2072: permgroup_named.py, cardinality) Warning: TransitiveGroups requires the GAP database package. Please install it with ``sage -i database_gap``.
But instead of making it work, the following was enough for me:
dan ~$ gp
Reading GPRC: /etc/gprc ...Done.
PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.
? P = 2*x^5 - (x+1)^5
%1 = x^5 - 5*x^4 - 10*x^3 - 10*x^2 - 5*x - 1
? polgalois( P )
%2 = [20, -1, 1, "F(5) = 5:4"]
? ?polgalois
polgalois(T): Galois group of the polynomial T (see manual for group coding).
Return [n, s, k, name] where n is the group order, s the signature, k the index
and name is the GAP4 name of the transitive group.
The order is making the group solvable already.Thu, 06 Apr 2017 21:23:47 +0200https://ask.sagemath.org/question/34448/solving-a-fifth-degree-polynomial/?answer=37200#post-id-37200