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

Algebra Calculator

#### Realroots

Function: realroots (<expr>, <bound>)

Function: realroots (<eqn>, <bound>)

Function: realroots (<expr>)

Function: realroots (<eqn>) Computes rational approximations of the real roots of the polynomial <expr> or polynomial equation <eqn> of one variable, to within a tolerance of <bound>. Coefficients of <expr> or <eqn> must be literal numbers; symbol constants such as `%pi` are rejected.

`realroots` assigns the multiplicities of the roots it finds to the global variable `multiplicities`.

`realroots` constructs a Sturm sequence to bracket each root, and then applies bisection to refine the approximations. All coefficients are converted to rational equivalents before searching for roots, and computations are carried out by exact rational arithmetic. Even if some coefficients are floating-point numbers, the results are rational (unless coerced to floats by the `float` or `numer` flags).

When <bound> is less than 1, all integer roots are found exactly. When <bound> is unspecified, it is assumed equal to the global variable `rootsepsilon`.

When the global variable `programmode` is `true`, `realroots` returns a list of the form `[x = <x_1>, x = <x_2>, ...]`. When `programmode` is `false`, `realroots` creates intermediate expression labels `%t1`, `%t2`, ..., assigns the results to them, and returns the list of labels.

Examples:

```          (%i1) realroots (-1 - x + x^5, 5e-6);
612003
(%o1)                     [x = ------]
524288
(%i2) ev (%[1], float);
(%o2)                 x = 1.167303085327148
(%i3) ev (-1 - x + x^5, %);
(%o3)                - 7.396496210176905E-6```

```          (%i1) realroots (expand ((1 - x)^5 * (2 - x)^3 * (3 - x)), 1e-20);
(%o1)                 [x = 1, x = 2, x = 3]
(%i2) multiplicities;
(%o2)                       [5, 3, 1]```

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

### Related Examples

##### realroots

realroots(10=10*log10...

2 +2;

log(2.0);

Calculate

##### realroots

realroots(0.18*t^3+0....

Calculate

##### realroots

n(x):=-0.02*x + 10;

a(x):= 2*x+2;

g:a(x)=n(x);

Calculate

##### realroots

pol1:x^2+x+6;

realroots(x^2+x+6);

Calculate

##### realroots

realroots(-0.03778524...

Calculate

##### realroots

AB:3;

BC:4;

g:AC^2=AB^2+BC^2;

Calculate

##### realroots-true

%e_to_numlog=true;

realroots(3=10*log10(...

Calculate

pol1:x^2+x-6;

realroots(pol1);

Calculate

##### realroots

realroots(x^2+2*x-3)[1];

Calculate

##### realroots

AB:3;

BC:4;

g:AC^2=AB^2+BC^2;

Calculate