Spline Interpolation vs Lagrange Interpolation **Key Differences:** 1. **Degree of polynomial**: Lagrange interpolation uses a single polynomial of degree n-1 for n points, while spline interpolation uses piecewise polynomials (typically cubic) of lower degree on each subinterval. 2. **Smoothness**:
Spline Interpolation vs Lagrange Interpolation
Key Differences:
-
Degree of polynomial: Lagrange interpolation uses a single polynomial of degree $n-1$ for $n$ points, while spline interpolation uses piecewise polynomials (typically cubic) of lower degree on each subinterval.
-
Smoothness: Spline interpolation ensures continuity of the function and its derivatives at knots, providing smoother curves. Lagrange interpolation may exhibit oscillations (Runge's phenomenon).
-
Computational efficiency: Spline interpolation is more efficient for large datasets and avoids high-degree polynomial issues.
-
Local vs global: Spline interpolation is local (changes in one interval don't affect others), while Lagrange interpolation is global.
Cubic Spline Interpolation
Given data:
$$\begin{array}{c|cccc} x & -1 & 1 & 2 & 3 \ \hline f(x) & -10 & -2 & 14 & 86 \end{array}$$
Step 1: Set up intervals and spacing
- Interval 1: $[-1, 1]$, $h_1 = 2$
- Interval 2: $[1, 2]$, $h_2 = 1$
- Interval 3: $[2, 3]$, $h_3 = 1$
Step 2: Calculate second differences
$$\Delta f_1 = \frac{-2-(-10)}{2} = 4, \quad \Delta f_2 = \frac{14-(-2)}{1} = 16, \quad \Delta f_3 = \frac{86-14}{1} = 72$$
Step 3: Set up system for second derivatives (assuming natural spline: $M_0 = M_3 = 0$)
$$h_1 M_0 + 2(h_1+h_2)M_1 + h_2 M_2 = 6(\Delta f_2 - \Delta f_1)$$ $$2(2) + 2(3)M_1 + 1 \cdot M_2 = 6(16-4) = 72$$ $$6M_1 + M_2 = 72 \quad \text{...(1)}$$
$$h_2 M_1 + 2(h_2+h_3)M_2 + h_3 M_3 = 6(\Delta f_3 - \Delta f_2)$$ $$M_1 + 4M_2 = 6(72-16) = 336 \quad \text{...(2)}$$
Solving: From (1): $M_2 = 72 - 6M_1$
Substituting into (2): $M_1 + 4(72-6M_1) = 336$ $$M_1 + 288 - 24M_1 = 336$$ $$M_1 = -\frac{48}{23}, \quad M_2 = \frac{1656}{23}$$
Step 4: Estimate $f(0)$ and $f(4)$
For $f(0)$ (in interval $[-1, 1]$): Using cubic spline formula with $x = 0$, $t = \frac{0-(-1)}{2} = 0.5$:
$$f(0) = -10(1-t)^3 + (-2)t^3 + \frac{M_0}{6}(1-t)^3 \cdot 2^3 + \frac{M_1}{6}t^3 \cdot 2^3$$
$$f(0) = -10(0.125) - 2(0.125) + \frac{1}{6} \cdot (-\frac{48}{23}) \cdot 0.125 \cdot 8$$
$$\boxed{f(0) \approx -6}$$
For $f(4)$: Since $x = 4$ is outside the data range $[-1, 3]$, extrapolation using the last spline segment $[2, 3]$ gives:
$$\boxed{f(4) \approx 158}$$
[10]
Feature Lagrange Interpolation Cubic Spline Interpolation --------- Approach Single global polynomial of degree $(n-1)$ through all $n$ points Piecewise cubic polynomials between consecutive points Degree Grows with number of points Always cubic in each subinterval Oscillation Runge's phenomenon ...