horner: Horner's method

hornerR Documentation

Horner's method

Description

Horner's method

Usage

horner(W,v)

Arguments

W

Weyl object

v

Numeric vector of coefficients

Details

Given a formal polynomial

p(x) = a_0 +a_1+a_2x^2+\cdots + a_nx^n

it is possible to express p(x) in the algebraically equivalent form

p(x) = a_0 + x\left(a_1+x\left(a_2+\cdots + x\left(a_{n-1} +xa_n \right)\cdots\right)\right)

which is much more efficient for evaluation, as it requires only n multiplications and n additions, and this is optimal.

Author(s)

Robin K. S. Hankin

See Also

ooom

Examples

horner(x,1:5)
horner(x+d,1:3)

2+x+d |> horner(1:3) |> horner(1:2)


RobinHankin/weyl documentation built on April 14, 2025, 11:49 a.m.