0% found this document useful (0 votes)
16 views6 pages

Spline

Chapter III discusses cubic spline interpolation, which involves piecewise cubic functions connecting given data points. It outlines the conditions for constructing cubic splines, including continuity and boundary conditions, and provides a method for determining the coefficients of the cubic polynomials. The chapter also presents examples and theorems related to natural and clamped spline interpolants.

Uploaded by

dmsujithdd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

Spline

Chapter III discusses cubic spline interpolation, which involves piecewise cubic functions connecting given data points. It outlines the conditions for constructing cubic splines, including continuity and boundary conditions, and provides a method for determining the coefficients of the cubic polynomials. The chapter also presents examples and theorems related to natural and clamped spline interpolants.

Uploaded by

dmsujithdd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter III

Interpolation

3.0.1 Cubic Spline interpolation


In cubic spline interpolation, the interpolation function is a set of piecewise cubic functions. Specifically,
we assume that the points (xi , yi ) and (xi+1 , yi+1 ) are joined by a cubic polynomial Si (x) = ai x3 + bi x2 +
ci x + di that is valid for xi ≤ x ≤ xi+1 for i = 1, 2, ..., n − 1. To find the interpolation function, we must
first determine the coefficients ai , bi , ci , di for each of the cubic functions. For n points, there are n − 1
cubic functions to find, and each cubic function requires four coefficients. Therefore we have a total of
4(n − 1) unknowns, and so we need 4(n − 1) independent equations to find all the coefficients.

Definition 3.0.1 Given a function f defined on [a, b] and a set of nodes a = x0 < x1 < ... < xn = b, a
cubic spline interpolant S for f is a function that satisfies the following conditions:

a). S(x) is a cubic polynomial, denoted Sj (x), on the subinterval [xj , xj+1 ] for each j = 0, 1, ..., n − 1;
b). (interpolating data) Sj (xj ) = f (xj ) and Sj (xj+1 ) = f (xj+1 ) for each j = 0, 1, ..., n − 1;
c). (continuity at interior points) Sj+1 (xj+1 ) = Sj (xj+1 ) for each j = 0, 1, ..., n − 2; (Implied by (b).)
0
d). (continuous slope at interior points) Sj+1 (xj+1 ) = Sj0 (xj+1 ) for each j = 0, 1, ..., n − 2;
00
e). (continuous curvature at interior points) Sj+1 (xj+1 ) = Sj00 (xj+1 ) for each j = 0, 1, ..., n − 2;
f). One of the following sets of boundary conditions is satisfied:
– S 00 (x0 ) = S 00 (xn ) = 0(natural (or free) boundary);
– S 0 (x0 ) = f 0 (x0 ) and S 0 (xn ) = f 0 (xn ) (clamped boundary).

Although cubic splines are defined with other boundary conditions, the conditions given in (f ) are suf-
ficient for our purposes. When the free boundary conditions occur, the spline is called a natural spline,
and its graph approximates the shape that a long flexible rod would assume if forced to go through the
data points (x0 , f (x0 )), (x1 , f (x1 )), ..., (xn , f (xn )).

In general, clamped boundary conditions lead to more accurate approximations because they include more
information about the function. However, for this type of boundary condition to hold, it is necessary to

24
25

have either the values of the derivative at the endpoints or an accurate approximation to those values.

Construct a natural cubic spline that passes through the points (1, 2), (2, 3), and (3, 5). Solution This
spline consists of two cubics.The nodes are x0 = 1, x1 = 2, x2 = 3 and
f (x0 ) = 2, f (x1 ) = 3, f (x2 ) = 5.

This spline consists of two cubic The first for the interval [1, 2], denoted
S0 (x) = a0 + b0 (x − 1) + c0 (x − 1)2 + d0 (x − 1)3 ,
and the other for [2, 3], denoted
S1 (x) = a1 + b1 (x − 2) + c1 (x − 2)2 + d1 (x − 2)3

There are 8 constants to be determined, which requires 8 equations.

The cubic splines must agree with the data at the nodes:

Sj (xj ) = f (xj )
and
Sj (xj+1 ) = f (xj+1 )
for j = 0, 1. Hence we have for equations,
S0 (1) = f (1) =⇒ a0 = 2 (3.1)
S0 (2) = f (2) =⇒ a0 + b0 + c0 + d0 = 3 (3.2)
S1 (2) = f (2) =⇒ a1 = 3 (3.3)
S1 (3) = f (3) =⇒ a1 + b1 + c1 + d1 = 5 (3.4)
Now as the first derivatives at the interior nodes must be equal and the second derivatives at the interior
nodes must be equal:
S00 (2) = S10 (2) and S000 (2) = S100 (2).

S000 (2) = S100 (2) =⇒ b0 + 2c0 + 3d0 = b1 (3.5)


S000 (2) = S000 (2) =⇒ 2c0 + 6d0 = 2c1 (3.6)
The final two come from the natural boundary conditions:

S000 (1) = S100 (3) = 0

S000 (1) = 0 =⇒ 2c0 = 0 (3.7)


S000 (3) = 0 =⇒ 2c1 + 6d1 = 0 (3.8)

Solving these equations [2.8-2.15], for a0 , b0 , c0 , d0 , a1 , b1 , c1 , d1 we have


3 1 3 3 1
a0 = 2, b0 = , c0 = 0, d0 = , a1 = 3, b1 = , c1 = , d1 = −
4 4 2 4 4
Therefore, the cubic polynomial S for the given data set is
S(x)= (
S0 (x) = 2 + 34 (x − 1) + 14 (x − 1)3 If x ∈ [1, 2]
S1 (x) = 3 + 23 (x − 2) + 34 (x − 2)2 − 14 (x − 2)3 If x ∈ [2, 3].
26 CHAPTER III. INTERPOLATION

3.0.2 Construction of a Cubic Spline


As the preceding example demonstrates, a spline defined on an interval that is divided into n subintervals
will require determining 4n constants. To construct the cubic spline interpolant for a given function f ,
the conditions in the definition are applied to the cubic polynomials

Sj (x) = aj + bj (x − xj ) + cj (x − xj )2 + dj (x − xj )3 ,
for each j = 0, 1, ..., n − 1. Since Sj (xj ) = aj = f (xj ), condition (c) can be applied to obtain

aj+1 = Sj+1 (xj+1 ) = Sj (xj+1 ) = aj + bj (xj+1 − xj ) + cj (xj+1 − xj )2 + dj (xj+1 − xj )3 ,


for each j = 0, 1, ..., n − 2
The terms xj+1 − xj are used repeatedly in this development, so it is convenient to introduce the simpler
notation
hj = xj+1 − xj ,
for each j = 0, 1, ..., n − 1
we also define an = f (xn ), then the equation
aj+1 = aj + bj hj + cj h2j + dj h3j holds for each j = 0, 1, ..., n − 1. (3.9)

In a similar manner, define bn = S 0 (xn ) and observe that

Sj0 (x) = bj + 2cj (x − xj ) + 3dj (x − xj )2


implies Sj0 (xj ) = bj , for each j = 0, 1, ..., n − 1. Applying condition (d) gives

bj+1 = bj + 2cj hj + 3dj h2j , f or each j = 0, 1, ..., n − 1. (3.10)

Another relationship between the coefficients of Sj is obtained by defining cn = S 00 (xn )/2 and applying
condition (e). Then, for each j = 0, 1, ..., n − 1,
cj+1 = cj + 3dj hj . (3.11)

Solving for dj in the above Eq 3.11 and substituting this value into Eqs. 3.9 and 3.10 gives, for each
j = 0, 1, ..., n − 1, the new equations

h2j
aj+1 = aj + bj hj + (2cj + cj+1 ) (3.12)
3
and
bj+1 = bj + hj (cj + cj+1 ). (3.13)
The final relationship involving the coefficients is obtained by solving the appropriate equation in the last
form of equation 3.12, first for bj ,

1 hj
bj = (aj+1 − aj ) − (2cj + cj+1 ) (3.14)
hj 3
and then, with a reduction of the index, for bj−1 . This gives

1 hj−1
bj−1 = (aj − aj−1 ) − (2cj−1 + cj )
hj−1 3
Substituting these values into the equation derived from Eq 3.13, with the index reduced by one, gives
the linear system of equations

3 3
hj−1 cj−1 + 2(hj−1 + hj )cj + hj cj+1 = (aj+1 − aj ) − (aj − aj−1 ), (3.15)
hj hj−1
for each j = 1, 2, ..., n − 1. This system involves only the cj nj=0 as unknowns. The values of {hj }n1
j=0
and {aj }nj=0 are given, respectively, by the spacing of the nodes {xj }nj=0 and the values of f at the
nodes.So once the values of {cj }nj=0 are determined, it is a simple matter to find the remainder of the
constants {bj }n−1 n−1
j=0 from Eq. 3.14 and {dj }j=0 from Eq.3.11. Then we can construct the cubic polynomials
{Sj (x)}n−1
j=0
27

Theorem 3.0.1 If f is defined at a = x0 < x1 < ... < xn = b, then f has a unique natural spline
interpolant S on the nodes x0 , x1 , ..., xn ; that is, a spline interpolant that satisfies the natural boundary
conditions S 00 (a) = 0 and S 00 (b) = 0.

Proof 3.0.1 The boundary conditions in this case imply that cn = S 00 (xn )/2 = 0 and that

0 = S(x0 ) = 2c0 + 6d0 (x0 − x0 ),

so c0 = 0. The two equations c0 = 0 and cn = 0 together with the equations in 3.13 produce a linear system
described by the vector equation Ax = b, where A is the (n + 1) × (n + 1) matrix

The matrix A is strictly diagonally dominant, that is, in each row the magnitude of the diagonal entry
exceeds the sum of the magnitudes of all the other entries in the row. Hence the proof.

Theorem 3.0.2 If f is defined at a = x0 < x1 < ... < xn = b and differentiable at a and b,then f has a
unique clamped spline interpolant S on the nodes x0 , x1 , . . . , xn ; that is, a spline interpolant that satisfies
the clamped boundary conditions S 0 (a) = f 0 (a) and S 0 (b) = f 0 (b).

Proof 3.0.2 Since f 0 (a) = S 0 (a) = S 0 (x0 ) = b0 , Eq. 3.14 with j = 0 implies
h0
f 0 (a) = 1
h0 (a1 − a0 ) − 3 (2c0 + c1 ). Consequently,

3
2h0 c0 + h0 c1 = (a1 − a0 ) − 3f 0 (a).
h0

Similarly,
f 0 (b) = bn = bn−1 + hn−1 (cn−1 + cn ),
so Eq. 3.14 with j = n − 1 implies that

an − an−1 hn−1
f 0 (b) = − (2cn−1 + cn ) + hn−1 (cn−1 + cn ) (3.16)
hn−1 3
an − an−1 hn−1
= + (cn−1 + 2cn ) (3.17)
hn−1 3

and
3
hn−1 cn−1 + 2hn−1 cn = 3f 0 (b) − (an − an−1 ).
hn−1
28 CHAPTER III. INTERPOLATION

Equations 3.13 together with the equations

3
2h0 c0 + h0 c1 = (a1 − a0 ) − 3f 0 (a)
h
and
3
hn−1 cn−1 + 2hn−1 cn = 3f 0 (b) − (an − an1 )
hn−1

determine the linear system Ax = b, where

This matrix A is also strictly diagonally dominant. Therefore, the linear system has a unique solution for
c0 , c1 , ..., cn .

Example 3.0.1 Use the data points (0, 1), (1, e), (2, e2 ), and (3, e3 ) to form a clamped spline S(x) that
approximates f (x) = ex on the interval [0, 3] . since f 0 (x) = ex ,so f 0 (0) = 1 and f 0 (3) = e3

we have n = 3, h0 = h1 = h2 = 1, a0 = 1, a1 = e, a2 = e2 , and a3 = e3 . This together with the information


that f 0 (0) = 1 and f 0 (3) = e3 gives the the matrix A and the vectors b and x with the forms

The vector-matrix equation Ax = b is equivalent to the system of equations

2c0 + c1 = 3(e − 2), (3.18)


2
c0 + 4c1 + c2 = 3(e − 2e + 1), (3.19)
3 2
c1 + 4c2 + c3 = 3(e − 2e + e), (3.20)
2
c2 + 2c3 = 3e . (3.21)
29

Solving this system simultaneously for c0 , c1 , c2 and c3 gives, to 5 decimal places

1
c0 = (2e3 − 12e2 + 42e − 59) = 0.44468, (3.22)
15
1
c1 = (4e3 + 24e2 − 39e + 28) = 1.26548, (3.23)
15
1
c2 = (14e3 − 39e2 + 24e − 8) = 3.35087, (3.24)
15
1
c3 = (7e3 + 42e2 − 12e + 4) = 9.40815. (3.25)
15
(3.26)

Solving for the remaining constants gives

b0 = 1.00000, b1 = 2.71016, b2 = 7.32652


and
d0 = 0.27360, d1 = 0.69513, d2 = 2.01909.

This gives the clamped cubic spline

S(x)=

2 3
S0 (x) = 1 + x + 0.44468x + 0.27360x ,
 If x ∈ [0, 1)
S1 (x) = 2.71828 + 2.71016(x − 1) + 1.26548(x − 1)2 + 0.69513(x − 1)3 , If x ∈ [1, 2).

S2 (x) = 7.38906 + 7.32652(x − 2) + 3.35087(x − 2)2 + 2.01909(x − 2)3 , If x ∈ [2, 3].

3.0.3 Error
An error-bound formula for the cubic spline with clamped boundary conditions is given in following
theorem.

Theorem 3.0.3 Let f ∈ C 4 [a, b] with maxa≤b |f ( 4)(x)| = M. If S is the unique clamped cubic spline
interpolant to f with respect to the nodes a = x0 < x1 < ... < xn = b,then for all x ∈ [a, b],

5M
|f (x) − S(x)| ≤ max (xj+1 − xj )4 .
384 0≤j≤n−1

A fourth-order error-bound result also holds in the case of natural boundary conditions, but it is more
difficult to express.

Example 3.0.2 Let’s compute the error bound for the previous example using the Theorem. Since f (x) =
e4 , f 4 (x) = ex .Alsoex is an increasing function. Therefore maximum occurs at the right end point. Thus

M = max |f 4 (x)| = e3
0≤x≤3

The nodes are equally spaced. Therefore,

max(xj+1 − xj )4 = 1.

Thus,
5M 5e3
|f (x) − S(x)| ≤ max (xj+1 − xj )4 = (1) = 0.26153.
384 0≤j≤n−1 384

You might also like