Interpolation

Interpolation estimates unknown values within a dataset by constructing functions that pass through known points. Essential in numerical analysis, it transforms discrete data into continuous models for applications like data visualization, scientific simulations, and financial forecasting. Unlike extrapolation, interpolation stays within the data range, ensuring reliable estimates when the underlying function behaves predictably.

This MathMultiverse guide explores interpolation from linear methods to advanced techniques like Lagrange polynomials and cubic splines, with examples, visualizations, and real-world applications to make the concepts accessible and practical.

Linear Interpolation

Linear interpolation connects two points with a straight line, ideal for gradual data changes. For points \( (x_0, y_0) \) and \( (x_1, y_1) \), the value at \( x \) (where \( x_0 \leq x \leq x_1 \)) is:

\[ y = y_0 + \frac{(y_1 - y_0)(x - x_0)}{x_1 - x_0} \]

Derived from the line’s slope, this method is simple but less accurate for curved data. The error depends on the function’s curvature:

\[ \text{Error} \approx \frac{f''(\xi)}{2} (x - x_0)(x - x_1), \quad \xi \in [x_0, x_1] \]

Linear Interpolation Visualization

Shows linear interpolation between \( (0, 0) \) and \( (2, 4) \).

Examples

Practical examples illustrate interpolation techniques.

1. Linear Interpolation

Points \( (0, 0) \), \( (2, 4) \), find \( y \) at \( x = 1 \):

\[ y = 0 + \frac{(4 - 0)(1 - 0)}{2 - 0} = 2 \]

Exact for \( y = 2x \). At \( x = 1.5 \):

\[ y = 0 + \frac{(4 - 0)(1.5 - 0)}{2 - 0} = 3 \]

2. Linear Interpolation (Nonlinear Data)

Points \( (1, 1) \), \( (3, 9) \) (from \( y = x^2 \)), at \( x = 2 \):

\[ y = 1 + \frac{(9 - 1)(2 - 1)}{3 - 1} = 5 \]

True value: \( 2^2 = 4 \). Error: \( 1 \).

3. Quadratic Interpolation

Points \( (0, 0) \), \( (1, 1) \), \( (2, 4) \), fit \( p(x) = ax^2 + bx + c \):

\[ p(0) = c = 0 \] \[ p(1) = a + b = 1 \] \[ p(2) = 4a + 2b = 4 \]

Solves to \( p(x) = x^2 \), exact for \( y = x^2 \).

Advanced Methods

Advanced techniques improve accuracy and smoothness.

Lagrange Interpolation

For \( n+1 \) points:

\[ P(x) = \sum_{i=0}^n y_i \ell_i(x), \quad \ell_i(x) = \prod_{\substack{j=0 \\ j \neq i}}^n \frac{x - x_j}{x_i - x_j} \]

For \( (0, 0) \), \( (1, 1) \), \( (2, 4) \), at \( x = 1.5 \):

\[ \ell_0(1.5) = -0.125, \quad \ell_1(1.5) = 0.75, \quad \ell_2(1.5) = 0.375 \] \[ P(1.5) = 0 \cdot (-0.125) + 1 \cdot 0.75 + 4 \cdot 0.375 = 2.25 \]

Exact for \( (1.5)^2 \).

Cubic Splines

Piecewise cubics with continuous derivatives:

\[ S_i(x) = a_i + b_i (x - x_i) + c_i (x - x_i)^2 + d_i (x - x_i)^3 \]

Natural splines set \( S''(x_0) = S''(x_n) = 0 \).

Newton’s Divided Difference

Polynomial form:

\[ P(x) = f[x_0] + f[x_0, x_1] (x - x_0) + \cdots \] \[ f[x_i, x_j] = \frac{f[x_{i+1}, x_j] - f[x_i, x_{j-1}]}{x_j - x_i} \]

Lagrange Interpolation Visualization

Shows quadratic interpolation for \( (0, 0) \), \( (1, 1) \), \( (2, 4) \).

Applications

Interpolation is vital in:

  • Data Visualization: Smooths curves in graphs for clearer trends.
  • Engineering: Interpolates sensor data for system modeling.
  • Finance: Estimates stock prices between trading points.
  • Computer Graphics: Uses splines for smooth animations.