Previous Up Next

5.29.11  Evaluation of a polynomial: peval polyEval

peval or polyEval takes as argument a polynomial p given by the list of its coefficients and a real a .
peval or polyEval returns the exact or numeric value of p(a) using Horner’s method.
Input:

peval([1,0,-1],sqrt(2))

Output:

sqrt(2)*sqrt(2)-1

Then:

normal(sqrt(2)*sqrt(2)-1)

Output:

1

Input:

peval([1,0,-1],1.4)

Output:

0.96

Previous Up Next