0% found this document useful (0 votes)
55 views4 pages

17 Cubic Spline Interpolation 01 Feb 2019reference Material I - MAT3005 - SplineInterpolation

The document discusses cubic spline interpolation, which uses piecewise cubic polynomials to interpolate data points. Cubic splines are continuous and smooth, making them popular for interpolation. The key steps are: (1) the interval is divided into subintervals, (2) a cubic polynomial is constructed for each subinterval, (3) the polynomials are required to be continuous up to the second derivative to ensure smoothness. The process results in a system of equations that can be solved to determine the polynomials for each subinterval. An example problem is worked out to demonstrate the method.

Uploaded by

Hrithik Rathi
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)
55 views4 pages

17 Cubic Spline Interpolation 01 Feb 2019reference Material I - MAT3005 - SplineInterpolation

The document discusses cubic spline interpolation, which uses piecewise cubic polynomials to interpolate data points. Cubic splines are continuous and smooth, making them popular for interpolation. The key steps are: (1) the interval is divided into subintervals, (2) a cubic polynomial is constructed for each subinterval, (3) the polynomials are required to be continuous up to the second derivative to ensure smoothness. The process results in a system of equations that can be solved to determine the polynomials for each subinterval. An example problem is worked out to demonstrate the method.

Uploaded by

Hrithik Rathi
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/ 4

MAT3005 – Applied Numerical Methods Dr.

BSRV Prasad
Lecture Notes: Cubic Spline Interpolation Department of Mathematics, SAS, VIT, Vellore

Introduction

• So far we have discussed how an interpolation polynomial of degree n can be constructed and
used if a set of values of function are given.
• There are situations in which this approach is likely to face problems and produced incorrect
estimates.
• This is because the interpolation takes a global rather than a local view of data.
• It has been proved that when n is large compared to the order of the “true” function, the inter-
polation polynomial of degree n does not provide accurate results at the end of the range.
• Thus, increasing the order of polynomials does not necessarily increase the accuracy.
• To overcome this problem, one can divide the entire range into subintervals and use local low-
order polynomials to interpolate each subinterval.
• These local polynomials are called piecewise polynomials, which are continuous in the subin-
terval and discontinuous at the interpolating points.
• We can construct piecewise polynomials such that they are continuous at the interpolating points
also.
• This type of polynomials are called Spline polynomials.
• The concept of splines originated from the mechanical drafting tool called “spline” used by
designers for drawing smooth curves.
• The connection points are called knots or nodes.

Definition. A spline function of degree n over the interval [x0 , xn ] with knots (nodes) xi , i =
0, 1, 2, . . . , n is a function S(x) with the properties:
(i) si (x) is a polynomial of degree at most n in each of the subintervals [xi−1 , xi ], 1 ≤ i ≤ n.
(ii) si (x) and its derivatives of orders 1, 2, . . . , n − 1 are continuous on [x0 , xn ].
The set of all polynomials form a spline interpolating polynomial if si (xi ) = f (xi ), for i =
0, 1, 2, . . . , n. The process of constructing such polynomials for a given set of function points is
known as spline interpolation.

Cubic Splines

• These curves are continuous and also have resemble cubic curves and hence the name cubic
splines.
• Cubic splines are popular because of their ability to interpolate data with smooth curves.

Definition. A Cubic spline function over the interval [x0 , xn ] with knots (nodes) xi , i = 0, 1, 2, . . . , n
is a function S(x) with the properties:
(i) si (x) is almost a cubic in each of the subintervals [xi−1 , xi ], 1 ≤ i ≤ n.
(ii) si (xi ) = yi , i = 0, 1, 2, . . . , n.

1
MAT3005 – Applied Numerical Methods Dr. BSRV Prasad
Lecture Notes: Cubic Spline Interpolation Department of Mathematics, SAS, VIT, Vellore

(iii) si (x), s0i (x) and s00i (x) are continuous on [x0 , xn ], and
(iv) s00i (x0 ) = s00i (xn ) = 0.
To derive the governing equations of the cubic spline interpolating polynomial, we observe that the
cubic spline second derivatives must be linear. Hence we have in [xi−1 , xi ]:
1
s00i (x) = [(xi − x)Mi−1 + (x − xi−1 )Mi ]
hi
where hi = xi − xi−1 and s00i (xi ) = Mi for all i.

Now, integrating the above twice with respect to x, we obtain


1 (xi − x)3 (x − xi−1 )3
 
si (x) = Mi−1 + Mi + ci (xi − x) + di (x − xi−1 )
hi 6 6
The constants ci and di can be determined by using the conditions si (xi−1 ) = f (xi−1 ) = yi−1 and
si (xi ) = f (xi ) = yi . Mi ’s can obtained by using continuity condition of s0i (x).

The cubic spline interpolating polynomial si (x) in the interval [xi−1 , xi ] is then given by
h2i
 
1  3 3
 1
si (x) = (xi − x) Mi−1 + (x − xi−1 ) Mi + fi−1 − Mi−1 (xi − x)
6hi hi 6
2
 
1 h
+ fi − i Mi (x − xi−1 ) (1)
hi 6
The Mi ’s can be found from the following relations:
 
fi+1 − fi fi − fi−1
hi Mi−1 + 2(hi + hi+1 )Mi + hi+1 Mi+1 = 6 − (2)
hi+1 hi
For equal intervals, hi = hi+1 = h and hence the above equations reduces to:
h2
 
1  3 3
 1
si (x) = (xi − x) Mi−1 + (x − xi−1 ) Mi + fi−1 − Mi−1 (xi − x)
6h h 6
2
 
1 h
+ fi − Mi (x − xi−1 ) (3)
h 6
and
6
Mi−1 + 4Mi + Mi+1 = (fi+1 − 2fi + fi−1 ) (4)
h2
(Here Mi = s00 (xi )).

This gives a system of n − 1 linear equations in n + 1 unknowns M0 , M1 , M2 , . . . , Mn . Therefore to


solve this system, we require two additive conditions on M0 and Mn , which may be taken in one of
the following forms:
(i) M0 = Mn = 0 (A spline satisfying these conditions is called a natural spline).
(ii) M0 = Mn , M1 = Mn+1 , f0 = fn+1 , h1 = hn+1 (A spline satisfying these conditions is called a
periodic spline).
(iii) For a non-periodic spline, we take the conditions: s0i (a) = f 0 (a) = f00 ; s0i (b) = f 0 (b) = fn0 .

2
MAT3005 – Applied Numerical Methods Dr. BSRV Prasad
Lecture Notes: Cubic Spline Interpolation Department of Mathematics, SAS, VIT, Vellore

Problem. Obtain the cubic spline approximation for the function given in the tabular form:
x 0 1 2 3
f (x) 1 2 33 244
and M0 = M3 = 0.

Solution. Since n = 4, we have three intervals and three cubics and, therefore only M1 , M2 are to be
determined.
Case (i):
i = 1, h = 1 =⇒ M0 + 4M1 + M2 = 6(f2 − 2f1 + f0 ) (5)
Case (ii):
i = 2, h = 1 =⇒ M1 + 4M2 + M3 = 6(f3 − 2f2 + f1 ) (6)
Since M0 = M3 = 0, from (9) and (10) we have

4M1 + M2 = 6(33 − 2 × 2 + 1) = 180 (7)


M1 + 4M2 = 6(244 − 2 × 33 + 2) = 1080 (8)

Solving the above two equations we obtain M1 = −24 and M2 = 276.


Now in the interval [0, 1] we have i = 1, h = 1 and required cubic spline is:
   
1 3 3
 1 1
s1 (x) = (x1 − x) M0 + (x − x0 ) M1 + 1(x1 − x) f0 − M0 + 1(x − x0 ) f1 − M1
6 6 6
 
1 24
(x − 0)3 (−24) + (1 − x)(1 − 0) + (x − 0) 2 +

=
6 6
3
= −4x + 5x + 1

Now in the interval [1, 2] we have i = 2, h = 1 and required cubic spline is:
   
1 3 3
 1 1
s2 (x) = (x2 − x) M1 + (x − x1 ) M2 + 1(x2 − x) f1 − M1 + 1(x − x1 ) f2 − M2
6 6 6
   
1 24 276
(2 − x)3 (−24) + (x − 1)3 (276) + (2 − x) 2 +

= + (x − 1) 33 −
6 6 6
3 2
= 50x − 162x + 167x − 53

Finally, in the interval [2, 3] we have i = 3, h = 1 and required cubic spline is:
   
1 3 3
 1 1
s3 (x) = (x3 − x) M2 + (x − x2 ) M3 + 1(x3 − x) f2 − M2 + 1(x − x2 ) f3 − M3
6 6 6
 
1 276
(3 − x)3 (276) + (3 − x) 33 −
 
= + (x − 2)(244)
6 6
= −46x3 + 414x2 − 985x + 715

3
MAT3005 – Applied Numerical Methods Dr. BSRV Prasad
Lecture Notes: Cubic Spline Interpolation Department of Mathematics, SAS, VIT, Vellore

Problem. Given the table of values


i 0 1 2 3
xi 1 2 3 4
f (x) 0.5 0.3333 0.25 0.20
estimate the value of f (2.5) and f (3.5) using cubic spline interpolation.

Solution. The points are equally spaced and hence h = 1. Since n = 4, we have three intervals and
three cubics and, therefore only M1 , M2 are to be determined.
Case (i):
i = 1, h = 1 =⇒ M0 + 4M1 + M2 = 6(f2 − 2f1 + f0 ) (9)
Case (ii):
i = 2, h = 1 =⇒ M1 + 4M2 + M3 = 6(f3 − 2f2 + f1 ) (10)
Since M0 = M3 = 0, from (9) and (10) we have

4M1 + M2 = 6(0.25 − 2 × 0.3333 + 0.5) = 0.5004 (11)


M1 + 4M2 = 6(0.2 − 2 × 0.25 + 0.3333) = 0.1998 (12)

Solving the above two equations we obtain M1 = 0.1201 and M2 = 0.0199.

Now the target point x = 2.5 lies in the domain of s2 (x).


   
1 3 3
 1 1
s2 (x) = (x2 − x) M1 + (x − x1 ) M2 + 1(x2 − x) f1 − M1 + 1(x − x1 ) f2 − M2
6 6 6
 
1 0.1201
(3 − x)3 (0.1201) + (x − 2)3 (0.0199) + (3 − x) 0.3333 −

=
6 6
 
0.0199
+ (x − 2) 0.25 −
6

Now s2 (2.5) = 0.2829.

Now the target point x = 3.5 lies in the domain of s3 (x).


   
1 3 3
 1 1
s3 (x) = (x3 − x) M2 + (x − x2 ) M3 + 1(x3 − x) f2 − M2 + 1(x − x2 ) f3 − M3
6 6 6
 
1 0.0199
(4 − x)3 (0.0199) + (4 − x) 0.25 −

= + (x − 3)(0.20)
6 6

Now s3 (3.5) = 0.2238.

You might also like