This Demonstration lets you compare piecewise quadratic interpolation with a little-known variation of it that always gives a smooth interpolation function. This means that derivatives of all orders exist for this function. Smoothness is achieved by joining neighboring quadratic interpolation polynomials by means of a smooth sigmoid function that depends on a positive parameter . This sigmoid is given by a surprisingly simple formula:
The checkbox allows you to toggle between smooth interpolation and piecewise quadratic interpolation. Locator points can be shifted, deleted, or added. This allows you to test a variety of interpolation situations. The sigmoid function is always shown below the graphical representation of the interpolated function. Pale colors in this representation indicate that the function presently runs idle since the smooth interpolation mechanism is not selected using the checkbox. The parameter always has the value that is selected by the slider. Varying can be seen to change the curve σ considerably, but it rarely has much affect on the interpolation.
Snapshot 1: Piecewise quadratic interpolation, as implemented here by the Mathematica function Interpolation, may result in kinks.
Snapshot 2: No kinks result with the smooth version.
Snapshots 3 and 4 show the lowest considered value and the largest considered value of the sigmoid's steepness parameter in action. The preferred value 0.81 (more precisely 0.810747) of this parameter minimizes the integral of the square of the second derivative (i.e. total kinetic energy in a quantum analogy) of the sigmoid.
The proposed interpolation method is basically twice as expensive as piecewise quadratic interpolation. It is thus a computationally very cheap method and gives perfectly smooth curves and, unlike spline methods, needs no preparatory run. The method of switching softly from one local dataset to the next by means of a smooth sigmoid can also be used for higher-order local interpolation or even for rational interpolation instead of polynomial interpolation. A historical note: These generalizations are worked out in detail in the Kodak (European Research) Technical Report, Ulrich Mutze, "Smooth Interpolation through Many Points via Partition of Unity," Accession No. 278844A, September, 9, 1992, which is not publicly available. A short presentation of the second-order polynomial method can be found on page 4 of Ulrich Mutze, "A Simple Variational Integrator for General Holonomic Mechanical Systems," 2003 at http://www.ma.utexas.edu/mp_arc/c/03/03-491.pdf. It differs in the treatment of the boundaries of the data, in that it switches smoothly to linear interpolation there that, as a rule, is more useful for extrapolation. In the present work such finesse would complicate the comparison with the nonsmooth method.
The proposed sigmoid function is remarkable since it is smooth and nevertheless grows from 0 to 1 in a compact interval (which here is [0,1]). Therefore, it can conveniently replace the nonsmooth sigmoids in fuzzy logic and in wavelets.