Given a data set of coordinate pairs with the are called nodes and the are called values. The Lagrange polynomial has degree and assumes each value at the corresponding node,
For equispaced nodes, Lagrange interpolation is susceptible to Runge's phenomenon of large oscillation.
Definition
edit
Given a set of nodes , which must all be distinct, for indices , the Lagrange basis for polynomials of degree for those nodes is the set of polynomials each of degree which take values if and . Using the Kronecker delta this can be written Each basis polynomial can be explicitly described by the product:
Notice that the numerator has roots at the nodes while the denominator scales the resulting polynomial so that
The Lagrange interpolating polynomial for those nodes through the corresponding values is the linear combination:
Each basis polynomial has degree , so the sum has degree , and it interpolates the data because
The interpolating polynomial is unique. Proof: assume the polynomial of degree interpolates the data. Then the difference is zero at distinct nodes But the only polynomial of degree with more than roots is the constant zero function, so or
Barycentric form
edit
Each Lagrange basis polynomial can be rewritten as the product of three parts, a function common to every basis polynomial, a node-specific constant (called the barycentric weight), and a part representing the displacement from to :[4]
By factoring out from the sum, we can write the Lagrange polynomial in the so-called first barycentric form:
If the weights have been pre-computed, this requires only operations compared to for evaluating each Lagrange basis polynomial individually.
The barycentric interpolation formula can also easily be updated to incorporate a new node by dividing each of the , by and constructing the new as above.
For any because the constant function is the unique polynomial of degree interpolating the data We can thus further simplify the barycentric formula by dividing
This is called the second form or true form of the barycentric interpolation formula.
This second form has advantages in computation cost and accuracy: it avoids evaluation of ; the work to compute each term in the denominator has already been done in computing and so computing the sum in the denominator costs only addition operations; for evaluation points which are close to one of the nodes , catastrophic cancelation would ordinarily be a problem for the value , however this quantity appears in both numerator and denominator and the two cancel leaving good relative accuracy in the final result.
Using this formula to evaluate at one of the nodes will result in the indeterminate; computer implementations must replace such results by
Each Lagrange basis polynomial can also be written in barycentric form:
A perspective from linear algebra
edit
Solving an interpolation problem leads to a problem in linear algebra amounting to inversion of a matrix. Using a standard monomial basis for our interpolation polynomial , we must invert the Vandermonde matrix to solve for the coefficients of . By choosing a better basis, the Lagrange basis, , we merely get the identity matrix, , which is its own inverse: the Lagrange basis automatically inverts the analog of the Vandermonde matrix.
This construction is analogous to the Chinese remainder theorem. Instead of checking for remainders of integers modulo prime numbers, we are checking for remainders of polynomials when divided by linears.
Furthermore, when the order is large, Fast Fourier transformation can be used to solve for the coefficients of the interpolated polynomial.
Example
edit
We wish to interpolate over the domain at the three nodes :
The node polynomial is
The barycentric weights are
The Lagrange basis polynomials are
The Lagrange interpolating polynomial is:
In (second) barycentric form,
Notes
edit
The Lagrange form of the interpolation polynomial shows the linear character of polynomial interpolation and the uniqueness of the interpolation polynomial. Therefore, it is preferred in proofs and theoretical arguments. Uniqueness can also be seen from the invertibility of the Vandermonde matrix, due to the non-vanishing of the Vandermonde determinant.
But, as can be seen from the construction, each time a node xk changes, all Lagrange basis polynomials have to be recalculated. A better form of the interpolation polynomial for practical (or computational) purposes is the barycentric form of the Lagrange interpolation (see below) or Newton polynomials.
Lagrange and other interpolation at equally spaced points, as in the example above, yield a polynomial oscillating above and below the true function. This behaviour tends to grow with the number of points, leading to a divergence known as Runge's phenomenon; the problem may be eliminated by choosing interpolation points at Chebyshev nodes.[5]
When interpolating a given function f by a polynomial of degree k at the nodes we get the remainder which can be expressed as[6]
where is the notation for divided differences. Alternatively, the remainder can be expressed as a contour integral in complex domain as
The remainder can be bound as
Derivation
edit
Clearly, is zero at nodes. To find at a point , define a new function and choose where is the constant we are required to determine for a given . We choose so that has zeroes (at all nodes and ) between and (including endpoints). Assuming that is -times differentiable, since and are polynomials, and therefore, are infinitely differentiable, will be -times differentiable. By Rolle's theorem, has zeroes, has zeroes... has 1 zero, say . Explicitly writing :
The dth derivative of a Lagrange interpolating polynomial can be written in terms of the derivatives of the basis polynomials,
Recall (see § Definition above) that each Lagrange basis polynomial is
The first derivative can be found using the product rule:
The second derivative is
The third derivative is
and likewise for higher derivatives.
Note that all of these formulas for derivatives are invalid at or near a node. A method of evaluating all orders of derivatives of a Lagrange polynomial efficiently at all points of the domain, including the nodes, is converting the Lagrange polynomial to power basis form and then evaluating the derivatives.
^Lagrange, Joseph-Louis (1795). "Leçon Cinquième. Sur l'usage des courbes dans la solution des problèmes". Leçons Elémentaires sur les Mathématiques (in French). Paris. Republished in Serret, Joseph-Alfred, ed. (1877). Oeuvres de Lagrange. Vol. 7. Gauthier-Villars. pp. 271–287. Translated as "Lecture V. On the Employment of Curves in the Solution of Problems". Lectures on Elementary Mathematics. Translated by McCormack, Thomas J. (2nd ed.). Open Court. 1901. pp. 127–149.
^Meijering, Erik (2002). "A chronology of interpolation: from ancient astronomy to modern signal and image processing" (PDF). Proceedings of the IEEE. 90 (3): 319–342. doi:10.1109/5.993400.
^Quarteroni, Alfio; Saleri, Fausto (2003). Scientific Computing with MATLAB. Texts in computational science and engineering. Vol. 2. Springer. p. 66. ISBN 978-3-540-44363-6..