Spline Interpolation A Primer on the Basics by Don Allen
What are Splines? Splines interpolate data. Lower degree curves are used. Thus fewer points must be used. Consequently, we obtain a piecewise curve, valid only over a specific interval. Splines allow matching conditions – not unlike Hermite interpolation – but different
Linear Spline
The Linear Spline
Piecewise Polynomials
Linear Splines
Quadratic Spline
Cubic Spline To fit cubics to groups of four points. Rarely done
Cubic Spline To fit cubics to successive pairs of points, with matching conditions.
How it looks
Splines vs. Polynomials Remember the function → This function interpolated poorly at equally spaced points. Let’s compare with how well the natural cubic spline performs.
Function and Interpolant 12 equally spaced points Function in Red Interpolant in blue
Function and Cubic Spline 12 equally spaced points; Function in Red Spline in blue
Function, Interpolant, Cubic Spline 12 equally spaced points; Function in Green Spline in Red Interpolant in Blue
Cubic Spline – the equations
Cubic Spines Two types: both involve endpoint conditions – Natural S’’(endpoints) = 0 – Clamped S’(endpoints) = f’(endpoints) The error in interpolating a function with a clamped cubic spline depends on the fourth derivative.
Cubic Spline – derivation
Cubic Splines There are natural and clamped types They are very accurate in practice. They avoid most of the pitfalls of general polynomial interpolation. It is remarkably easy to program for the coefficients. The error depends on the second derivative. Full details are in the text and lecture notes.
Another Nasty Example