hornerform - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


numapprox

  

hornerform

  

convert a polynomial to Horner form

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

hornerform(r)

hornerform(r, x)

Parameters

r

-

procedure or expression representing a polynomial or rational function

x

-

(optional) variable name appearing in r, if r is an expression

Description

• 

This procedure converts a given polynomial r into Horner form, also known as nested multiplication form. This is a form which minimizes the number of arithmetic operations required to evaluate the polynomial.

• 

If r is a rational function (i.e. a quotient of polynomials) then the numerator and denominator are each converted into Horner form.

• 

If the second argument x is present then the first argument must be a polynomial (or rational expression) in the variable x. If the second argument is omitted then either r is an operator such that r⁡y yields a polynomial (or rational expression) in y, or else r is an expression with exactly one indeterminate (determined via indets).

• 

Note that for the purpose of evaluating a polynomial efficiently, the Horner form minimizes the number of arithmetic operations for a general polynomial. Specifically, the cost of evaluating a polynomial of degree n in Horner form is: n multiplications and n additions.

• 

The command with(numapprox,hornerform) allows the use of the abbreviated form of this command.

Examples

> 

with⁡numapprox:

> 

f≔t↦a⋅t4+b⋅t3+c⋅t2+d⋅t+e

f≔t↦a⋅t4+b⋅t3+c⋅t2+d⋅t+e

(1)
> 

hornerform⁡f

t↦e+d+c+a⋅t+b⋅t⋅t⋅t

(2)
> 

s≔taylor⁡exp⁡x,x

s≔1+x+12⁢x2+16⁢x3+124⁢x4+1120⁢x5+O⁡x6

(3)
> 

hornerform⁡s

1+1+12+16+124+x120⁢x⁢x⁢x⁢x

(4)
> 

r≔pade⁡exp⁡a⁢x,x,3,3

r≔a3⁢x3+12⁢a2⁢x2+60⁢a⁢x+120−a3⁢x3+12⁢a2⁢x2−60⁢a⁢x+120

(5)
> 

hornerform⁡r,x

120+60⁢a+a3⁢x+12⁢a2⁢x⁢x120+−60⁢a+−a3⁢x+12⁢a2⁢x⁢x

(6)

See Also

convert[horner]

numapprox[confracform]