The Maxima on-line user's manual

Algebra Calculator

Horner

Function: horner (<expr>, <x>)

Function: horner (<expr>) Returns a rearranged representation of <expr> as in Horners rule, using <x> as the main variable if it is specified. `x` may be omitted in which case the main variable of the canonical rational expression form of <expr> is used.

`horner` sometimes improves stability if `expr` is to be numerically evaluated. It is also useful if Maxima is used to generate programs to be run in Fortran. See also `stringout`.

```          (%i1) expr: 1e-155*x^2 - 5.5*x + 5.2e155;
2
(%o1)            1.0E-155 x  - 5.5 x + 5.2E+155
(%i2) expr2: horner (%, x), keepfloat: true;
(%o2)            (1.0E-155 x - 5.5) x + 5.2E+155
(%i3) ev (expr, x=1e155);
Maxima encountered a Lisp error:```

floating point overflow

Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil.

`          (%i4) ev (expr2, x=1e155);`
`          (%o4)                       7.0E+154`

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

Related Examples

horner

a00:(x2-x1)*(x2-x1)+(...

a11:(x3-x4)*(x3-x4)+(...

a01:(x2-x1)*(x3-x4)+(...

Calculate

horner

a00:(x2-x1)*(x2-x1)+(...

a11:(x3-x4)*(x3-x4)+(...

a01:(x2-x1)*(x3-x4)+(...

Calculate

horner-jacobi_p

jacobi_p(0,1,1,x);

horner(jacobi_p(1,a,0...

horner(jacobi_p(2,a,0...

Calculate

horner-keepfloat-true

expr: -1 * x^3 + 15 *...

expr2: horner (%, x),...

Calculate

horner

eq1:horner((x^3 - x^2...

Calculate

horner-keepfloat-true

expr: 5 * x^2 - 3 * x...

expr2: horner (%, x),...

Calculate

horner-keepfloat-true

expr: 3.126005938e-7*...

expr2: horner (%, x)...

Calculate

horner-keepfloat-true

expr: 1e-155*x^2 - 5....

expr2: horner (%, x)...

Calculate

horner

eq1:horner((x^3 - 2 *...

Calculate

horner-taylor

f(x) := x^(1/12);

g(x) := taylor(f(x), ...

g(x);

Calculate