- Spline interpolation
-
See also: Spline (mathematics)
In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. Spline interpolation is preferred over polynomial interpolation because the interpolation error can be made small even when using low degree polynomials for the spline. Spline interpolation avoids the problem of Runge's phenomenon which occurs when interpolating between equidistant points with high degree polynomials.
Contents
Introduction
Elastic rulers that were bent to pass through a number of predefined points (the "knots") were used for making technical drawings for shipbuilding and construction by hand, as illustrated by figure 1.
The approach to mathematically model the shape of such elastic rulers fixed by n+1 "knots" is to interpolate between all the pairs of "knots" and with polynomials
The curvature of a curve
- y = f(x)
is
As the elastic ruler will take a shape that minimizes the bending under the constraint of passing through all "knots" both y' and y'' will be continuous everywhere, also at the "knots". To achieve this one must have that
- q'i(xi) = q'i + 1(xi)
and that
- q''i(xi) = q''i + 1(xi)
for all i , . This can only be achieved if polynomials of degree 3 or higher are used. The classical approach is to use polynomials of degree 3, this is the case of "Cubic splines".
Algorithm to find the interpolating cubic spline
A third order polynomial q(x) for which
- q(x1) = y1
- q(x2) = y2
- q'(x1) = k1
- q'(x2) = k2
can be written in the symmetrical form
(
where
(
and
a = k1(x2 − x1) − (y2 − y1)
(
b = − k2(x2 − x1) + (y2 − y1)
(
As one gets that(
(
Setting x = x1 and x = x2 in (5) and (6) one gets from (2) that indeed q'(x1) = k1 , q'(x2) = k2 and that
(
(
If now
are n+1 points and
(
where
are n third degree polynomials interpolating y in the interval , for such that
for
then the n polynomials together define a derivable function in the interval and
ai = ki − 1(xi − xi − 1) − (yi − yi − 1)
(
bi = − ki(xi − xi − 1) + (yi − yi − 1)
(
for where
(
(
(
If the sequence is such that in addition
for
the resulting function will even have a continuous second derivative.
From (7), (8), (10) and (11) follows that this is the case if and only if
(
for
The relations (15) are n-1 linear equations for the n+1 values .
For the elastic rulers being the model for the spline interpolation one has that to the left of the left-most "knot" and to the right of the right-most "knot" the ruler can move freely and will therefore take the form of a straight line with q'' = 0. As q'' should be a continuous function of x one gets that for "Natural Splines" one in addition to the n-1 linear equations (15) should have that
i.e. that
(
(
(15) together with (16) and (17) constitute n+1 linear equations that uniquely define the n+1 parameters
Example
In case of three points the values for k0,k1,k2 are found by solving the linear equation system
with
For the three points
one gets that
- a1 = k0(x1 − x0) − (y1 − y0) = − 0.1875
- b1 = − k1(x1 − x0) + (y1 − y0) = − 0.3750
- a2 = k1(x2 − x1) − (y2 − y1) = − 3.3750
- b2 = − k2(x2 − x1) + (y2 − y1) = − 1.6875
In figure 2 the spline function consisting of the two cubic polynomials q1(x) and q2(x) given by (9) is displayed
See also
- Cubic Hermite spline
- Monotone cubic interpolation
- NURBS
- Multivariate interpolation
- Polynomial interpolation
- Smoothing spline
External links
Categories:- Splines
- Interpolation
Wikimedia Foundation. 2010.