Previous Up Next

2.24.16  Evaluate a polynomial : horner

horner takes two arguments : a polynomial P given by its symbolic expression or by the list of its coefficients and a number a.
horner returns P(a) computed using Hörner algorithm.
Input :

horner(x^2-2*x+1,2)

or :

horner([1,-2,1],2)

Output :

1

Previous Up Next