Spline — Definition, Formula & Examples
A spline is a piecewise polynomial function that passes through a set of given points while maintaining smoothness at the junctions between pieces. The most common type is the cubic spline, which uses third-degree polynomials between each pair of adjacent data points.
Given data points with , a spline of degree is a function such that on each subinterval , is a polynomial of degree at most , and together with its first derivatives is continuous on .
How It Works
You start with a set of data points called knots. On each interval between consecutive knots, you define a separate polynomial. The key constraint is that neighboring polynomials must agree in value and in their derivatives (up to a specified order) at the shared knot. For a cubic spline, this means the function, its first derivative, and its second derivative are all continuous at every knot. Two additional boundary conditions (such as setting the second derivative to zero at the endpoints, called a "natural" spline) provide enough equations to determine all the polynomial coefficients uniquely.
Worked Example
Problem: Construct a natural cubic spline through the points (0, 0), (1, 1), and (2, 0). Find the spline function on each subinterval.
Step 1: Define two cubic polynomials: on and on . For a natural cubic spline, the second derivatives at the endpoints are zero: and .
Step 2: Apply interpolation conditions (, , , ), continuity of first and second derivatives at , and the natural boundary conditions. Solving the resulting system of equations yields:
Step 3: Similarly, writing in terms of for convenience and solving:
Answer: The natural cubic spline is on and on . Both pieces join smoothly at with matching value, first derivative, and second derivative.
Why It Matters
Splines are the backbone of computer-aided design (CAD), computer graphics, and font rendering. In numerical analysis courses, cubic spline interpolation is preferred over high-degree polynomial interpolation because it avoids the wild oscillations described by Runge's phenomenon. Engineers and data scientists use splines for smooth curve fitting in everything from aerospace surface modeling to smoothing noisy sensor data.
Common Mistakes
Mistake: Forgetting to impose boundary conditions, leaving the cubic spline system underdetermined.
Correction: A cubic spline through points has unknown coefficients but only equations from interpolation and continuity. You need two additional boundary conditions (e.g., natural, clamped, or not-a-knot) to obtain a unique solution.
