SciPy

scipy.interpolate.lagrange

scipy.interpolate.lagrange(x, w)[source]

Return a Lagrange interpolating polynomial.

Given two 1-D arrays x and w, returns the Lagrange interpolating polynomial through the points (x, w).

Warning: This implementation is numerically unstable. Do not expect to be able to use more than about 20 points even if they are chosen optimally.

Parameters:

x : array_like

x represents the x-coordinates of a set of datapoints.

w : array_like

w represents the y-coordinates of a set of datapoints, i.e. f(x).

Returns:

lagrange : numpy.poly1d instance

The Lagrange interpolating polynomial.