Sei sulla pagina 1di 33

CHAPTER IV

POLYNOMIAL INTERPOLATION
AND SPLINES DATA FITTING
Nabil R. Nassif and Dolly K. Fayad
April 2010

Introduction

Consider a set Dn of n + 1 data points in the (x, y) plane:


Dn = {(xi , yi )| i = 0, 1 ..., n; n IN with xi 6= xj f or i 6= j},

(1)

We assume that this data represents an unknown function y = f (x), such that
yi = f (xi ). Our basic objective in this chapter is to look for a suitable and
convenient polynomial approximation of the function f allowing to obtain
f (x), x 6= xi , and that takes on the corresponding values of yi for each of the
n + 1 distinct xi s in Dn . Such a polynomial is said to interpolate the data
Dn , and the points xi are called nodes of the interpolation.
An interpolating polynomial can be written in a variety of forms. Among these,
are known the Lagrange, the Newton and the Neville forms that we shall consider consecutively in this chapter.

General Lagrange Polynomial Interpolation

Assume we are given the set (??), with increasing x-data, i.e. x0 < x1 <
... < xn . Let also hi = xi xi1 , i 1. We state now the basic Lagrange
Interpolation theorem.
Theorem 1 There exists a unique polynomial of degree less than or equal to n,
pn (x) = p01...n (x), such that pn (xi ) = yi , i = 0, 1, ..., n.
Proof. The proof of this theorem is based on the Lagrangian cardinal basis
associated with Dn given by:
Ln = {li (x) : 0 i n}
where the cardinal functions li are special polynomials of degree n in IPn
(set of all polynomials of degree less than or equal to n). They are defined as
follows:
Q
(x x0 )(x x1 )...(x xi1 )(x xi+1 )...(x xn )
0j6=in (x xj )
=
li (x) = Q
(x

x
)
(x
i
j
i x0 )(xi x1 )...(xi xi1 )(xi xi+1 )...(xi xn )
0j6=in
(2)
Once the cardinal functions (??) are available, we can interpolate any function
f by Lagrange form of the interpolation polynomial:
p01...n (x) =

n
X

li (x)f (xi ).

(3)

i=0

Obviously then, the following properties are satisfied by the defined polynomials:
2


- li (xj ) = ij =

0 if i 6= j
1 if i = j

- p01...n (xi ) = yi i = 0, 1, . . . , n
The definition of the Lagrange polynomial above is enough to establish the
existence part of Theorem ??.
To establish the uniqueness of such a polynomial p01...n , we suppose that another
polynomial q of degree at most n, claims to accomplish what p does; that is q
also satisfies q(xi ) = yi for 0 i n. Then the polynomial (p01...n q) is of
degree at most n and takes on the value 0 at x0 , x1 , . . . , xn . Recall however
that a non-zero polynomial of degree n can have at most n roots. We conclude
then that (p01...n q) = 0, and that p01...n = q, which establishes the uniqueness
of p01...n .
Example 1 Write out the cardinal functions appropriate to the problem of interpolating the following data D2 = { (1/4, 1), (1/3, 2), (1, 7)}.
Using equation (??), we have:
(x 31 )(x 1)
1
= 16(x )(x 1)
1
1 1
3
( 4 3 )( 4 1)

l0 (x) =
l1 (x) =

(x 14 )(x 1)
1
= 18(x )(x 1)
4
( 13 41 )( 13 1)

(x 31 )(x 14 )
1
1
1
1 = 2(x 3 )(x 4 )
(1 3 )(1 4 )
Therefore, the interpolating polynomial in Lagranges form is:
1
1
1
1
349
79
p012 (x) = 36(x )(x1)16(x )(x1)+14(x )(x ) = 38x2 +
x
4
3
3
4
6
6
This form of the polynomial might be useful in computing f (x) in the vicinity
of the nodes 1/3, 1/4, 1.
l2 (x) =

Example 2 Consider the following table of data associated with the function
f (x) = log(x).
i
0
1
2
3
4
5

xi
1.0
1.5
2.0
3.0
3.5
4.0

yi
0
0.17609
0.30103
0.47712
0.54407
0.60206
3

Use Lagrange polynomials of orders 1,2 then 3 to approximate f (1.2), noting


that the exact value is log(1.2) = 0.0791812460476480.
- Linear Interpolation based on the points {x0 , x1 }.
Using (??), one has:
p01 (x) = y0 l0 (x) + y1 l1 (x) = 0

x 1.5
x 1.0
+ 0.17609
1.0 1.5
1.5 1.0

Thus p01 (1.2) = 0.070436, meaning that the approximation is exact up to




1 significant figure, and the relative error is log(1.2)0.070436
< 0.51011 .
log(1.2)
- Quadratic interpolation based on the points {x0 , x1 , x2 }.
p012 (x) = y0 l0 (x) + y1 l1 (x) + y2 l2 (x) = 0
+0.17609

(x 1.5)(x 2)
+
(1.0 1.5)(1.0 2)

(x 1.0)(x 1.5)
(x 1.0)(x 2)
+ 0.30103
(1.5 1.0)(1.5 2)
(2 1.0)(2 1.5)

Thus p012 (1.2) = 0.076574, which practically remains correct up to 1 significant figure, although the relative error of 3.292757102 < 0.51012 .
- Cubic interpolation based on the points {x0 , x1 , x2 , x3 }.
To implement a 3rd degree interpolation, we may repeat the process and
construct the consequent cardinal Lagrangian basis in IP3 , {l1 , l2 , l3 } leading to a cubic interpolating polynomial.
Note that p01...k (x) with k < n, cannot be obtained from p01...k1 (x). The
cardinal functions of the latter are in Pk1 , while those of the former are polynomials in Pk .

Newtons Interpolating Polynomial

The Lagrange interpolation formula proves the existence of an interpolating


polynomial for any given table of values. There are other ways of constructing
this polynomial, and leading to different formulas. The second form discussed
in this chapter which is inherently recursive, is called Newtons interpolating
form.

3.1

Newtons form and Divided Differences

To construct Newtons polynomial interpolating the data Dn (??), we use an


inductive procedure. In this view, we suppose that we have succeeded in finding
a polynomial p that reproduces part of the data in(??), that is we assume that
p(xi ) = yi for 0 i k with k < n. We shall attempt to add to p another term
that will enable us to reproduce one more entry in the table. So we consider:
p(x) = p(x) + C(x x0 )(x x1 ) (x xk )
where C is the constant to be determined.
Note that p(x) is surely a polynomial reproducing the first k points in the table
since: p(xi ) = p(xi ) = yi i = 0, 1, . . . , k, (the added portion takes the value of
0 at each of the points xi , for i = 0, 1, . . . , k). Now we adjust the parameter C
imposing p(xk+1 ) = yk+1 . That is:
p(xk+1 ) = p(xk+1 ) + C(xk+1 x0 )(xk+1 x1 ) . . . (xk+1 xk ) = yk+1
The proper value of C can then be obtained from this equation.
Through this inductive reasoning, the process can be started and it can be continued till all the given entries of Dn are reproduced. Thus, p01...k is obtained
from p01...k1 , by adding one more term, without altering the coefficients already present in p01...k1 itself.
Note also that the degree of the polynomial increases by at most 1 in each step
of the inductive argument. So at the end, the degree is at most n.
Explicitly, the steps in this procedure are as follows:
(0)
(1)
(2)
..
.

p0 (x) = a0
p01 (x) = a0 + a1 (x x0 )
p012 (x) = a0 + a1 (x x0 ) + a2 (x x0 )(x x1 )

(n)

p01...n (x) = a0 + a1 (x x0 ) + a2 (x x0 )(x x1 ) +


+an1 (x x0 ) . . . (x xn2 ) + an (x x0 )(x x1 ) . . . (x xn1 )

The general equation being then:


p01...n (x) =

n
X
i=0

ai

i1
Y

(x xj )

j=0

we aim now at finding a way of systematically determining the unknown coefficients


a0 , a1 , . . . , an . By setting x equal in turn to x0 , x1 , . . . , xn in the equations
above, starting with (0), the coefficients are easily calculated.
5

For example, solving the equations above we obtain the following values:
(0)

a0 = y0

(1)

y1 = y0 + a1 (x1 x0 ) a1 =

(2)

y2 = y0 +

y1 y0
x1 x0

y1 y0
(x1 x0 )+a2 (x2 x0 )(x2 x1 ) a2 =
x1 x0

y2 y1
x2 x1

y1 y0
x1 x0

x2 x0

..
.
We see that a0 depends on f (x0 ), that a1 depends on f (x0 ) and f (x1 ), and
in general that ak depends on f (x0 ), f (x1 ), . . . f (xk ). We write then ak =
f [x0 , x1 , . . . , xk ], or equivalently ak = [x0 , x1 , . . . , xk ].
This new parameter ak is called the divided difference of order k for f .
It is defined as follows:
Definition 1 Given the set of data {(xi , yi = f (xi )| i = 0, 1, . . . , n} with
xi 6= xj for i 6= j,
- The 0th order divided difference is [xi ] = yi i = 0, 1, . . . , n.
- The 1st order divided difference is [xi , xi+1 ] =

yi+1 yi
xi+1 xi .

And recursively,
- The k th order divided difference is [xi , xi+1 , . . . , xi+k ] =

[xi+1 ,...,xi+k ][xi ,...,xi+k1 ]


xi+k xi

With this new notation, Newtons form of the interpolating polynomial


takes the form:
p01...n (x) =

n
X
i=0

ai

i1
Y

(x xj ) =

j=0

n
i1
X
Y
[x0 , x1 , . . . , xi ]
(x xj )
i=0

(4)

j=0

Equivalently:
p01...n (x) = [x0 ] + [x0 , x1 ](x x0 ) + [x0 , x1 , x2 ](x x0 )(x x1 ) +
+[x0 , x1 , x2 , . . . , xn ](x x0 )(x x1 ) . . . (x xn1 )
Note also that the divided difference is invariant with respect to the permutation of indices, that is:

Theorem 2 The Invariance theorem


The divided difference [xi , xi+1 , . . . , xi+k ] is invariant under all permutations of
the arguments xi0 , xi1 , . . . , xik , i.e.
[xi , xi+1 , . . . , xi+k ] = [xi0 , xi1 , . . . , xik ]
for any permutation {i0 , i1 , . . . , ik } of {i, i + 1, . . . , i + k}.
Proof. We give an informal proof with n = 2 for example.
[x0 , x1 , x2 ] = [x1 , x2 , x0 ], since the 1st divided difference is the coefficient of x2
in the quadratic polynomial interpolating f at x0 , x1 , x2 , whereas the 2nd one
is the coefficient of x2 in the quadratic polynomial interpolating f at x1 , x2 , x0 .
By the uniqueness property of the interpolating polynomial, these two polynomials are of course the same.

3.2

Implementation of Newtons form

The following Matlab pseudocode takes as input 2 vectors x and y of equal


length, and returns the Divided Difference table as a lower triangular matrix,
using the diff(.) operator. (Note that the diff function applied to a vector x
of length n produces the vector [(x(2)x(1)), (x(3)x(2)), ...., (x(n)x(n1))]
of length n 1).
function D = DiffTable(x,y)
n=length(x) ;
m=length(y) ;
if m==n
D=zeros(n,n) ;
D(1:n, 1) = y(1:n) ;
Y= D(1:n, 1) ;
for j=2: n
V1=x(1:n-j+1) ; V2=x(j:n) ;
D(j:n, j)= (diff(Y) ./ (V2-V1)) ;
Y=D(j:n, j) ;
end
end
We return to Example ?? to create first the Divided Difference Table associated with the given data:

D5 = {(1, 0) , (1.5, 0.17609) , (2.0, 0.30103) , (3, 0.47712) , (3.5, 0.54407) , (4, 0.60206)}.
i
0

xi
1.0

yi
0

1.5

0.17609

[., .]

[., ., .]

[., ., ., .]

[., ., ., ., .]

[., ., ., ., ., .]

0.35218
0.1023
0.24988
2

2.0

0.02655
0.0492

0.30103
0.17609

3.0

0.47712

3.5

0.54407

4.0

0.60206

0.006404
0.01054

0.02813
0.13390

0.001411
0.002172

0.00511
0.01792

0.11598
Let us consider approximations of f (x) for values of x at the top of the table,
for example x = 1.2, then at the middle of the table, as x = 2.5.(In general, one
can prove that the approximation-error is smaller for mid-values of x).

The 1st interpolating polynomials are successively as follows:


p01 (x) = 0 + 0.35218(x 1),
p012 (x) = p01 (x) 0.1023(x 1)(x 1.5),
p0123 (x) = p012 (x) + 0.02655(x 1)(x 1.5)(x 2),
p01234 (x) = p0123 (x) 0.006404(x 1)(x 1.5)(x 2)(x 3),
p012345 (x) = p01234 (x) + 0.001411(x 1)(x 1.5)(x 2)(x 3)(x 3.5).
As a result, approximations to log(1.2) = 0.0791812460476248 come as
follows:
p... (1.2)
Value
p01 (x)
0.070436
p012 (x)
0.076574
p0123 (x)
0.0778484
p01234 (x 0.07840171
p012345 (x) 0.0786821

Relative error
1.10446 101
3.2928 102
1.6833 102
9.845 103
6.30384 103

Hence, it appears clear that increasing the degree of the interpolation


polynomial does not seem to improve much the approximation of the ex8

act value of the function for values of x at the top of the table.

In order to get approximations to f (2.5), and using Theorem ??, we obtain successively linear, quadratic and cubic polynomials as follows:
p23 (x) = y2 + [x2 , x3 ](x x2 )
p231 (x) = p23 (x) + [x2 , x3 , x1 ](x x2 )(x x3 )
= p23 (x) + [x1 , x2 , x3 ](x x2 )(x x3 )
p2314 (x) = p231 (x) + [x2 , x3 , x1 , x4 ](x x2 )(x x3 )(x x1 )
= p231 (x) + [x1 , x2 , x3 , x4 ](x x2 )(x x3 )(x x1 )
p2310 (x) = p231 (x) + [x2 , x3 , x1 , x0 ](x x2 )(x x3 )(x x1 )
= p231 (x) + [x0 , x1 , x2 , x3 ](x x2 )(x x3 )(x x1 )
Another alternative starting with p23 would be:
p234 (x) = p23 (x) + [x2 , x3 , x4 ](x x2 )(x x3 )
p2345 (x) = p234 (x) + [x2 , x3 , x4 , x5 ](x x2 )(x x3 )(x x4 )
p2341 (x) = p234 (x) + [x2 , x3 , x4 , x1 ](x x2 )(x x3 )(x x4 )
= p234 (x) + [x1 , x2 , x3 , x4 ](x x2 )(x x3 )(x x4 )
This process can be carried through to obtain higher order interpolation
polynomials.
Numerically one gets the following results for the approximation of log(2.5) =
0.39794001:
p... (2.5)
Value
p23 (x)
0.389075
p234 (x) 0.3961067
p231 (x) 0.4013733
p2345 (x) 0.3973825
p2341 (x)
0.39874

Relative error
2.227725 102
4.6070814 103
8.62774435 103
1.4009867 103
2.0103315 103

3.3

Equi-spaced Data: Difference Operators

Consider the set of data Dn with equidistant xnodes


xi+1 xi = h, i = 0, 1, ..., n 1.
In this case, we can compute divided differences associated with Dn by using
the difference functions based on the ydata only. Specifically, we make the
following definitions:
Definition 2 Let Y = {yi : i = 0, 1, ...n}, then:
1. yi = yi+1 yi , i = 0, 1..., n 1, is the vector of n first order differences
associated with the n + 1 data set Y .
2. By recurrence, we may then define the following k th order difference operators for k = 2, 3, ...n:
k yi = k1 yi+1 k1 yi ,

i = 0, 1..., n k

Difference operators are linear. Besides, one easily shows that:


Theorem 3 In case the set of x-data in Dn is equi-spaced, then:
[xi , xi+1 , ..., xi+k ] =

k yi
.
hk k!

(5)

Proof. The proof is done by induction on k. After verifying the result for
k = 1, assume that it is true for 1, ..., k 1, i.e.:
[xi , xi+1 , ..., xi+k1 ] =

k1 yi
.
hk1 (k 1)!

Since,
[xi , xi+1 , ..., xi+k ] =

[xi+1 , ..., xi+k ] [xi , xi+1 , ..., xi+k1 ]


,
(xi+k xi )

then:
[xi , xi+1 , ..., xi+k ] =

k1 yi+1 k1 yi
k1 yi+1 k1 yi
=
.
hk1 (k 1)!(xi+k xi )
hk1 (k 1)! kh

Since, by definition:
k yi k1 yi+1 k1 yi ,
one reaches the required identity.

10

With this result,Newtons polynomial interpolating equi-spaced data is formulated as follows:


p01...n (x) = y0 +

n y 0
y0
2 y 0
(xx0 )(xx1 )+ +
(xx0 )(xx1 ) . . . (xxn1 )
(xx0 )+
2
1!h
2!h
n!hn

The result of the above theorem allows us therefore to compute divided difference tables by simply computing first differences as follows:
i
0

xi
x0

yi
y0

y0 = y1 y0
1

x1
x2

n2

xn2

yn2

n1

xn1

yn1

xn

yn

..
.

3 y0 = 2 y1 2 y0
y1 = y2 y1

y2 = y3 y2
x3

..
.

y2

3
..
.

2 y0 = y1 y0

y1
y1 = y2 y1

..
.
..
.

y3
..
.

..
.
..
.
..
.
..
.

..
.
..
.

n y 0

yn2 = yn1 yn2


2 yn2 = yn1 yn2
yn1 = yn yn1
..
.

11

..
.

Example 3 The following data are associated with 0-th order Bessels function
of the first kind.
i
0
1
2
3
4

xi
1.0
1.3
1.6
1.9
2.2

yi
0.7651977
0.6200860
0.4554022
0.2818186
0.1103623

Since the x-data are equally space with h = 0.3, the differences table can be
easily constructed out of this data:
i
0

xi
1.0

yi
0.7651977

1.3

0.6200860

y0 = 0.1451117
2 y0 = 0.0195721
3 y0 = 0.0106723

y1 = 0.1646838
2

1.6

y2 = 0.1735836
3

1.9

0.2818186

2.2

0.1103623

4 y0 = 0.0003548

y1 = 0.0088998

0.4554022

y1 = 0.0110271
2 y2 = 0.0021273

y3 = 0.1714563

Using this table, we may subsequently write any of the interpolation polynomials. For example:
p234 (x) = y2 +

y2
0.3 (x

x2 ) +

= 0.4554022

2 y2
(0.3)2 2! (x

0.1735836
(x
0.3

x2 )(x x3 )

1.6) +

0.0021273
(0.3)2 (x

1.6)(x 1.9)

p231 (x) = p23 (x)+[x2 , x3 , x1 ](xx2 )(xx3 ) = p23 (x)+[x1 , x2 , x3 ](xx2 )(xx3 )
2

y1
0.0088998
= p23 (x) + (0.3)
2 2! (x x2 )(x x3 ) = p23 (x) (0.3)2 2! (x 1.6)(1 1.9)

Nevilles Interpolation Polynomial

Another method for obtaining a polynomial interpolant from some set of data
Dn is given by Neville. It starts building the polynomial in steps, just as Newtons polynomial does. The polynomials are defined ecursively as follows:

12

- Constant Nevilles polynomials pi (x) = yi ; i = 0, 1, . . . n


- Linear Nevilles
polynomials




xxi+1
xxi
pi,i+1 (x) = xi+1
p
(x)

i+1
xi
xi+1 xi pi (x)
In generalfor i < j:


xx
i
pi,j (x) = xxx
pj (x) xj xji pi (x)
j xi
- Quadratic Nevilles
polynomials




xxi+2
xxi
p
(x)

pi,i+1,i+2 (x) = xi+2


i+1,i+2
xi
xi+2 xi pi,i+1 (x)
In general for
j < k:
 i<


xxi
k
pi,j,k (x) = xk xi pjk (x) xxx
pij (x)
k xi
- k theo order Nevilles
polynomials




xxi
i+k
pi,i+1,...,i+k (x) = xi+k xi pi+1,i+2,...,i+k (x) xxx
pi,...,i+k1 (x)
i+k xi
More generally, selecting nodes xi and xj with i < j, we may also define recursively:




x xi
x xj
pu...v (x) =
pu...,i1,i+1,...v (x)
pu...,j1,j+1,...v (x)
xi xj
xi xj
It is easy to verify the interpolating properties:
pi,i+1,...,i+k (xj ) = yj (xj , yj ) Dn ; 0 i j i + k n
Using the formulas above repeatedly, we can create an array of polynomials,
where each successive polynomial can be determined from 2 adjacent polynomials in the previous column:
i
0
1
2
3
4
..
.
n

pi,i+1 (x)

pi,i+1,i+2 (x)

p0,1 (x)
p1,2 (x)
p2,3 (x)
p3,4 (x)

p0,1,2 (x)
p1,2,3 (x)
p2,3,4 (x)

...

xi
x0
x1
x2
x3
x4

pi (x)
p0 (x)
p1 (x)
p2 (x)
p3 (x)
p4 (x)

...
xn

...
...
...
pn (x) pn1,n (x) pn2,n1,n (x)

...
...

pi,i+1,...,i+n (x)

...
p0,1,...,n (x)

For example,




0
1
p01 (x) = xxx
p1 (x) xxx
p0 (x)
x
x
1
0
1
0




1
3
p1,2,3 = xxx
p2,3 (x) xxx
p1,2 (x)
3 x1
3 x1
13

Remark 1 Nevilles expressions of the interpolating polynomials are recursive


and therefore can be easily programmed. Furthermore, they do not require any
computation of divided differences and therefore no additional data structure is
needed beyond the initial data Dn . Recall that Newtons formulas implementation would require the construction of the divided difference table first.
Algorithm for Computer Implementation (Recursive form)
% Input data vectors x and y of same length k
% s : value (or vector) at which we seek the interpolation
% k = length(x)= length(y)
function [ z ]= Neville(x, y, s)
if k=1
z=y;
else
z1= Neville(x(1:k-1), y(1:k-1) , s);
z2= Neville(x(2:k), y(2:k) , s);
z= ((s-x(1))*z2 - (s-x(k))*z1)/(x(k)-x(1));
end

Errors in Polynomial Interpolation

When a function f is approximated on an interval [a, b] by means of an interpolating polynomial pn , a natural expectation is that the function be well
approximated at all intermediate points between the nodes, and that as the
number of nodes increases, this agreement will become better and better. Nevertheless, this expectation is wrong and ill-founded.
A theoretical estimate is derived in ([?], page 189) and leads to the following
result:
Theorem 4 Let f be a function in C n+1 [a, b], and pn the Lagrange polynomial
of degree at most n, that interpolates f based on the set of data Dn . Then there
exists c (a, b) such that:
f (x) pn (x) = wn (x)

f (n+1) (c)
,
(n + 1)!

where wn (x) = (x x0 )(x x1 )....(x xn ).


However, such result does not lead to a convergence result in the sense of:
lim |f (x) pn (x)| = 0, x (a, b),

14

even if the function f possesses continuous derivatives of all orders in that


interval. A well-known counter example of this phenomenon is provided by the
Runge function:
1
f (x) =
1 + x2
If pn is the polynomial that interpolates this function at n + 1 equally spaced
nodes on the interval [5, +5], including the endpoints, it is easy to verify that
the resulting curve assumes negative values, which obviously f (x) does not have
! Adding more equally spaced nodes, that is obtaining higher degree polynomials
only makes matters worse, with wilder oscillations, and the error at non-nodal
points increases beyond all bounds. Thus, it can be shown that:
lim

max

n 5x+5

|f (x) pn (x)| = .

In a more advanced study of this topic, it could be proved that the divergence
of the polynomials can often be ascribed to the fact that the nodes are equally
spaced, which contrary to intuition, is usually a very poor choice in interpolation.
A much better choice leading to more accurate results, is for example the set of
Chebyshev nodes:
2i + 1
] , 0 i n
xi = cos[
2n + 2
This problem motivates the use of local piecewise polynomial interpolation as
in what follows.

Local Interpolation: Spline functions

The global approach of interpolating polynomials does not seem to provide a


systematic and efficient way to approximate a function f (x) on the basis of the
data
Dn = {(xi , yi )|i = 0, 1, ...n, xi 6= xj , i 6= j, x0 = a, < x1 < ... < xn1 < xn = b}
The local approach that is suggested now considers an approximation for the
function f (x) by a spline function, which consists of polynomial pieces joined
together with global imposed smoothness conditions.
We consider successively linear, quadratic and cubic spline functions.

6.1

First Degree or Linear Spline Interpolation

A spline of degree one is a function that consists of linear polynomial pieces


joined together to achieve continuity of the polygonal curve representing this
function.
In general, a spline of degree 1 that interpolates the data Dn is a function
s(x) characterized by the following properties:
15

Definition 3 A linear spline interpolating the data Dn is a function s(x) such


that:
1. s(x) is globally continuous on [a, b], (i.e. s C([a, b]), the set of all
continuous functions on [a, b]).
2. If s(x)|x[xi ,xi+1 ] = si (x), then si (x) is a polynomial of degree at most 1,
i.e.
si IP1 , i = 0, 1, ..., n 1.
3. s(xi ) = yi , i = 0, 1, ..., n.
The points {x0 , x1 , ...} at which the function changes its character are called
the nodes (or knots) in the theory of splines.
Obviously Newtons linear interpolating polynomial form in this case, suffices
to conclude that:
si (x) = yi + [xi , xi+1 ](x xi ), i = 0, 1, ..., n 1.
Remark 2 Referring to the point-slope form equation of a line (y = mx + b),
we note that each of the linear polynomials si (x) we are creating on each of
the n subintervals [xi , xi+1 ], has initially 2 unknown parameters in its equation
, which makes a total of 2n parameters to be determined. On the other hand,
there are exactly 2n interpolation conditions being imposed by the definition of
the linear spline, since for each i, i = 0, 1, ..., n 1:
si (xi ) = yi and si (xi+1 ) = yi+1
Thus, the number of unknown parameters in this case, equals the number of
imposed conditions. For higher degree splines, we shall encounter a mismatch
in these 2 numbers.

Pseudocode for linear spline


%Input: Dn = {(xi , yi ) IR 2 |i = 0, 1, ...n; xi 6= xj f ori 6= j} ; x 6= xi IR
%Output: Approximated value for f(x), using linear splines
Seek i such that x (xi , xi+1 )
Compute si (x) = yi + [xi , xi+1 ](x xi )

16

Example 4 Given the following data D4 = {(xi , yi ) |yi = f (xi ); i = 0, 1, 2, 3, 4}


i
0
1
2
3
4

xi
1.0
1.3
1.6
1.9
2.2

yi
7.6
2.0
4.5
2.8
11

1. Determine the linear spline function interpolating D4 , and plot its graph.
2. Interpolate f (1.4)
1. Given that si (x) = yi +

yi+1 yi
xi+1 xi (x

xi ):

s0 (x) = y0 +

y1 y0
x1 x0 (x

x0 ) = 7.6 18.6(x 1)

s1 (x) = y1 +

y2 y1
x2 x1 (x

x1 ) = 2 + 8.3(x 1.3)

s2 (x) = y2 +

y3 y2
x3 x2 (x

x2 ) = 4.5 5.6(x 1.6)

s3 (x) = y3 +

y4 y3
x4 x3 (x

x3 ) = 2.8 + 27.3(x 1.9)

2. Since x1 < x = 1.4 < x2 f (1.4) s1 (1.4) = 2 + 8.3(1.4 1.3) = 2.83

6.2

Second Degree or Quadratic Spline Interpolation

Splines of degree higher than 1 are more complicated. As for linear splines ,
quadratic splines are not often used for interpolation, due to the lack of smoothness, . The discussion here is provided mainly as a preparation for the study of
higher order and more accurate spline interpolation.

Definition 4 A quadratic spline that interpolates the data Dn is a function


s(x), such that:
1. s(x) is globally continuous on [a, b], (s C([a, b]), the set of all continuous
functions on [a, b]).
2. s0 (x) is globally continuous on [a, b], (s0 C([a, b]).
3. s(x)|x[xi ,xi+1 ] = si (x), where si (x) is a polynomial of degree at most 2 ,
i.e.
si IP2 , i = 0, 1, ..., n 1.

17

4. s(xi ) = yi , i = 0, 1, ..., n.
Remark 3 In brief, a quadratic spline interpolating the data Dn , is a continuously differentiable piecewise quadratic function which consists of n separate
quadratic functions of the form si (x) = ai x2 + bi x + ci , one for each subinterval
[xi , xi+1 ], created by the n + 1 nodes. Thus, we start with a total of 3n unknown
coefficients. On each of these n subintervals, si must satisfy the interpolation
conditions si (xi ) = yi and si (xi+1 ) = yi+1 , for i = 0, 1, ...n 1 which imposes
2n conditions. (Obviously, the continuity of s does not add any additional condition). Furthermore, the continuity of s0 at each of the interior nodes, gives
n 1 more conditions. Thus we have a total of 2n + (n 1) = 3n 1 conditions,
or 1 condition short of the 3n conditions required. There is a variety of ways to
impose this additional condition, for example by fixing:
s0 (x0 ) = 0, or s0 (x0 ) = [x0 , x1 ] =

y1 y0
x1 x0

(6)

We now derive the equations for the interpolating quadratic spline s(x) systematically. In this view, let us introduce a new set of unknowns:
zi = s0 (xi ), for i = 0, 1, ...n
Since s0i IP1 , Newtons formula can be applied on the subinterval [xi , xi+1 ],
giving specifically:
s0i (x) = zi +

zi+1 zi
(x xi ), i = 0, 1, ..n 1
xi+1 xi

Integration of this last equation from xi to x yields:


si (x) = yi + zi (x xi ) +

zi+1 zi (x xi )2
xi+1 xi
2

(7)

Obviously, to determine {si (x)}, we have 1st to calculate {zi }.


Imposing then the interpolation conditions si (xi+1 ) = yi+1 , i = 0, 1, ...n
1, provides a new set of n equations:
yi+1 = yi + zi (xi+1 xi ) +

zi+1 zi (xi+1 xi )2
xi+1 xi
2

Let hi+1 = xi+1 xi . This last equation is then equivalent to:


yi+1 = yi + zi hi+1 +
This yields:

zi+1 zi hi+1 2
hi+1
2

yi+1 yi
zi+1 + zi
=
, i = 0, 1, ..., n 1.
hi+1
2
18

Given an arbitrary z0 chosen as suggested in equation (?? ), the sequence


{zi }ni=1 can be found from the recurrence relation:
zi+1 = zi + 2[xi , xi+1 ], i = 0, 1, ..., n 1,

(8)

where [xi , xi+1 ], is the set of first order divided differences associated with
the data Dn .
It suffices then to get back si (x) from equation (??), and therefore the
quadratic spline s(x) on [a, b].

19

Pseudocode for quadratic spline


%Input: Dn = {(xi , yi )|i = 0, 1, ...n; xi 6= xj } ; x0 = a , xn = b ; x 6= xi in IR
%Output: Approximated value for f(x), using quadratic spline interpolation

0
Compute z0 = xy11 y
x0 (or set z0 = 0 for Natural spline)
Compute zi with zi+1 = zi + 2[xi , xi+1 ]y , i = 0, 1, ..., n 1
Seek i such that x (xi , xi+1 )
2
i+1 zi (xxi )
, i = 0, 1, ..., n 1
Evaluate si (x) = yi + zi (x xi ) + xzi+1
xi
2

Example 5 Find a quadratic spline interpolant for the following data:


D5 = {(1, 2); (0, 1); (1/2, 0); (1, 1); (2, 2); (5/2, 3)}
Assume z0 = 0.
Using successively equations (??) then (??), we get:
zi = {0, 2, 2, 6, 4, 8}
Then:
s0 (x) = (x + 1)2 + 2
s1 (x) = 2x + 1
s2 (x) = 8(x 21 )2 2(x 12 )
s3 (x) = 5(x 1)2 + 6(x 1) + 1
s4 (x) = 12(x 2)2 4(x 2) + 2

6.3

Third degree or Cubic Spline Interpolation

The 1st and 2nd degree splines discussed in the preceding sections suffer an
obvious imperfection: their lower order derivatives are discontinuous.
- In the case of the linear splines, the lack of smoothness of the polygonal
line is evident, because the slope of the spline may change abruptly at
each node.
- For the quadratic splines, the discontinuity is in the 2nd derivative, and is
therefore not so evident; nevertheless, the curvature of the spline changes
abruptly at each node, and the curve may not be pleasing to the eye.
The cubic splines are most frequently used in applications. It can be proved
that in a certain precise sense, the cubic spline function is the best interpolation
function available. In this case, we join cubic polynomials together in such a way
that the resulting spline function has 2 continuous derivatives everywhere. At
20

each interior node 3 conditions will be imposed, so that the graph of the function
will look smooth. Discontinuities, of course, may occur in the 3rd derivative,
but cannot be easily detected visually.
Given the data Dn , Cubic splines are defined as follows:
Definition 5 A cubic spline that interpolates the data Dn , is a function s(x)
such that:
1. s(x) is globally continuous on [a, b], (s C([a, b]), the set of all continuous
functions on [a, b]).
2. s0 (x) is globally continuous on [a, b], (s0 C([a, b])).
3. s00 (x) is globally continuous on [a, b], (s00 C([a, b])).
4. s(x)|x[xi ,xi+1 ] = si (x), where si (x) is a polynomial of degree at most 3 ,
i.e.
si IP 3 , i = 0, 1, ..., n 1.
5. s(xi ) = yi , i = 0, 1, ..., n.
A cubic spline is therefore a twice continuously differentiable piecewise cubic
function. We start by counting the number of conditions available and the
number of unknown coefficients needed to determine s(x):
Since a cubic polynomial on the interval [xi , xi+1 ] written in its standard form
ai x3 + bi x2 + ci x + di has 4 unknown coefficients, a total of 4n coefficients are
then required. As for the interpolation conditions imposed, we have specified
that within each subinterval the interpolating polynomial must go through 2
points: si (xi ) = yi and si (xi+1 ) = yi+1 , which gives 2n conditions. The 1st
and 2nd derivatives must be continuous at the n 1 interior nodes, which adds
2(n 1) more conditions. In order to get the same number of imposed conditions and sought coefficients, we impose (for example), the natural spline
conditions s00 (x0 ) = s00 (xn ) = 0, yielding then a total of 2n + 2(n 1) + 2 = 4n
conditions.
Thus, to determine the spline s(x), let us introduce 2 new sets of unknowns:
{zi = s0 (xi )}, and {wi = s00 (xi )}, for i = 0, 1, ..., n. These 2 sets represent respectively the sets of slopes and moments at the nodes xi for all i = 0, 1, ..., n.

Since s00i IP1 , Newtons formula can be applied. It gives specifically:


s00i (x) = wi +

wi+1 wi
(x xi ), i = 0, 1, ..., n 1
xi+1 xi

Obviously, integration of this last equation twice, leads to si itself.

21

(9)

A first integration from xi to x yields:


s0i (x) zi = wi (x xi ) +

wi+1 wi (x xi )2
, i = 0, 1, ..., n 1 (10)
xi+1 xi
2

Imposing s0i (xi+1 ) = zi+1 , for i = 0, 1, ...n 1 provides a new set of n 1


equations. Specifically:
zi+1 = zi + wi (xi+1 xi ) +

wi+1 wi (xi+1 xi )2
, i = 0, 1, ..., n 1.
xi+1 xi
2

This yields:
zi+1 zi
wi+1 + wi
, i = 0, 1, ..., n 1.
=
hi+1
2

(11)

Given the value of z0 calculated later on, the sequence {zi } can be found
from the following recurrence relation, once the sequence {wi } has been
found.
wi + wi+1
, i = 1, ..., n 1.
(12)
zi+1 = zi + hi+1
2
A second integration from xi to x of equation (??) yields the cubic polynomials {si (x)} where {zi } and {wi } are still undetermined:
si (x) = yi +zi (xxi )+wi

(x xi )2 wi+1 wi
+
(xxi )3 , i = 0, 1, ..., n1
2
6hi+1
(13)

Imposing si (xi+1 ) = yi+1 , i = 0, 1, ...n 1 provides a new set of n 1


equations given by:
yi+1 = yi + zi hi+1 + wi

(wi+1 wi )h2i+1
h2i+1
+
, i = 0, 1, ..., n 1
2
6

where the sequence {wi }ni=0 is still undetermined.

Writing also this last equation on the 2 consecutive intervals [xi , xi+1 ] and
[xi1 , xi ], leads to 2 simultaneous equations written at each internal node
of the spline, i.e. for all i = 1, .., n 1:
(
yi+1 yi
= zi + (wi+1 + 2wi ) hi+1
hi+1
6
yi yi1
hi
=
z
+
(w
+
2w
)
i1
i
i1
hi
6
Subtracting these last 2 equations and using (??) gives:
[xi , xi+1 ] [xi1 , xi ] = hi

wi1 + wi
(wi+1 + 2wi )
(wi + 2wi1 )
+ hi+1
hi
2
6
6
22

Since the 2nd order divided difference associated with the data Dn is,
][xi1 ,xi ]
[xi1 , xi , xi+1 ] = [xi ,xxi+1
, then the preceding equation is also
i+1 xi1
written as follows:
hi
hi + hi+1
hi+1
wi1 +
wi +
wi+1 = (hi +hi+1 )[xi1 , xi , xi+1 ], i = 1, 2, ..., n1.
6
3
6
This provides therefore a system of n 1 equations in n + 1 unknowns
{wi }ni = 0. Adding also the 2 natural splines conditions imposed (w0 = wn = 0),
we reach then a system of n 1 equations in n 1 unknowns given by:
Aw = r,
where the matrix A is:

(h1 + h2 )/3
h2 /6
0

h
/6
(h
+
h
)/3
h
2
2
3
3 /6

0
h
/6
(h
+
h4 )/3
A=
3
3

0
0
h4 /6
0
...
...

(14)

0
0
h4 /6
...
0

0
0
0
...
...

...
...
...
...
...

0
0
0
...
...

...
...
...
...
hn1 /6

0
0
0
hn1 /6
(hn1 + hn )/3

n1n1

and w and r are vectors with n 1 components, given by:


w = (w1 , w2 , ..., wn1 )T
r = (r1 , r2 , ..., rn1 ), where: ri = (hi +hi+1 )[xi1 , xi , xi+1 ]y
Note also that the matrix A = {aij } has the following properties:
- A is symmetric, aij = aji
- A is tridiagonal, aij = 0 if and only if |i j| > 1.
P
- A is strictly diagonally dominant, |aii | > j6=i |aij |, i.
Under these conditions, the system (??) has a unique solution, that can be
obtained through a straightforward Gauss reduction process that does not necessitate any pivoting strategy.

The pseudocode for obtaining natural cubic splines is as follows:


%
%
%
1
2
3

Input the data D_n


Output: cubic spline s(x)
interpolating on D_n
Obtain w by solving
Aw=r
- Generate r=[r_1,...,r_{n-1}]^T for
r_i=(h_i+h_{i+1})[x_{i-1},x_i,x_{i+1}] ; i=1,...,
- Generate A
- Perform Gauss reduction on [A|r]
23

4 - Perform back substitution on reduced system to get w with w_0 = w_n=0


%Obtain the vector slopes z
Calculate z_0 then solve z_{i+1}=z_i +h_{i+1}(w_{i+1}+w_i} / 2, i=0,1,...,n-1
%Generate s(x) through generating s_i(x)
s_i(x)=y_i+z_i(x-x_i)+w_i(x-x_i)^2/2+((w_{i+1}-w_i}/{6h_{i+1})(x-x_i)^3,l i=0,1,...,n-1

6.4

Case of Uniformly Spaced x-data

In case the x-data are uniformly spaced, i.e. hi = h,

2/3 1/6 0
0...
1/6 2/3 1/6 0..

0 1/6 2/3 1/6..


A = h
...
...
...
...

...
...
...
...
0
...
0
1/6

i, the matrix A becomes:

0
0

...

...
2/3

i +yi1
Since also [xi1 , xi , xi+1 ]y = yi+1 2y
, the right hand side r simplifies, and
2h2
the system (??) becomes:

w1
2/3 1/6
0
0...
0
y2 2y1 + y0

1/6 2/3 1/6 0..


0 w2

y3 2y2 + y1
... 1
0

1/6 2/3 1/6 0..

.
y4 2y3 + y2
=
h

...
...
...
... ... h
...

......
...
...
...
...
... ...
yn 2yn1 + yn2
wn1
0
...
0
1/6 2/3

The elements of the matrix A can be made independent of h, through dividing


each of the equations by h, thus yielding:

6.5

2/3 1/6
0
0...
1/6 2/3 1/6 0..
0
1/6 2/3 1/6
...
...
...
...
...
...
...
...
0
...
0
1/6

0
0
0..
...
...
2/3

w1
w2
...
...
...
wn1

1
=

h2

y2 2y1 + y0
y3 2y2 + y1
y4 2y3 + y2
...
...
yn 2yn1 + yn2

Solving a Triadiagonal System

Consider the following general triadiagonal system of equations Aw = r:

a1 b1
0
0...
0
w1
r1
c1 a2

b2
0..
0

w2 r2
0 c2

a3
b3
0.. ... ...

,
... ...

...
...
...

... ...
... ... cN 2 aN 1 bN 1 ... ...
0 ...
0
cN 1
aN
wN
rN
24

where the diagonal entry of the matrix A are generated by the vector ai : 1
i N and the upper and lower diagonal ones being respectively obtained
from bi , ci : 1 i N 1 satisfying the following properties:

|ai | > |bi | + |ci1 | : 2 i N 1
|a1 | > |b1 |, |aN | > |cN 1 |
The following algorithm solves this given system:
function w=SolveTridiag(a,b,c,r)
% N is the dimension of a and r
% N-1 is the dimension of b and c
% Start with the Gauss reduction process
for k=1:N-1
m=c(k)/a(k);
a(k+1)=a(k+1)-m*b(k);
r(k+1)=r(k+1)-m*r(k);
end
% Obtain the solution w by back-substitution
for k=N:-1:1
w(k)=r(k)/a(k);
if k>1
r(k-1)=r(k-1)-w(k)*b(k-1);
end
end
This algorithm takes 2N 1 divisions, 3(N 1) multiplications and as many
algebraic additions, thus a total of 8N 7 flops.

25

6.6

Computer Application: Algorithm Solving the natural cubic spline

The steps for computing the natural cubic spline are as follows:
1. Obtain w, the vector of moments by solving (??):
(a) Generate r
(b) Generate A
(c) Perform Gauss Reduction on [A r]
(d) Perform back substitution on reduced system to get w.
2. Obtain z the vector of slopes by solving (refwz1)
zi+1 = zi + hi+1

wi + wi+1
, i = 1, ..., n,
2

z0 arbitrarily chosen, for example z0 = 0 or z0 some approximation to the


derivative s0 (x).
3. Generate s(x), through the generation of si (x) : i = 0, 1, ..., n 1, using:
si (x) = yi + zi (x xi ) + wi

wi+1 wi
(x xi )2
+
(x xi )3 .
2
6hi+1

4. Test your program on the function f (x) = log(x), by:


(a) finding s(x) : x = 1., 1.2, 1.4, ...3.8, 4 then plotting s(x)
(b) Compute max |s(x) log(x)| : x = 1., 1.2, 1.4, ...3.8, 4
5. Construct a new table Dn for the function log(x),
x = 1, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.
6. Repeat the previous steps to find w, z and s(x)
7. Compute max |s(x) log(x)| : x = 1., 1.2, 1.4, ...3.8, 4.
What do you conclude?

26

6.7

Errors in Spline Interpolation

From ([?], pages 14 and 61) , we can state the following convergence result:
Theorem 5 Let f be a function in C k+1 [a, b], and Sk the Spline Function ,
that interpolates f based on the set of data Dn , where k = 1, 2, 3. Then,
max |f (x) Sk (x)| Ck hk+1 max |f (k+1) (x)|
[a,b]

[a,b]

where h = max |xi xi1 |, for 1 i n.


For example:
If k = 1, then max[a,b] |f (x) S1 (x)| = O(h2 )
If k = 2, then max[a,b] |f (x) S2 (x)| = O(h3 )
If k = 3, then max[a,b] |f (x) S3 (x)| = O(h4 )
Note also that in Spline Interpolation, increasing the number of nodes for a
fixed value of k, will definitely lead to convergence. One can prove that:
x [a, b], ] lim Sk (x) = f (x).
n

This property is noticeably absent for global Lagrange interpolation (recall


Runge example).

27

PROBLEMS

Polynomial Interpolation
1. Use the Lagrange interpolation process to obtain a polynomial of least degree that satisfies the following set of data: D3 = {(0, 7), (2, 11), (3, 28), (4, 63)}.
2. For the four interpolation nodes 1, 1, 3, 4, what are the li functions required in the Lagrange interpolation procedure ? Draw the graphs of these
functions to show their essential properties. Use Lagrange interpolation
form to obtain a polynomial of least degree that satisfies the following set
of data: D3 = {(1, 1), (1, 0), (3, 2), (4, 3)}.
3. Write the Lagrange form of the interpolating polynomial of degree 2
that interpolates f (x) at x0 , x1 and x2 , where x0 < x1 < x2 .
4. Given the data
D4 = {(1, 1), (2, 1/3), (2.5, 3/32), (3, 4/3), (4, 25)}
(a) Construct the divided difference table.
(b) Use the best quadratic then cubic Newtons interpolating polynomial, to find an approximation to f (2.9).
5. Write Newtons interpolating polynomial for the data shown:
{(0, 7), (2, 11), (3, 28), (4, 63)}
6. Using a difference table, derive the polynomial of least degree that assumes
the values 2, 14, 4, 2 and 2 respectively for x = 2, 1, 0, 1 and 2. Use that
result, to find a polynomial that takes the values shown and has at x = 3
the value 10.
7. The polynomial p(x) = x4 x3 + x2 x + 1 satisfies the following set of
data
i xi yi
0 2 31
1 1 5
2 0
1
3 1
1
4 2 11
5 3 61

28

Find a polynomial q that takes these values:


i
0
1
2
3
4
5

xi yi
2 31
1 5
0
1
1
1
2 11
3 30

8. Construct a divided difference (or difference) table based on the two given
sets of data in the preceding exercise, then use Newtons polynomials of
all orders (1,2, 3, 4 and 5) to approximate f (2.5), in each case.
9. Create the table of all Nevilles polynomials in P4 satisfying the following
set of data:
i xi
yi
0 1.0 1.5
1 2.0 0.5
2 2.5 0.0
3 3.0 0.5
4 4.0 1.5
10. Determine by two methods the polynomial of degree 2 or less whose graph
passes through the points (0, 1.1), (1, 2), and (2, 4.2). Verify that they are
the same.
11. Let f (x) = x3 + 2x2 + x + 1. Find the polynomial of degree 4 that interpolates the values of f at x = 2, 1, 0, 1, 2. Find the polynomial of
degree 2 that interpolates the values of f at x = 1, 0, 1.

Spline Interpolation
12. Determine whether each of the following functions is a first degree spline,
and plot its graph.
(a)
S(x) =

x ; 1 x 0
1 x; 0 x < 1

2x 2 ; 1 x 2

(b)
S(x) =

x ; 1 x 0.5
0.5x + 2(x 0.5) ; 0.5 x 2

x + 1.5 ; 2 x 4
29

13. Determine the linear spline function s(x) interpolating the set of data D3
and plot its graph. Interpolate f (2.4).
D3 = {(0, 1); (1.5, 3); (2, 5); (3, 2)}
14. Is S(x) = |x| a first degree spline ? Why or why not ?
15. Find the natural quadratic spline interpolant for the following data
(a)
x
1
0
1/2
1
2
5/2

y
2
1
0
1
2
3

x
1
2
5/2
3
4

y
2
1
0
1
3

(b)

16. Are these functions quadratic splines ? Explain why or why not ?Plot
their graphs.
(a)

Q(x) =

x2 ; 0 x 1
x ; 0 x 100

(b)

x ; 50 x 1
x2 ; 1 x 2
Q(x) =

4 ; 2 x 50
17. Do there exist a,b, c and d so that the function

x ; 10 x 1

ax3 + bx2 + cx + d ; 1 x 1
S(x) =

x ; 1 x 10
is a natural cubic spline function ?

30

18. Do there exist coefficients for which the function

x + 1 ; 2 x 1

ax3 + bx2 + cx + d ; 1 x 1
S(x) =

x 1; 1 x 2
is a natural cubic spline function ? Why or why not ?
19. Determine the natural cubic spline that interpolates the function f (x) =
x6 over the interval [0, 2] using nodes 0, 1 and 2 .
20. Find the natural cubic spline interpolant for this table
x
1
2
3
4
5

y
0
1
0
1
0

21. Find the natural cubic spline interpolant for this table
x
1
2
3
4
5
6

y
0
1
0
1
0
1

22. Give an example of a cubic spline with nodes 0, 1, 2, and 3 that is quadratic
in [0, 1], cubic in [1, 2], and quadratic in [2, 3].
23. Give an example of a cubic spline with nodes 0, 1, 2, and 3 that is linear
in [0, 1], but of degree 3 in the other two intervals.
24. List all the ways in which the following functions fail to be natural cubic
splines:
(a)
S(x) =

x + 1 ; 2 x 1
x3 2x + 1 ; 1 x 1

x 1; 1 x 2

(b)

S(x) =

x3 + x 1 ; 1 x 0
x3 x 1 ; 0 x 1
31

25. Determine the coefficients so that the function



x2 + x3 ; 0 x 1
S(x) =
a + bx + cx2 + dx3 ; 1 x 2
is a cubic spline that has the property S1000 (x) = 12
26. How many additional conditions are needed to specify uniquely a spline
of degree 4 over n knots ?
27. Let S be a cubic spline that has knots t0 < t1 < ... < tn . Suppose that on
the 2 intervals [t0 , t1 ] and [t2 , t3 ], S reduces to linear polynomials. What
can be said of S on [t1 , t2 ]?

32

References
[1] CHENEY, W., KINCAID D., Numerical Mathematics and Computing.
4th edition. Brooks, Cole 1999.
[2] ISAACSON I., KELLER, H., Analysis of Numerical Methods. Wiley,
1966.
[3] SCHULTZ, M.H.., Spline Analysis. Prentice Hall 1973.

33

Potrebbero piacerti anche