314 Approximation by Polynomials
10.8. Splines
Splines are smooth piecewise polynomials. They are well adapted to use on
computers, and so they are much used in practical work. Because they are closely
related to polynomials, we give a brief treatment of splines here, concentrating on
issues related to real analysis. For algorithmic and implementation issues, we refer
the reader to [18].
To motivate the idea behind splines, observe that approximation by polyno-
mials can be improved either by increasing the degree of the polynomial or by
decreasing the size of the interval on which the approximation is used. Splines
take the latter approach, successively chopping the interval into small pieces and
approximating the function on each piece by a polynomial of fixed small degree,
such as a cubic.
We search for a relatively smooth function that is piecewise a polynomial of
low degree but is not globally a polynomial at all. This turns out to be worth the ad-
ditional theoretical complications. Why? First, evaluating the approximation will
be easier on each subinterval because it is a polynomial of small degree. Instead of
having to do some multiplications, we have several comparisons to decide which
interval we are in. Comparison is much simpler than multiplication, so evaluation
can be much faster, even if we have to do many comparisons.
Second, since the degree is small, we can use simple methods like interpolation
to find the polynomial on each subinterval. Interpolation is both easy to implement
on the computer and (mostly) easy to understand.
Third, local irregularities of the function only affect the approximation locally,
in contrast to polynomial approximation. This means that if a function f is not
differentiable at one point of the interval, then this affects the polynomial approx-
imation over the whole interval. Working with polynomials on subintervals, the
lack of differentiability at one point affects the polynomial approximation on that
subinterval only.
The discussion so far has pretended that we are free to choose completely dif-
ferent polynomials on each subinterval. In fact, we would like the polynomials to
fit together smoothly. To start, we begin with the revealing special case of approxi-
mation by a piecewise linear continuous function.
Choose a partition ∆ of the interval [a, b] into k subintervals with endpoints
a = x
0
< x
1
< ··· < x
k
= b. We define S
1
(∆) to be the subspace of C[a, b] given
by
S
1
(∆) = {g ∈ C[a, b] : g|
[x
i
,x
i+1
]
is linear for 0 ≤ i < k}.
Clearly, a function g ∈ S
1
(∆) is uniquely determined by its values g(x
i
) at the
nodes x
i
for 0 ≤ i ≤ k. Indeed, we just construct the line segments between the
points (x
i
, g(x
i
)). Thus S
1
(∆) is a finite-dimensional subspace of dimension k + 1.
The elements of this space are called linear splines. Figure 10.6 shows an element
of S
1
(∆) approximating a given continuous function.
Now take a continuous function f in C[a, b]. By Theorem 7.6.5, there is some
g in S
1
(∆) so that
kf − gk
∞
= inf{kf − hk
∞
: h ∈ S
1
(∆)}.