Lagrange Interpolation
Lagrange interpolation is a method for Polynomial Interpolation that constructs a unique polynomial passing through a given set of points using Lagrange basis polynomials.
Formula
Given data points , the Lagrange interpolating polynomial is:
Where are the Lagrange basis polynomials:
Expanded Form
The full formula can be written as:
Lagrange Basis Polynomials
The basis polynomial has the special property:
This ensures that for all data points.
Example: Three Points
For three points :
The interpolating polynomial is then:
Properties
- Uniqueness: There is a unique polynomial of degree at most passing through points
- Symmetry: The formula treats all points equally
- Direct evaluation: No need to build a table (unlike Newton Divided Difference)
- Exact at data points: by construction
Advantages
- Conceptually simple: Direct formula, no iterative computation
- Symmetric: All data points treated equally
- Single formula: Entire polynomial expressed in one equation
Limitations
- Computational cost: Evaluating at many points is expensive
- No incremental updates: Adding new points requires full recomputation
- Runge phenomenon: High-degree polynomials oscillate wildly, especially with equispaced points
- Poor extrapolation: Should not be used for extrapolation beyond data range
- Edge effects: Interpolation quality degrades near endpoints
Behaviour Characteristics
- Center: Excellent fit in the center of data range
- Edges: Accuracy degrades toward endpoints
- Oscillations: Can exhibit large oscillations between points for high-degree polynomials
Comparison to Newton’s Method
Both Lagrange and Newton Divided Difference produce identical polynomials but differ in:
| Aspect | Lagrange | Newton |
|---|---|---|
| Computation | Direct formula | Recursive table |
| Incremental updates | Requires full recomputation | Efficient incremental updates |
| Symmetry | Fully symmetric | Depends on point ordering |
| Evaluation cost | Higher | Lower |
| Conceptual clarity | Simpler | More complex |
Error Analysis
The interpolation error for a function with continuous -th derivative is:
For some in the interval containing and all .
Python Implementation
def lagrange_polynomial(x_value, x_data, y_data):
"""
Evaluate Lagrange interpolating polynomial at a given point.
Parameters
----------
x_value : float
Point at which to evaluate the polynomial
x_data : numpy.ndarray
Array of x-coordinates
y_data : numpy.ndarray
Array of y-coordinates (function values)
Returns
-------
float
Value of the polynomial at x_value
"""
num_points = len(x_data)
result = 0.0
for point_index in range(num_points):
# Compute Lagrange basis polynomial L_i(x_value)
basis_term = 1.0
for other_index in range(num_points):
if other_index != point_index:
basis_term *= (x_value - x_data[other_index]) / (x_data[point_index] - x_data[other_index])
# Add contribution y_i * L_i(x_value)
result += basis_term * y_data[point_index]
return resultApplications
- Function approximation
- Numerical analysis
- Computer graphics
- Scientific computing
Related Methods
- Newton Divided Difference: Alternative polynomial form
- Spline Interpolation: Piecewise alternative avoiding high-degree polynomials
- Polynomial Interpolation: General category
- Linear Interpolation: Special case with two points