Smoothly Interpolating a Set of Data
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
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 for this function derivatives of all orders exist. 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:[more]
The checkbox allows you to toggle between smooth interpolation and piecewise quadratic interpolation. The Locator points can be shifted, deleted, or new points can be created. 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 interpolation mechanism is not selected as smooth in the checkbox. The parameter s has always the value which is selected by the slider. Variation of s can be seen to change the curve σ considerably but rarely has much effect on the interpolation.[less]
Contributed by: Ulrich Mutze (November 2010)
Based on a program by: Stephen Wolfram
Open content licensed under CC BY-NC-SA
Snapshot 1: piecewise quadratic interpolation, as implemented here by the Mathematica function Interpolation may result in kinks
Snapshot 2: no kinks 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. the 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 data set 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, Date 09/24/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 a 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.