Previous Up Next

5.29.19  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 Horner’s method.
Input:

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

or :

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

Output:

1

Previous Up Next