Lab 18 · Lecture 18 · Spline Interpolation and the Runge Phenomenon
Spline and Runge Lab
See the Runge phenomenon, tame it with Chebyshev points and splines, and build natural cubic splines for your own data.
Change the number of points and the methods. The table gives the largest error on [−1, 1].
Type your points (any spacing). The table lists Mᵢ = S″(xᵢ) of the natural cubic spline; switch to Lagrange to compare with one polynomial.
Natural cubic spline
Try this
Runge phenomenon
Try this
Q1 What is the Runge phenomenon?
Interpolating a smooth function by one polynomial through many equally spaced points can give large oscillations near the ends of the interval, and the error grows as more points are added (e.g. : error 1.92 with 11 points, 60 with 21).
Q2 State the conditions that define a natural cubic spline.
On each interval is a cubic; ; , and are continuous at the inner points; and .
Q3 Fit a natural cubic spline to ; find .
, , so , ; on : , .
Q4 Why are splines preferred to a single high-degree polynomial for long data sets?
Each piece is low degree and depends mainly on nearby data, so there are no wild end oscillations; the error falls steadily (like ) as points are added; and the setup is a tridiagonal system, work.
Q5 Give two situations where a cubic spline is a poor choice.
Data with jumps or sharp corners (overshoot); noisy measurements (the spline passes through the noise; use least squares); also extrapolation beyond the data.