Learn R Programming

clifford (version 1.0-8)

horner: Horner's method

Description

Horner's method for Clifford objects

Usage

horner(P,v)

Arguments

P

Multivariate polynomial

v

Numeric vector of coefficients

Author

Robin K. S. Hankin

Details

Given a 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. The output of horner() depends on the signature().

Examples

Run this code

horner(1+e(1:3)+e(2:3) , 1:6)

rcliff() |> horner(1:4)

Run the code above in your browser using DataLab