Lagrange Interpolator Polynomial

Find the polynomial (defined by its coefficients) passing through a set of points.

Lagrange Interpolation Polynomial

Lagrange Interpolation Polynomial

If you have a set of N points on a cartesian plane, there will always exist an N-1th order polynomial of the form y = a_0
+ a_1.x + a_2.x^2 + ... a_n-1.x^(n-1) which passes through all the points. Lagrange came up with a neat approach to finding
this polynomial, which is to construct a set of `basis' polynomials which are zero at all the specified points except for
one, then scale and add them to match all the control points. LAGRANGEPOLY returns this polynomial, defined by the polynomial
coefficients (a_0 .. a_n-1 above), arranged in the same vector form used by Matlab builtins such as POLYVAL.

LAGRANGEPOLY optionally returns the x and y co-ordinates of all the extrema and points of inflection of the polynomial too,
since these are easily found from the polynomial form.

Lagrange interpolation has generally been replaced by spline fitting these days; see the SPLINE function.