si horner a deux paramètres : un polynôme P donné
sous forme symbolique ou par la liste de ses coefficients et un nombre a.
horner renvoie P(a) calculé par la méthode de Hörner.
On tape :
^
2-2*x+1,2)ou :
On obtient :
On peut mettre un troisième argument optionnel pour indiquer la variable à remplacer, par exemple
^
2-2*x*y+1,2,y)
Si horner a trois paramètres : deux listes ak et xk et un
nom de variable par exemple x.
horner évalue un polynome d’interpolation en x à partir des
différences divisées ak et des xk (cf 6.28.33).
On tape :
On obtient :
On tape :
On obtient :
^
2+2*x^
3
On vérifie, en utilisant la commande lagrange.
Si P(x):=−6+31*x−12*x2+2*x3, on a
[P(1),P(2),P(3],P(4)]=[15,24,33,54]
On tape :
On obtient :
On tape :
On obtient les différences divisées de P :