2.4 Interpolation by Spline Functions
2.4.4 B-Splines
it follows from the above result fork= 1 that
|f(x)−S∆(x)| ≤ 74L∆3· 12∆=78L∆4. x∈[a, b].
Clearly, (2.4.3.3) implies that for sequences
∆m={a=x(m)0 < x(m)1 <· · ·< x(m)n
m =b}
of partitions with∆m→0 the corresponding cubic spline functions S∆m and their first two derivatives converge tof and its corresponding deriva- tives uniformly on [a, b]. If in addition
sup
m,j
∆m
|x(m)j+1−x(m)j | ≤K <+∞,
even the third derivativefis uniformly approximated byS∆
m, a usually discontinuous sequence of step functions.
consisting of B-splines. As a consequence, B-splines provide the framework for an efficient and numerically stable calculation of splines.
In order to define B-splines, we introduce the functionfx: IR→IR fx(t) := (t−x)+:= max(t−x,0) =
t−x fort > x, 0 fort≤x, and its powersfxr,r≥0, in particular forr= 0,
fx0(t) :=
1 fort > x, 0 fort≤x.
The function fxr(.) is composed of two polynomials of degree≤ r: the 0- polynomial P0(t) := 0 for t ≤xand the polynomial P1(t) := (t−x)r for t > x. Note thatfxr depends on a real parameter x, and the definition of fxr(t) is such that it is a function ofxwhich is continuous from the right for each fixed t. Clearly, for r ≥ 1, fxr(t) is (r−1) times continuously differentiable both with respect tot and with respect tox.
Recall further that under certain conditions the generalized divided difference f[ti, ti+1, . . . , ti+r] of a real function f(t), f: IR → IR is well defined for any segment ti ≤ ti+1 ≤ · · · ≤ ti+r of real numbers, even if thetj are not mutually distinct [see Section 2.1.5, in particular (2.1.5.4)].
The only requirement is that f be (sj −1)-times differentiable att =tj, j=i,i+ 1,. . .,i+r, if the value oftj occurs sj times in the subsegment ti ≤ti+1≤ · · · ≤tj terminating withtj. In this case, by (2.1.5.7)
(2.4.4.1)
f[ti, . . . , ti+r] := f(r)(ti)
r! , if ti=ti+r,
f[ti, . . . , ti+r] := f[ti+1, . . . , ti+r]−f[ti, . . . , ti+r−1]
ti+r−ti , otherwise.
It follows by induction overrthat the divided differences of the functionf are linear combinations of its derivatives at the pointstj:
(2.4.4.2) f[ti, ti+1, . . . , ti+r] = i+r j=i
αjf(sj−1)(tj), where, in particular,αi+r= 0.
Now letr≥1 be an integer andt={ti}i∈ZZ any infinite nondecreasing unbounded sequence of realsti with
inf ti=−∞, sup ti= +∞ andti< ti+rfor alli∈ZZ.
Then thei-th B-spline of orderrassociated withtis defined as the following function inx:
(2.4.4.3) Bi,r,t(x) := (ti+r−ti)fxr−1[ti, ti+1, . . . , ti+r],
for which we also write sometimes more brieflyBi orBi,r [see Figure 2 for simple examples].
Clearly, Bi,r,t(x) is well defined for all x=ti, ti+1, . . ., ti+r and, by (2.4.4.2), (2.4.4.3) is a linear combination of the functions
(2.4.4.4a) (tj−x)r−s+ j
t=tj
, i≤j≤i+r,
if the value oftj occurs sj times within the subsegmentti ≤ti+1 ≤ · · · ≤ tj. If in addition, the value of tj occurs nj times within the full segment ti ≤ti+1 ≤ · · · ≤ti+r, then the definition of sj shows that for each index σwith 1≤σ≤nj there exists exactly one integerl=l(σ) satisfying
tl=tj, sl=σ, i≤l≤i+r.
ThusBi,r,t is also a linear combination of
(2.4.4.4b) (tj−x)s+, wherer−nj ≤s≤r−1,i≤j≤i+r.
Hence the function Bi,r,t coincides with a polynomial of degree at most r−1 on each of the open intervals in the following set
(−∞, ti)∪ {(tj, tj+1), i≤j < i+r&tj < tj+1} ∪(ti+r,+∞).
That is,Bi,r,t(x) is a piecewise polynomial function in xof order r with respect to the partition of the real axis given by thetk withk∈Ti,r, where
Ti,r:={j|i≤j < i+r &tj< tj+1} ∪ {i+r}.
Only at the knotsx=tk,k∈Ti,r, the functionBi,r,t(x) may have jump discontinuities, but it is continuous from the right, because the functions (tj−x)s+ occuring in (2.4.4.4) are functions ofxthat are continuous from the right everywhere, even whens= 0. Also by (2.4.4.4) for givent= (tj), the B-splineBi,r(x)≡Bi,r,t(x) is (r−nj−1) times differentiable atx=tj, if tj occurs nj times within ti, ti+1, . . ., ti+r (ifnj =r then Bi,r(x) has a jump discontinuity at x = tj). Hence the order of differentiability of Bi,r,t(x) atx=tj is governed by the number of repetitions of the value of tj.
We note several important properties of B-Splines:
(2.4.4.5) Theorem.(a)Bi,r,t(x) = 0forx∈[ti, ti+r].
(b)Bi,r,t(x)>0 forti < x < ti+r.
(c) For all x∈IR
i
Bi,r,t(x) = 1,
and the sum contains only finitely many nonzero terms.
By that theorem, the functions Bi,r ≡ Bi,r,t are nonnegative weight functions with sum 1 and support [ti, ti+r],
suppBi,r :={x|Bi,r(x)= 0}= [ti, ti+r], they form a “partition of unity.”
Example.Forr= 5 and a sequencetwith· · · ≤t0 < t1=t2 =t3< t4 =t5<
t6≤ · · ·, the B-SplineB1,5=B1,5,tof order 5 is a piecewiese polynomial function of degree 4 with respect to the partitiont3 < t5 < t6 of IR. Forx=t3,t5,t6 it has continuous derivatives up to the orders 1, 2, and 3, respectively, asn3 = 3, n5= 2, andn6= 1.
t0 t1 t2 t3 t4 t5
1 ...
... .......................................
B0,1,t B2,2,t
...... .......................
...
...
...
...
...
...
Fig. 2.Some simple B-Splines.
Proof.(a) Forx < ti≤t≤ti+r,fxr−1(t) = (t−x)r−1 is a polynomial of degree (r−1) int, which has a vanishingrth divided difference
fxr−1[ti, ti+1, . . . , ti+r] = 0 =⇒ Bi,r(x) = 0
by Theorem (2.1.3.10). On the other hand, if ti ≤ t ≤ ti+r < x then fxr−1(t) := (t−x)r−1+ = 0, is trivially true, so that againBi,r(x) = 0.
(b) Forr= 1 andti< x < ti+1, the assertion follows from the definition Bi,1(x) =,
(ti+1−x)0+−(ti−x)0+-
= 1−0 = 1,
and forr >1, from recursion (2.4.5.2) for the functionsNi,r:=Bi,r/(ti+r− ti), which will be derived later on.
(c) Assume firsttj < x < tj+1. Then by (a), Bi,r(x) = 0 for all i, r withi+r≤j and alli≥j+ 1, so that
i
Bi,r(x) = j i=j−r+1
Bi,r(x).
Now, (2.4.4.1) implies
Bi,r(x) =fxr−1[ti+1, ti+2, . . . , ti+r]−fxr−1[ti, ti+r, . . . , ti+r−1].
Therefore,
i
Bi,r(x) =fxr−1[tj+1, . . . , tj+r]−fxr−1[tj−r+1, . . . , tj] = 1−0.
The last equality holds because the function fxr−1(t) = (t−x)r−1 is a polynomial of degree (r−1) in t fortj < x < tj+1 ≤t ≤tj+r, for which fxr−1[tj+1, . . . , tj+r] = 1 by (2.1.4.3), and the function fx(r−1)(t) = (t− x)r−1+ = 0 vanishes for tj−r+1 ≤ t ≤ tj < x < tj+1. For x = tj, the assertion follows because of the continuity ofBi,r from the right,
Bi,r(tj) = lim
y↓tj
Bi,r(y).
We now return to the spaceS∆,kof splines of degreek≥0 and construct a sequence t= (tj) so that the B-splinesBi,k+1,t(x) of orderk+ 1 form a basis ofS∆,k. For this purpose, we associate the partition
∆={a=x0< x1<· · ·< xn=b}
with any infinite unbounded nondecreasing sequencet= (tj)j∈ZZ satisfying tj< tj+k+1 for allj,
t−k≤ · · · ≤t0:=x0< t1:=x1<· · ·< tn:=xn. In the following only its finite subsequence
t−k, t−k+1, . . . , tn+k
will matter. Then a (special case of a) famous result of Curry and Schoen- berg (1966) is
(2.4.4.6) Theorem.The restrictionsBi,k+1,t|[a, b]of then+k B-splines Bi≡Bi,k+1,t,i=−k,−k+ 1,. . .,n−1, to[a, b]form a basis of S∆,k. Proof.EachBi,−k≤i≤n−1, agrees with a polynomial of degree≤k on the subintervals [xj, xj+1] of [a, b], and has derivatives up to the order k−nj = k−1 in the interior knots tj =xj, j = 1, 2, . . ., n−1, of ∆ since thesetj occur only once int,nj = 1. This showsBi|[a, b]∈S∆,k for alli=−k,. . .,n−1. On the other hand we have seen dimS∆,k=n+k.
Hence it remains to show only that the functionsBi,−k≤i≤n−1, are linearly independent on [a, b].
Assume "n−1
i=−kaiBi(x) = 0 for all x∈[a, b]. Consider the first subin- terval [x0, x1]. Then
0 i=−k
aiBi(x) = 0 forx∈[x0, x1]
because Bi|[x0, x1] = 0 fori ≥1 by Theorem (2.4.4.5)(a). We now prove thatB−k,. . .,B0are linearly independent on [x0, x1], which impliesa−k = a−k+1=· · ·=a0= 0.
We claim that forx∈[x0, x1]
span{B−k(x), . . . , B0(x)}= span{(t1−x)k+1−s1, . . . ,(tk+1−x)k+1−sk+1}, if the number tj occurs exactly sj times in the sequence t−k ≤t−k+1 ≤
· · · ≤tj. This is easily seen by induction since by (2.4.4.2), (2.4.4.4a) each Bi(x),−k≤i≤0, has the form
Bi(x) =α1(t1−x)k+1−s1+· · ·+αi+k+1(ti+k+1−x)k+1−si+k+1, whereαi+k+1= 0.
Therefore it suffices to establish the linear independence of the functions (t1−x)k−(s1−1), . . . , (tk+1−x)k−(sk+1−1)
on [x0, x1], or equivalently, of the normalized functions (2.4.4.7) p(sj−1)(tj−x), j= 1,2, . . . , k+ 1, defined by
p(t) := 1 k!tk.
To prove this, assume for some constantsc1,c2,. . .,ck+1
k+1
j=1
cjp(sj−1)(tj−x) = 0 for allx∈[x0, x1].
Then by Taylor expansion the polynomial
k+1
j=1
cj k
l=0
p(l+sj−1)(tj)(−x)l
l! = 0 on [x0, x1]
vanishes on [x0, x1] and therefore must be the zero polynomial, so that for alll= 0, 1,. . . k
k+1
j=1
cjp(l+sj−1)(tj) = 0.
But this means that
k+1
j=1
cjΠ(sj−1)(tj) = 0,
whereΠ(t) is the row vector Π(t) : =
p(k)(t), p(k−1)(t), . . . , p(t)
=
1, t, . . . ,tk k!
.
However the vectors Π(sj−1)(tj), j = 1, 2, . . ., k+ 1, are linearly independent [see Corollary (2.1.5.5)] because of the unique solvability of the Hermite interpolation problem with respect to the sequencet1≤t2 ≤
· · · ≤tk+1. Hencec1=· · ·=ck+1= 0 and therefore alsoai= 0 fori=−k,
−k+ 1,. . ., 0.
Repeating the same reasoning for each subinterval [xj, xj+1], j= 1, 2, . . ., n−1, of [a, b] we find ai = 0 for all i =−k, −k+ 1, . . ., n−1, so that all Bi, −k ≤ i ≤ n−1, are linearly independent on [a, b] and their restrictions to [a, b] form a basis ofS∆,k. 2.4.5 The Computation of B-Splines
B-splines can be computed recursively. The recursions are based on a re- markable generalization of the Leibniz formula for the derivatives of the product of two functions. Indeed, in terms of divided differences, we find the following.
(2.4.5.1) Product Rule for Divided Differences.Supposeti≤ti+1≤
· · · ≤ti+k. Assume further that the function f(t) = g(t)h(t) is a product of two functions that are sufficiently often differentiable at t =tj, j =i, . . .,i+k, so thatg[ti, ti+1, . . . , ti+k]andh[ti, ti+1, . . . , ti+k] are defined by (2.4.4.1).Then
f[ti, ti+1, . . . , ti+k] =
i+k
r=i
g[ti, ti+1, . . . , tr]h[tr, tr+1, . . . , ti+k].
Proof.From (2.1.5.8) the polynomials i+k
r=i
g[ti, . . . , tr](t−ti)· · ·(t−tr−1)
and i+k
s=i
h[ts, . . . , ti+k](t−ts+1)· · ·(t−ti+k)
interpolate the functions g andh, respectively, at the pointst =ti, ti+1, . . .,ti+k (in the sense of Hermite interpolation, see Section 2.1.5, if thetj are not mutually distinct). Therefore, the product polynomial
F(t) :=
i+k r=i
g[ti, . . . , tr](t−ti)· · ·(t−tr−1)
·
i+k
s=i
h[ts, . . . , ti+k](t−ts+1)· · ·(t−ti+k)
also interpolates the functionf(t) att=ti,. . .,ti+k. This product can be written as the sum of two polynomials
F(t) =
i+k
r,s=i
· · ·=
r≤s
· · ·+
r>s
· · ·=P1(t) +P2(t).
Since each term of the second sum"
r>s is a multiple of the polynomial 4i+k
j=i(t−tj), the polynomialP2(t) interpolates the 0-function att=ti,. . ., ti+k. Therefore, the polynomialP1(t), which is of degree≤k, interpolates f(t) at t=ti, . . ., ti+k. Hence,P1(t) is the unique (Hermite-) interpolant off(t) of degree≤k.
By (2.1.5.8) the highest coefficient of P1(t) is f[ti, . . . , ti+k]. A com- parison of the coefficients of tk on both sides of the sum representation P1(t) ="
r≤s . . . ofP1 proves the desired formula f[ti, . . . , ti+k] =
i+k r=i
g[ti, . . . , tr]h[tr, . . . , ti+k].
Now we use (2.4.5.1) to derive a recursion for the B-splines Bi,r(x) ≡ Bi,r,t(x) (2.4.4.3). To do this, it will be convenient to renormalize the func- tionsBi,r(x), letting
Ni,r(x) := Bi,r(x)
ti+r−ti ≡fxr−1[ti, ti+1, . . . , ti+r], for which the following simple recursion holds:
Forr≥2 andti< ti+r:
(2.4.5.2) Ni,r(x) = x−ti
ti+r−ti Ni,r−1(x) + ti+r−x
ti+r−ti Ni+1,r−1(x).
Proof.Suppose firstx=tjfor allj. We apply rule (2.4.5.1) to the product fxr−1(t) = (t−x)r−1+ = (t−x)(t−x)r−2+ =g(t)fxr−2(t).
Noting thatg(t) is a linear polynomial intfor which by (2.1.4.3) g[ti] =ti−x, g[ti, ti+1] = 1, g[ti, . . . , tj] = 0 forj > i+ 1, we obtain
fxr−1[ti, . . . , ti+r] = (ti−x)fxr−2[ti, . . . , ti+r] + 1·fxr−2[ti+1, . . . , ti+r]
= (ti−x)
ti+r−ti(fxr−2[ti+1, . . . , ti+r]−fxr−2[ti, . . . , ti+r−1]) + 1·fxr−2[ti+1, . . . , ti+r]
= x−ti
ti+r−tifxr−2[ti, . . . , ti+r−1] + ti+r−x
ti+r−tifxr−2[ti+1, . . . , ti+r], and this proves (2.4.5.2) forx=ti,. . .,ti+r. The result is furthermore true for allxsince all Bi,r(x) are continuous from the right andti< ti+r The proof of (2.4.4.5), (b) can now be completed: By (2.4.5.2), the valueNi,r(x) is a convex linear combination ofNi,r−1(x) andNi+1,r−1(x) for ti < x < ti+r with positive weights λi(x) = (x−ti)/(ti+r−ti) > 0, 1−λi(x)>0. AlsoNi,r(x) andBi,r(x) have the same sign, and we already know thatBi,1(x) = 0 for x /∈[ti, ti+1] andBi,1(x)>0 forti < x < ti+1. Induction overrusing (2.4.5.2) shows thatBi,r(x)>0 forti< x < ti+r.
The formula
(2.4.5.3) Bi,r(x) = x−ti
ti+r−1−ti Bi,r−1(x) + ti+r−x
ti+r−ti+1 Bi+1,r−1(x) is equivalent to (2.4.5.2), and representsBi,r(x) directly as a positive linear combination of Bi,r−1(x) and Bi+1,r−1(x). It can be used to compute the values of all B-splinesBi,r(x) =Bi,r,t(x) for a given fixed value ofx.
To show this, letxbe given. Then there is atj ∈twithtj≤x < tj+1. By (2.4.4.5)a) we know Bi,r(x) = 0 for all i, r with x ∈ [ti, ti+r], i.e., for i ≤ j −r and for i ≥ j + 1. Therefore, in the following tableau of Bi,r :=Bi,r(x), theBi,r vanish at the positions denoted by 0:
(2.4.5.4)
0 0 0 0 . . .
0 0 0 Bj−3,4 . . .
0 0 Bj−2,3 Bj−2,4 . . . 0 Bj−1,2 Bj−1,3 Bj−1,4 . . . Bj,1 Bj,2 Bj,3 Bj,4 . . .
0 0 0 0 . . .
... ... ... ...
By definition Bj,1 = Bj,1(x) = 1 for tj ≤ x < tj+1, which determines the first column of (2.4.5.4). The remaining columns can be computed consecutively using recursion (2.4.5.3): Each elementBi,r can be derived from its two left neighbors,Bi,r−1 andBi+1,r−1
Bi,r−1 → Bi,r Bi+1,r−1
This method is numerically very stable because only nonnegative multiples of nonnegative numbers are added together.
Example.Forti=i,i= 0, 1,. . . andx= 3.5∈[t3, t4] the following tableau of valuesBi,r=Bi,r(x) is obtained.
r = 1 2 3 4
i = 0 0 0 0 1/48
i = 1 0 0 1/8 23/48
i = 2 0 1/2 6/8 23/48
i = 3 1 1/2 1/8 1/48
i = 4 0 0 0 0
For instance,B2,4 is obtained from B2,4 =B2,4(3.5) =3.5−2
5−2 ·6
8+6−3.5 6−3 ·1
8= 23 48.
We now consider the interpolation problem for spline functions, namely the problem of finding a splineS that assumes prescribed values at given locations. We may proceed as follows. Assume thatr≥1 is an integer and t= (ti)1≤i≤N+r a finite sequence of real numbers satisfying
t1≤t2≤ · · · ≤tN+r
andti< ti+r fori= 1, 2, . . .,N. Denote byBi(x)≡Bi,r,t(x),i= 1,. . ., N, the associated B-splines, and by
Sr,t = N i=1
αiBi(x)|αi∈IR 5
,
the vector space spanned by the Bi, i = 1, . . ., N. Further, assume that we are givenN pairs (ξj, fj),j= 1, . . .,N, of interpolation points with
ξ1< ξ2<· · ·< ξN.
These are the data for the interpolation problem of finding a functionS∈ Sr,t satisfying
(2.4.5.5) S(ξj) =fj, j= 1, . . . , N.
Since anyS∈ Sr,t can be written as a linear combination of theBi,i= 1, . . .,N, this is equivalent to the problem of solving the linear equations (2.4.5.6)
N i=1
αiBi(ξj) =fj, j= 1, . . . , N.
The matrix of this system
A=
B1(ξ1) . . . BN(ξ1)
... ...
B1(ξN) . . . BN(ξN)
has a special structure:A is a band matrix, because by (2.4.4.5) the func- tionsBi(x) =Bi,r,t(x) have support [ti, ti+r], so that within thejth row of Aall elementsBi(ξj) withti+r< ξjorti> ξj are zero. Therefore, each row ofA contains at most relements different from 0, and these elements are in consecutive positions. The componentsBi(ξj) ofAcan be computed by the recursion described previously. The system (2.4.5.6), and thereby the interpolation problem, is uniquely solvable if A is nonsingular. The non- singularity ofAcan be checked by means of the following simple criterion due to Schoenberg and Whitney (1953), which is quoted without proof.
(2.4.5.7) Theorem.The matrix A= (Bi(ξj))of (2.4.5.6) is nonsingular if and only if all its diagonal elementsBi(ξi)= 0are nonzero.
It is possible to show [see Karlin (1968)] that the matrix A is totally positive in the following sense: allr×rsubmatricesB ofAof the form
B= (aip,jq)rp,q=1 with r≥1, i1< i2<· · ·< ir, j1< j2<· · ·< jr, have a nonnegative determinant, det(B) ≥ 0. As a consequence, solving (2.4.5.6) for nonsingular A by Gaussian elimination without pivoting is numerically stable [see de Boor and Pinkus (1977)]. Also the band structure ofAcan be exploited for additional savings.
For further properties of B-Splines, their applications, and algorithms the reader is referred to the literature, in particular to de Boor (1978), where one can also find numerousfortranprograms.