# [Maxima] [newbie question] solving fifth order polynomial equation

Stavros Macrakis macrakis at alum.mit.edu
Wed Jan 17 10:07:42 CST 2007

```On 1/17/07, Hugo Coolens <coolens at kahosl.be> wrote:
> When solving the following equation
> solve(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0);
>
> Maxima shows two real solutions and three complex ones in stead of five
> real solutions.

Actually, Maxima is showing five real solutions -- it's just that the
*form* of some of the real solutions includes %i.  To simplify these
expressions to purely real expressions, use radcan:

[s = -1/3,s = -1,
s = -(sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3)
+cos((atan(9/(13*sqrt(3)))-%pi)/3)+2)
/3,
s = (sqrt(3)*sin((atan(9/(13*sqrt(3)))-%pi)/3)
-cos((atan(9/(13*sqrt(3)))-%pi)/3)-2)
/3,s = (2*cos((atan(9/(13*sqrt(3)))-%pi)/3)-2)/3]

If all you care about is the numeric values of the real solutions, you
can use realroots to get approximations to any desired precision, even
for non-factorizable polynomials:

realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0, 10^-30)

realroots(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5=0, 10^-30);
[s = -3366842668502188682920157364511
/2535301200456458802993406410752,s = -1,
s = -1036915250298305044736277999857
/2535301200456458802993406410752,
s = -845100400152152934331135470251
/2535301200456458802993406410752,
s = -666844482112423878330377457135
/2535301200456458802993406410752]
bfloat(%),fpprec:30;
[s = -1.327985277605681767796032025b0,s = -1.0b0,
s = -4.08990951493896474542054282001b-1,
s = -3.33333333333333333333333333333b-1,
s = -2.63023770900421757661913692994b-1]

That one was factorizable into polynomials of degree <= 4, so roots
can be given as radical expressions:

factor(1+11*s+45*s^2+84*s^3+70*s^4+21*s^5) =>
(s+1)*(3*s+1)*(7*s^3+14*s^2+7*s+1)

Example not factorizable over the rationals:
realroots(x^5+x+3) => [x = -38017089/33554432]

-s
```