This function is (almost) the same as mvp::horner().
Given a polynomial
p(x) = a_0 +a_1+a_2x^2+ + a_nx^nomitted; see latex
it is possible to express \(p(x)\) in the algebraically equivalent
form
p(x) = a_0 + x(a_1+x(a_2+ + x(a_n-1 +xa_n
)))omitted; see PDF
which is much more efficient for evaluation, as it requires only \(n\)
multiplications and \(n\) additions, and this is optimal. Function
horner() will take a freealg object for its first
argument.