0% found this document useful (0 votes)
5 views11 pages

Lectures1-Chapter III

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 11

Chapter 1

Chapter 1 : Error Analysis

1
Chapter 2

Chapter 2 : Numerical
resolution of an algebraic
equation

2
Chapter 3

Chapter 3 : Interpolation
and Approximation

3.1 Introduction
One of the most useful and well-known classes of functions mapping the set of
real numbers into itself is the algebraic polynomials, the set of functions of the
form
P
n
Pn (x) = ak xk ;
k=0

where n is a nonnegative integer and a0 ; an , an are real constants. One reason


for their importance is that they uniformly approximate continuous functions.
By this we mean that given any function, de…ned and continuous on a closed and
bounded interval, there exists a polynomial that is as “close”to the given func-
tion as desired. This result is expressed precisely in the following Weierstrass
Approximation Theorem:

Theorem 1 (Weierstrass Approximation Theorem) Suppose that f is de…ned


and continuous on [a; b]. For each " > 0, there exists a polynomial P (x), with
the property that
jf (x) P (x)j < "; for all x 2 [a; b] :

Another important reason for considering the class of polynomials in the


approximationof functions is that the derivative and inde…nite integral of a
polynomial are easy to determine and are also polynomials. For these reasons,
polynomials are often used for approximating continuous functions.

3
Part I

Interpolation

4
3.2 Interpolation Problem
The basic interpolation problem can be posed in one of two ways:
1: Given a set of nodes fxi ; 0 i ng and corresponding data values
fyi ; 0 i ng, …nd the polynomial pn (x) of degree less than or equal to n,
such that
pn (xi ) = yi ; 0 i n:
2: Given a set of nodes fxi ; 0 i ng and a continuous function f (x), …nd
the polynomial pn (x) of degree less than or equal to n, such that

pn (xi ) = f (xi ); 0 i n:

Note that in the …rst case we are trying to …t a polynomial to the data, and in
the second we are trying to approximate a given function with the interpolating
polynomial.

3.3 Lagrange Interpolation


Theorem 2 (Lagrange Interpolation) Suppose that n 1: Let the distinct nodes
xi 2 [a; b] ; 0 i n be given, then there exists a unique polynomial pn ; of degree
less than or equal to n, which satis…es either of

pn (xi ) = yi ; 0 i n:

for a given set of data values yi ; or

pn (xi ) = f (xi ); 0 i n:

for a given continous function in [a; b].

Proof. We begin by de…ning the family of the following Lagrange polynomials


n
Y x xk
Lni (x) = ; for all 0 i n;
xi xk
k=0;k6=i

which have the interesting property :

1; if i = j;
Lni (xj ) = ij (x) = ; for all 0 j n;
0; if i 6= j;

where ij denotes the Kronecker symbol.


Then, if we consider the following polynomial
n
X
pn (x) = Lni (x)yi ;
i=0

This polynomial, called the nth Lagrange interpolating polynomial.

5
Then, for all j : 0 j n we obtain
n
X
pn (xj ) = ij (x) yi = yi :
k=0

Thus, the interpolation conditions are satis…ed, and it remains only to prove
the uniqueness of the polynomial.
To this end, assume that there exists a second interpolation polynomial qn
of degree less than or equal to n.
Then
rn (xi ) = pn (xi ) qn (xi ) = 0; 8i : 0 i n:
Thus, rn (x) is a polynomial of degree less than or equal to n that has n + 1
roots, which implies that rn (x) = 0: Consequently,

pn (x) = qn (x) ;

and thus pn is unique.

Remark 3 Although the statement of previous theorem required that n 1,


the trivial case of n = 0 mentioned at the beginning of the section can also be
included by de…ning, for n = 0; L0 (x) 1, and observing that the function p0
de…ned by p0 (x) = L0 (x)y0 y0 is the unique polynomial of degree than or equal
to 0 that satis…es p0 (x0 ) = y0 .

Example 4 To illustrate this construction let f (x) = ex and consider the prob-
lem of constructing an approximation to this function on the interval [ 1; 1],
using the nodes :
1
x0 = 1; x1 = 2 ; x2 = 0; x3 = 21 ; x4 = 1:

Solution 5 Using

Q
4 x xk
L4i (x) = ;0 i 4
k=0;k6=i xi xk

to have
x x1 x x2 x x3 x x4
L40 (x) = =
x0 x1 x0 x2 x0 x3 x0 x4
2 1 1
= 3 x+ 2 (x) x 2 (x 1) ;

x x0 x x2 x x3 x x4
L41 (x) = =
x1 x0 x1 x2 x1 x3 x1 x4
8 1
= 3 (x + 1) (x) x 2 (x 1) ;

6
x x0 x x1 x x3 x x4
L42 (x) = =
x2 x0 x2 x1 x2 x3 x2 x4
1 1
= 4 (x + 1) x + 2 x 2 (x 1) ;

x x0 x x1 x x2 x x4
L43 (x) = =
x3 x0 x3 x1 x3 x2 x3 x4
8 1
= 3 (x + 1) x + 2 (x) (x 1) ;

x x0 x x1 x x2 x x3
L44 (x) = =
x4 x0 x4 x1 x4 x2 x4 x3
2 1 1
= 3 (x + 1) x + 2 (x) x 2 :

From where, it follows


4
X
p4 (x) = L4i (x) exp(xi ) = 1+0:997853749x+0:499644939x2 +0:177347443x3 +0:043435696x4 :
i=0

The approximation is su¢ ciently accurate that it is impossible to discern that


there are two curves present, so it is probably better to look at Figures, which
plots the error E(x) = f (x) p4 (x).

3 3
y y
2 2

1 1

-1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0
x x
p4 (x) exp(x)

y 4

-1.0 -0.5 0.5 1.0


-2 x
-4

E(x) = exp x p4 (x)

7
Example 6 Find the polynomial of degree 2 that interpolates at the data points
xi 0 1 4
yi 1 2 2
Use this polynomial to approximate f (2):

Solution 7 We have
2
X 2
Y x xk
p2 (x) = L2i (x)yi ; where L2i (x) = ; i = 0; 1; 2:
i=0
xi xk
k=0;k6=i

Thus, we get
1 2
p2 (x) = 4x + 54 x + 1:
So,
f (2) ' p2 (2) = 52 :

Exercise 8 Let Pn be the vector space of polynomials of degree less than or


equal to n; i:e:
Pn = fqn : deg qn ng :
Show that fLni ; i = 0; :::; ng forms a basis of Pn :

Solution 9 See Worksheet 03

3.4 Newton Interpolation and divided di¤erences


The Lagrange form of the interpolating polynomial gives us a very tidy con-
struction, but it does not lend itself well to actual computation. With Lagrange
form, it is inconvenient to pass from one interpolation polynomials to another
of degree one greater. Such a comparison of di¤erent degree interpolation poly-
nomials is a useful technique in deciding what degree polynomial to use.
An alternate form of the polynomial, known as the Newton form, avoids this
problem, and allows us to easily write pn+1 in terms of pn .

Theorem 10 (Newton Interpolation Construction) Let pn be the polynomial


that interpolates f at the nodes xi ; i = 0; 1; :::; n. The polynomial pn+1 that
interpolates f at the nodes xi ; i = 0; 1; :::; n + 1 is given by

p0 (x) = a0 = f (x0 ) ;
pn+1 (x) = pn (x) + an+1 n (x);

where
Q
n
n (x) = (x xi ) ;
i=0
f (xn+1 ) pn (xn+1 )
an+1 = n (xn+1 )
;

8
Proof. Since we know that the interpolation polynomial is unique, all we have
to do is show that pn+1 , as given in this theorem, satis…es the interpolation
conditions.
For all k = 0; 1; :::; n we have

n (xk ) = 0;

so
pn+1 (xk ) = pn (xk ) + an+1 n (xk ) = pn (xk ):
| {z }
=0

Hence, pn+1 interpolates f at all nodes xi ; i = 0; 1; :::; n but the last point.
So, it remains to check the interpolation at point xn+1 ; thus we have

pn+1 (xn+1 ) = pn (xn+1 ) + an+1 n (xn+1 ) =


f (xn+1 ) pn (xn+1 )
= pn (xn+1 ) + n (xn+1 )
n (xn+1 ) =
= pn (xn+1 ) + f (xn+1 ) pn (xn+1 ) = f (xn+1 ):

Thus, pn+1 is a polynomial of degree less than or equal to n + 1 and satis…es

pn+1 (xi ) = f (xi ); for all nodes xi ; i = 0; 1; :::; n + 1:

For reason divided below, the coe¢ cients


(
a0 = f (x0 ) ;
an = f (xn )n p1n(xn1)(xn ) ; for all n 1:

is called the nth order Newton divided di¤erence of f and it is denoted by

f [x0 ; x1 ; : : : ; xn ] :

Also, we can construct an algorithm for computing them. It is also possible


to slightly modify this algorithm to allow the user to update an existing set of
divided di¤erence coe¢ cients by adding new points to the set of nodes.
Thus, we obtain the following Newton interpolation formula

pn (x) = f (x0 )+f [x0 ; x1 ] (x x0 )+f [x0 ; x1 ; x2 ] (x x0 ) (x x1 )+ +f [x0 ; : : : ; xn ] n 1 (x):

How to calculate the divided di¤erences ?


We start by 1st order : We have

f (x1 ) = f (x0 ) + f [x0 ; x1 ] (x1 x0 ) :

So,
f (x1 ) f (x0 )
f [x0 ; x1 ] = :
x1 x0

9
For 2nd order, we get

f (x2 ) = f (x0 ) + f [x0 ; x1 ] (x2 x0 ) + f [x0 ; x1 ; x2 ] (x2 x0 ) (x2 x1 ) :

Thus,

(f (x2 ) f (x1 )) + (f (x1 ) f (x0 )) f [x0 ; x1 ] (x2 x0 )


f [x0 ; x1 ; x2 ] = =
(x2 x0 ) (x2 x1 )
f [x1 ; x2 ] (x2 x1 ) + f [x0 ; x1 ] (x1 x0 ) f [x0 ; x1 ] (x2 x0 )
=
(x2 x0 ) (x2 x1 )
f [x1 ; x2 ] f [x0 ; x1 ]
= :
(x2 x0 )

Then by, inductively, it results

f [x1 ; : : : ; xn ] f [x0 ; : : : ; xn 1]
f [x0 ; x1 ; : : : ; xn ] = ; for all n 2:
(xn x0 )

Example 11 1) Use the Newton divided di¤ erences to …nd the polynomial of
degree 2 that interpolates f at the following data points
xi 0 1 4
f (xi ) 1 2 2
2) Deduce the polynomial of degree 3 by adding a new point x3 = 5; y4 = 3:

Solution 12 1)
0 1
2 1
f [x0 ; x1 ] = 1 0 =1
0 1 1
1 2 f [x0 ; x1 ; x2 ] = 4 0 = 4
2 2
f [x1 ; x2 ] = 4 1 =0
4 2
Thus,

1
p2 (x) = 1 + (x 0) (x 0)(x 1) =
4
1 2 5
= x + x+1
4 4
2) To deduce p3 , we consider the following divided di¤ erences

0 1
2 1
f [x0 ; x1 ] = 1 0 =1
0 1 1
1 2 f [x0 ; x1 ; x2 ] = 4 0 = 4
1 1
2 2 4+4 1
f [x1 ; x2 ] = 4 1 =0 f [x0 ; x1 ; x2 ; x3 ] = 5 0 = 10
1 0 1
4 2 f [x1 ; x2 ; x3 ] = 5 1=4
3 2
f [x2 ; x3 ] = 5 4= 1
5 3

10
So,

p3 (x) = p2 (x) + f [x0 ; x1 ; x2 ; x3 ] (x 0)(x 1)(x 4) =


1 2
= 4x + 54 x + 1 + 1
10 (x 0)(x 1)(x 4) =
1 3 3 2 33
= 10 x 4x + 20 x + 1:

Example 13 Using divided di¤ erences to show that


n
X n (n + 1) (2n + 1)
k2 = ; all n 1:
6
k=1

Proposition 14 Suppose x0 ; x1 ; :::; xn are distinct numbers in the interval [a; b]


and f 2 C n ([a; b]). Then, there is a number " between x0 ; x1 ; :::; xn , and hence
in [a; b] such that
f (n) (")
f [x0 ; x1 ; :::; xn ] = :
n!

11

You might also like