Interpolation: polynomials vs. splines

In the applet below you can choose a number of points and compare the behavior of (algebraic) polynomial vs. the (natural) cubic spline passing through the given points.

 Your browser cannot show this applet. You need to use a Java capable browser, such as Netscape 2.0. Here is a static image of the applet: Try to put about eight points in a straight line. Then move one of the points in the middle up and down. You will see that the interpolating polynomial will change drastically even far away from the perturbed node. For the cubic spline, however, the changes rapidly decay away from the perturbed node. The polynomial interpolant is the unique (algebraic) polynomial of degree n-1 or less which passes through the given n points. The cubic spline is the unique piecewise cubic polynomial such that its pointvalues and its first two derivatives (but not the third) are continuous at the given n points. Having zero second derivatives at the endpoints makes it natural. It is the smoothest of all possible interpolating curves in the sense that it minimizes the integral of the square of the second derivative. Acknowledgement. Thanks to Tobias von Petersdorff who wrote this code with the help of Michael Heinrichs' Curve Applet and to Hetal Patel for the implementation.