Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Horner Calculator

Horner

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

f(x) := x^(1/12);
k : 6;
n : 2*k;
g(x) := taylor(f(x), x, 1, n);
g(x);
bfloat(g(x));
p(x) := pade(g(x), n/2, n/2)[1];
horner(p(x));
l : 1-1/16;
r : 1+1/8;
plot2d([(f(x) - bfloat(g(x)))/f(x)], [x, l, r]);
plot2d([(f(x) - bfloat(p(x)))/f(x)], [x, l, r]);
plot2d([f(x), bfloat(g(x))], [x, l, r]);
plot2d([f(x)^12, bfloat(g(x))^12 ], [x, l, r]);

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) 

Horner Example

Related Examples

horner-keepfloat-true

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

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

Calculate

horner

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

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

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

Calculate

horner-keepfloat-true

expr: 5*x^4 -6*x +45;

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

Calculate

horner-keepfloat-true

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

expr2: horner (%, x+2...

Calculate

horner-keepfloat-true

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

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

Calculate

horner-keepfloat-true

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

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

Calculate

horner-keepfloat-true

expr: 5*x^4 -6*x^2 +4;

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

Calculate

horner

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

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

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

Calculate

horner-keepfloat-true

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

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

Calculate

horner-keepfloat-true

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

expr2: horner (%, x+2...

Calculate