Use Horner's rule to evaluate a polynomial
horner(x, coefs)
rhorner(x, coefs)
naivepoly(x, coefs)
betterpoly(x, coefs)
x | a vector of x values to evaluate the polynomial |
---|---|
coefs | vector of coefficients of x |
the value of the function at x
This function implements Horner's rule for fast polynomial
evaluation. The implementation expects x
to be a vector of x
values at which to evaluate the polynomial. The parameter coefs
is a vector of coefficients of x. The vector order is such
that the first element is the constant term, the second element is
the coefficient of x, the so forth to the highest degreed
term. Terms with a 0 coefficient should have a 0 element in the
vector.
The function rhorner
implements the the Horner algorithm
recursively.
The function naivepoly
implements a polynomial evaluator using
the straightforward algebraic approach.
The function betterpoly
implements a polynomial evaluator using
the straightforward algebraic approach with cached x terms.
Other algebra:
bilinear()
,
cubicspline()
,
division
,
fibonacci()
,
isPrime()
,
linterp()
,
nthroot()
,
polyinterp()
,
pwiselinterp()
,
quadratic()