Spline Interpolation

Spline interpolation is a method of Interpolation that connects data points with piece-wise polynomial functions, rather than using a single high-degree polynomial.

Motivation

High-degree polynomial interpolation (like Lagrange Interpolation) suffers from:

  • Runge phenomenon: Wild oscillations between data points
  • Numerical instability: Small changes in data cause large changes in polynomial
  • Poor edge behaviour: Especially with equispaced points

Splines solve these problems by using many low-degree polynomials joined together smoothly.

Definition

A spline of degree is a piece-wise polynomial function where:

  1. Each piece is a polynomial of degree at most
  2. The pieces join together smoothly at knots (data points)
  3. Continuity conditions are satisfied at knots

Common Spline Types

Linear Splines

The simplest splines are linear splines, which connect consecutive points with straight line segments.

  • Degree: 1 (linear)
  • Continuity: (continuous, but not differentiable at knots)
  • Identical to: Piecewise Linear Interpolation

Example: Excel’s straight-line plot uses linear splines.

Quadratic Splines

Quadratic splines use parabolic segments:

  • Degree: 2
  • Continuity: Typically (continuous first derivative)

Cubic Splines

Cubic splines are the most commonly used:

  • Degree: 3
  • Continuity: (continuous second derivative)
  • Properties: Smooth appearance, minimum curvature

Example: Excel uses cubic splines for smooth curve plots.

Cubic Spline Construction

For data points, we need cubic polynomials for intervals :

Conditions

To determine the coefficients, we need equations:

  1. Interpolation ( equations):

    • for
    • for
  2. First derivative continuity ( equations):

    • for
  3. Second derivative continuity ( equations):

    • for
  4. Boundary conditions (2 equations):

    • Various choices possible (see below)

Total: equations ✓

Boundary Conditions

The two remaining degrees of freedom are specified by boundary conditions:

Natural Spline

Zero curvature at endpoints (most common).

Clamped Spline

Specified derivatives at endpoints (when known).

Not-a-Knot

Third derivative continuous at second and penultimate points.

Properties of Cubic Splines

  1. Minimal curvature: Natural cubic splines minimize
  2. Smooth appearance: continuity ensures visually smooth curves
  3. Local control: Changing one data point affects only nearby segments
  4. Stability: No wild oscillations like high-degree polynomials
  5. Optimal approximation: Best piece-wise cubic approximation in certain norms

Advantages

  • No oscillations: Avoids Runge phenomenon
  • Local behaviour: Changes in data have local effects
  • Smooth: continuity for cubic splines
  • Efficient: Low computational cost
  • Stable: Numerically stable

Limitations

  • Not truly global: Not a single polynomial
  • Computational setup: Requires solving a linear system
  • Boundary sensitivity: Results depend on boundary condition choice
  • Derivative jumps: Lower-order splines have derivative discontinuities

Construction Algorithm (Cubic)

  1. Compute second derivatives by solving a tridiagonal system

  2. Use values to determine spline coefficients:

where $h_i = x_{i+1} - x_i$ ## Applications - **Computer graphics**: Smooth curve rendering - **CAD/CAM**: Design of smooth shapes - **Data visualization**: Excel, MATLAB, etc. - **Finite element methods**: Basis functions - **Signal processing**: Smooth data representation - **Font rendering**: TrueType fonts use quadratic B-splines ## B-Splines **B-splines** (basis splines) are a generalization that provide: - More flexible knot placement - Better numerical stability - Easier computation - Used in NURBS (Non-Uniform Rational B-Splines) for CAD ## Python Implementation Note Most scientific Python libraries provide spline functionality: ```python from scipy.interpolate import CubicSpline # Create Cubic Spline spline = CubicSpline(x_data, y_data, bc_type='natural') # Evaluate at New Points y_interpolated = spline(x_new) ``` ## Comparison to Polynomial Interpolation | Aspect | Single Polynomial | Splines | |--------|------------------|---------| | Degree | High (n) | Low (typically 3) | | Oscillations | Common | Rare | | Smoothness | Infinitely differentiable | $C^2$ (cubic) | | Computation | Direct | Solve linear system | | Stability | Poor for high n | Excellent | | Extrapolation | Dangerous | Still poor | ## Related Concepts - [[Interpolation]]: General concept - [[Polynomial Interpolation]]: Alternative approach - [[Lagrange Interpolation]]: Single polynomial method - [[Linear Interpolation]]: Simplest spline case