for xj in xs ]
return coeffs
+
def divided_difference(xs, ys):
"""
Return the Newton divided difference of the points (xs[k],
for k in range(0, len(xs)) ])
return (s1 + s2)
+
+
+def lagrange_psi(x, xs):
+ """
+ The function,
+
+ Psi(x) = (x - xs[0])*(x - xs[1])* ... *(x - xs[-1])
+
+ used in Lagrange and Hermite interpolation.
+
+ INPUT:
+
+ - ``x`` -- The independent variable of the resulting expression.
+
+ - ``xs`` -- A list of points.
+
+ OUTPUT:
+
+ A symbolic expression in one variable, `x`.
+ """
+
+ return product([ (x - xj) for xj in xs ])