### The Maxima on-line user's manual

Algebra Calculator

#### Allroots

Function: allroots (<expr>)

Function: allroots (<eqn>) Computes numerical approximations of the real and complex roots of the polynomial <expr> or polynomial equation <eqn> of one variable.

The flag `polyfactor` when `true` causes `allroots` to factor the polynomial over the real numbers if the polynomial is real, or over the complex numbers, if the polynomial is complex.

`allroots` may give inaccurate results in case of multiple roots.

`     If the polynomial is real, `allroots (%i*<p>)`) may yield more`
`     accurate approximations than `allroots (<p>)`, as `allroots``
`     invokes a different algorithm in that case.`

`allroots` rejects non-polynomials. It requires that the numerator after `rat`ing should be a polynomial, and it requires that the denominator be at most a complex number. As a result of this `allroots` will always return an equivalent (but factored) expression, if `polyfactor` is `true`.

For complex polynomials an algorithm by Jenkins and Traub is used (Algorithm 419, Comm. ACM, vol. 15, (1972), p. 97). For real polynomials the algorithm used is due to Jenkins (Algorithm 493, ACM TOMS, vol. 1, (1975), p.178).

Examples:

```          (%i1) eqn: (1 + 2*x)^3 = 13.5*(1 + x^5);
3          5
(%o1)              (2 x + 1)  = 13.5 (x  + 1)
(%i2) soln: allroots (eqn);
(%o2) [x = .8296749902129361, x = - 1.015755543828121,```

x = .9659625152196369 %i - .4069597231924075,

```          x = - .9659625152196369 %i - .4069597231924075, x = 1.0]
(%i3) for e in soln
do (e2: subst (e, eqn), disp (expand (lhs(e2) - rhs(e2))));
- 3.5527136788005E-15```

- 5.32907051820075E-15

4.44089209850063E-15 %i - 4.88498130835069E-15

- 4.44089209850063E-15 %i - 4.88498130835069E-15

3.5527136788005E-15

```          (%o3)                         done
(%i4) polyfactor: true\$
(%i5) allroots (eqn);
(%o5) - 13.5 (x - 1.0) (x - .8296749902129361)```

2 (x + 1.015755543828121) (x + .8139194463848151 x

+ 1.098699797110288)

There are also some inexact matches for `allroots`. Try `?? allroots` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### allroots

f : 3*x^2+3*x-1=0;

allroots(f);

Calculate

##### allroots-ev-expand-factor-find_root-numer-ratsimp-solve

f:5*x^2-3*x-2;

solve(f,x);

find_root(f,x,0,1);

Calculate

##### allroots-numer-plot2d-realroots-solve-true

p(x):=-100+20*x+25*x^...

solve(p(x));

numer:true;

Calculate

##### allroots

allroots(0.001035*x^2...

Calculate

##### allroots-create_list-diff-ev-exp-log-numer-ratsimp

" p(x) is the polynom...

p(x):=x*(x-1)*(x-2);

f(x):=p(x)*exp(-x*log...

Calculate

##### allroots-expand-integrate

equ:expand((x-1)*(x-3...

aa:integrate(equ,x);

allroots(aa);

Calculate

##### allroots

allroots(6*x^2+12*x+10);

Calculate

##### allroots-at-charpoly-float-lambda-matrix-solve

mat: matrix([F1*gamma...

cp: charpoly(mat,%lam...

sol: substitute([F1=8...

Calculate

##### allroots-realroots-rhs-solve

f:y=-x^5/1800-7*x^4/1...

realroots(rhs(f));

allroots(rhs(f));

Calculate

##### allroots-expand

L2(x):=(x-0.6)*(x-0.8...

L3(x):=(x-0.4)*(x-0.8...

L4(x):=(x-0.4)*(x-0.6...

Calculate