Spline (mathematics)
In mathematics, a spline is a special function defined piecewise by polynomials.
In interpolating problems, spline interpolation is often preferred to polynomial interpolation because it yields similar results, even when using low degree polynomials, while avoiding Runge's phenomenon for higher degrees.
In the computer science subfields of computer-aided design and computer graphics, the term spline more frequently refers to a piecewise polynomial curve. Splines are popular curves in these subfields
because of the simplicity of their construction, their ease and accuracy of evaluation, and their capacity to approximate complex shapes through curve fitting and interactive curve design.
The term spline comes from the flexible spline devices used by shipbuilders and draftsmen to draw smooth shapes.
Introduction
The term "spline" is used to refer to a wide class of functions that are used in applications requiring data interpolation and/or smoothing. The data may be either one-dimensional or multi-dimensional. Spline functions for interpolation are normally determined as the minimizers of suitable measures of roughness subject to the interpolation constraints. Smoothing splines may be viewed as generalizations of interpolation splines where the functions are determined to minimize a weighted combination of the average squared approximation error over observed data and the roughness measure. For a number of meaningful definitions of the roughness measure, the spline functions are found to be finite dimensional in nature, which is the primary reason for their utility in computations and representation. For the rest of this section, we focus entirely on one-dimensional, polynomial splines and use the term "spline" in this restricted sense.Definition
We begin by limiting our discussion to the univariate polynomial case. In this case, a spline is a piecewise polynomial function.This function, call it S, takes values from an interval and maps them to, the set of real numbers,
We want S to be piecewise defined. To accomplish this, let the interval be covered by k ordered, disjoint subintervals,
On each of these k "pieces" of , we want to define a polynomial, call it Pi.
On the ith subinterval of , S is defined by Pi,
The given k+1 points ti are called knots. The vector
is called a knot vector for the spline.
If the knots are equidistantly distributed in the interval we say the spline is uniform, otherwise we say it is non-uniform.
If the polynomial pieces Pi each have degree at most n, then the spline is said to be of degree .
If in a neighborhood of ti, then the spline is said to be
of smoothness at ti. That is,
at ti the two pieces Pi-1 and Pi share common
derivative values from the derivative of order 0
up through the derivative of order ri.
A vector
such that the spline has smoothness at ti for is called a smoothness vector for the spline.
Given a knot vector, a degree n, and a smoothness vector for, one can consider the set of all splines of degree having knot vector
and smoothness vector. Equipped with the operation of adding two functions and taking real multiples of functions, this set becomes a real vector space. This spline space is commonly denoted by.
In the mathematical study of polynomial splines the question of what happens when two knots,
say ti and ti+1,
are moved together has an easy answer. The polynomial piece
Pi
disappears, and the pieces
Pi−1 and Pi+1
join with the sum of the continuity losses for
ti and ti+1.
That is,
This leads to a more general understanding of a knot vector.
The continuity loss at any point can be considered to be the result of
multiple knots located at that point, and a spline type can be completely
characterized by its degree n and its extended knot vector
where ti is repeated ji times
for.
A parametric curve on the interval
is a spline curve if both X and Y are spline functions
of the same degree with the same extended knot vectors on that interval.
Examples
Suppose the interval is and the subintervalsare , , and . Suppose the polynomial pieces are
to be of degree 2, and the pieces on and must join in value and first derivative
while the pieces on and join simply in value.
This would define a type of spline S for which
would be a member of that type, and also
would be a member of that type.
The extended knot vector for this type of spline would be.
The simplest spline has degree 0. It is also called a step function.
The next most simple spline has degree 1. It is also called a linear spline. A closed linear spline in the plane is just a polygon.
A common spline is the natural cubic spline of degree 3 with continuity C2.
The word "natural" means that the second derivatives of
the spline polynomials
are set equal to zero at the endpoints of the interval of interpolation
This forces the spline to be a straight line outside of the interval, while not disrupting its smoothness.
Algorithm for computing natural cubic splines
Cubic splines are of the form.Given set of coordinates we wish to find set of splines for
These must satisfy:
- .
Algorithm for computing Natural Cubic Splines:
Input: set of coordinates, with
Output: set splines which is composed of n 5-tuples.
- Create new array a of size n + 1 and for set
- Create new arrays b and d each of size n.
- Create new array h of size n and for set
- Create new array α of size n and for set.
- Create new arrays c, l, μ, and z each of size.
- Set
- For
- # Set .
- # Set.
- # Set.
- Set
- For
- # Set
- # Set
- # Set
- Create new set Splines and call it output_set. Populate it with n splines S.
- For
- # Set Si,a = ai
- # Set Si,b = bi
- # Set Si,c = ci
- # Set Si,d = di
- # Set Si,x = xi
- Output output_set
General Expression For a ''C''2 Interpolating Cubic Spline
where
- are the values of the second derivative at the ith knot.
- are the values of the function at the ith knot.
Representations and Names
the space containing all splines of a certain type can be counted from the extended knot vector:
The dimension is equal to the sum of the degree plus the multiplicities
If a type of spline has additional linear conditions imposed upon it, then the resulting spline will lie in a subspace. The space of all natural cubic splines, for instance, is a subspace of the space of all cubic C2 splines.
The literature of splines is replete with names for special types of splines.
These names have been associated with:
- The choices made for representing the spline, for example:
- * using basis functions for the entire spline
- * using Bernstein polynomials as employed by Pierre Bézier to represent each polynomial piece
- The choices made in forming the extended knot vector, for example:
- * using single knots for Cn-1 continuity and spacing these knots evenly on
- * using knots with no restriction on spacing
- Any special conditions imposed on the spline, for example:
- * enforcing zero second derivatives at a and b
- * requiring that given data values be on the spline
For each of the representations, some means of evaluation must be found so that values of the spline can be produced on demand. For those representations that express each individual polynomial piece Pi in terms of
some basis for the degree n polynomials, this is conceptually straightforward:
- For a given value of the argument t, find the interval in which it lies
- Look up the polynomial basis chosen for that interval
- Find the value of each basis polynomial at t:
- Look up the coefficients of the linear combination of those basis polynomials that give the spline on that interval c0,..., ck-2
- Add up that linear combination of basis polynomial values to get the value of the spline at t:
For a representation that defines a spline as a linear combination of basis splines, however, something more sophisticated is needed. The de Boor algorithm is an efficient method for evaluating B-splines.
History
Before computers were used, numerical calculations were done by hand. Although piecewise-defined functions like the sign function or step function were used, polynomials were generally preferred because they were easier to work with. Through the advent of computers splines have gained importance. They were first used as a replacement for polynomials in interpolation, then as a tool to construct smooth and flexible shapes in computer graphics.It is commonly accepted that the first mathematical reference to splines is the 1946 paper by Schoenberg, which is probably the first place that the word "spline" is used in connection with smooth, piecewise polynomial approximation. However, the ideas have their roots in the aircraft and shipbuilding industries. In the foreword to, Robin Forrest describes "lofting", a technique used in the British aircraft industry during World War II to construct templates for airplanes by passing thin wooden strips through points laid out on the floor of a large design loft, a technique borrowed from ship-hull design. For years the practice of ship design had employed models to design in the small. The successful design was then plotted on graph paper and the key points of the plot were re-plotted on larger graph paper to full size. The thin wooden strips provided an interpolation of the key points into smooth curves. The strips would be held in place at discrete points and between these points would assume shapes of minimum strain energy. According to Forrest, one possible impetus for a mathematical model for this process was the potential loss of the critical design components for an entire aircraft should the loft be hit by an enemy bomb. This gave rise to "conic lofting", which used conic sections to model the position of the curve between the ducks. Conic lofting was replaced by what we would call splines in the early 1960s based on work by J. C. Ferguson at Boeing and by M.A. Sabin at British Aircraft Corporation.
The word "spline" was originally an East Anglian dialect word.
The use of splines for modeling automobile bodies seems to have several independent beginnings. Credit is claimed on behalf of de Casteljau at Citroën, Pierre Bézier at Renault, and Birkhoff, Garabedian, and de Boor at General Motors, all for work occurring in the very early 1960s or late 1950s. At least one of de Casteljau's papers was published, but not widely, in 1959. De Boor's work at General Motors resulted in a number of papers being published in the early 1960s, including some of the fundamental work on B-splines.
Work was also being done at Pratt & Whitney Aircraft, where two of the authors of — the first book-length treatment of splines — were employed, and the David Taylor Model Basin, by Feodor Theilheimer. The work at General Motors is detailed nicely in and. Davis summarizes some of this material.