As there is only one interpolation polynomial for a given set of data points it is a bit misleading to call the polynomial the Lagrange interpolation polynomial. The more precise name is interpolation polynomial in the Lagrange form.
Definition
Given a set of k + 1 data points
where no two xj are the same, the interpolation polynomial in the Lagrange form is a linear combination
of Lagrange basis polynomials
Proof
The function we are looking for has to be a polynomial function L(x) of degree less than or equal to k with
The Lagrange polynomial is a solution to the interpolation problem.
As can be seen
- is a polynomial and has degree k.
Thus the function L(x) is a polynomial with degree at most k and
There can be only one solution to the interpolation problem since the difference of two such solutions would be a polynomial with degree at most k and k+1 zeros. This is only possible if the difference is identically zero, so L(x) is the unique polynomial interpolating the given data.
Main idea
Solving an interpolation problem leads to a problem in linear algebra where we have to solve a matrix. Using a standard monomial basis for our interpolation polynomial we get the very complicated Vandermonde matrix. By choosing another basis, the Lagrange basis, we get the much simpler identity matrix = δi,j which we can solve instantly.
Implementation in C
Note : "pos" and "val" arrays are of size "degree".
float weight;
float retVal = 0;
for (int i=0; i <= degree; i++) {
weight = 1;
for (int j=0; j
weight *= (desiredPos - pos[j]) / (pos[i] - pos[j]);
} for(int j=i+1; j<=degree; j++) {
weight *= (desiredPos - pos[j]) / (pos[i] - pos[j]);
} retVal += weight * val[i];
} return retVal;
}
Usage
Example 1
We wish to interpolate at the points
The basis polynomials are:
Thus the interpolating polynomial then is
&= 4.834848x^3 - 1.477474x. end{align}
Example 2
We wish to interpolate over the range :The interpolating polynomial is:
Example 3
We wish to interpolate over the range :The interpolating polynomial is:
Notes
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. 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 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 is known as the Gibbs phenomenon and can be lessened by choosing interpolation points at Chebyshev nodes.
The Lagrange basis polynomials can be used in numerical integration to derive the Newton–Cotes formulas.
Barycentric Interpolation
Using the quantityThe advantage of this representation is that the interpolation polynomial may now be evaluated as
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.
We can further simplify the first form by first considering the barycentric interpolation of the constant function :
- .
See also
- Polynomial interpolation
- Newton form of the interpolation polynomial
- Bernstein form of the interpolation polynomial
- Newton–Cotes formulas
External links
- Lagrange Method of Interpolation - Notes, PPT, Mathcad, Mathematica, Matlab, Maple at Holistic Numerical Methods Institute
- Lagrange interpolation polynomial on www.math-linux.com
- Module for Lagrange Polynomials by John H. Mathews
- The chebfun Project at Oxford University
References
This article is licensed under the GNU Free Documentation License.
Last updated on Saturday July 19, 2008 at 15:36:12 PDT (GMT -0700)
View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation
Copyright © 2008, Dictionary.com, LLC. All rights reserved.











