3.2.3 Newton's Divided Difference Interpolation: Lagrange Method Has The Following Weaknesses

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 31

3.2.

3 Newtons Divided Difference


Interpolation
Lagrange method has the following weaknesses:
1)
Lagrange Interpolation Polynomial is hard to find
if we have many data points.
2)
If we want to add data, we have to restart our
computation from the beginning.

In this part, we discuss a method that can handle the


weaknesses of Lagrange Method, called Newtons
Divided Difference Interpolation. Before that, we
first need to produce a table of divided difference.
1

3.2.3.1 Table of Divided Difference


Suppose we are given the following points :
( x0 , f ( x0 )), ( x1 , f ( x1 )), , ( xn , f ( xn )).
The divided difference of orders one, two, three
and so on are defined by the formulas listed in
Table 3.5.

Table 3.5 Orders of Divided Difference


Order

Symbol

Definition

f [xi]

f (xi)

f [xi , xi +1]

f [ xi ] f [ xi 1 ]
xi xi 1

f [xi , xi +1 , xi +2]

f [xi , xi +1 , xi +2 , xi +3]

f [ xi , xi 1 , xi 2 ] f [ xi 1 , xi 2 , xi 3 ]
xi xi 3

f [x0 , x1 ,, xn - 1 , xn]

f [ x0 ,, xn 1 ] f [ x1 ,, xn ]
x0 xn

f [ xi , xi 1 ] f [ xi 1 , xi 2 ]
xi xi 2

Table 3.6 Divided Difference Formula

x f (x)

x0 f (x0)
f [ x0 , x1 ]

f ( x0 ) f ( x1 )
x0 x1

f [ x0 , x1 , x2 ]

x1 f (x1)

f [ x0 , x1 ] f [ x1 , x2 ]
x0 x2
f [ x0 , x1 , x2 , x3 ]

f [ x1 , x2 ]

f ( x1 ) f ( x2 )
x1 x2

f [ x0 , x1 , x2 ] f [ x1 , x2 , x3 ]
x0 x3

f [ x1 , x2 , x3 ]

x2 f (x2)
f [ x2 , x3 ]

x3 f (x3)

f ( x2 ) f ( x3 )
x2 x3

f [ x1 , x2 ] f [ x2 , x3 ]
x1 x3

Based on Table 3.5, we can produce table of divided


difference as in Table 3.6.
Though Table 3.6 shows an estimation for four data
points, a similar way can be used for different
number of data points.
Example 3.8
Produce a table of divided difference for the
following data points:
and

Solution
Table of divided difference for this data is
5

f (x)

7/3

29/6
12

16
3

3 0
3
1 2

4
4

-8

65/72
17/8

21/6
-5

-2

17
6

3.2.3.2 Newtons Divided Difference


Interpolation
From the definition of divided difference, Newton' s divided
difference interpolation polynomial is written as
y P( x) f ( x0 )
( x x0 ) f [ x0 , x1 ]
( x x0 )( x x1 ) f [ x0 , x1 , x2 ]

( x x0 )( x x1 ) ( x xn 1 ) f [ x0 , x1 , , xn ].
7

Example 3.9
Find interpolation polynomial that passes through
(0,2), (1,3) dan (3,3) using Newtons divided
difference interpolation.
Solution
Table of divide difference for these three points is
x

1
1

1
3

0
3

3
8

Thus, the Newton's divided difference interpolation


polynomial for this example is given by
y P( x) f ( x ) ( x x ) f [ x , x ] ( x x )( x x ) f [ x , x , x ]
0

1
2 ( x 0)(1) ( x 0)( x 1)
3
4
1
2 x x .
3
3
2

REMARKS
i)

when x 0, P (0) 2.

4
1
ii ) when x 1, P (1) 2 (1) (1) 2
3
3
3.
4
1
iii ) when x 3, P (3) 2 (3) (3) 2
3
3
3.

10

3.3 Integral Solution Using


Numerical Methods

In this part, we discuss the following numerical


integration methods:
1) Rectangular Rule
2) Trapezoidal Rule
3) Simpsons Rule

Before doing the approximation, we first have to


give the number of subintervals that we want to
consider and find the length of each subinterval.
11

3.3.1 Number of subintervals and


the length of each subinterval

We suppose that the interval from x a to


xb is divided into n number of subintervals,
where the length of each subinterval is

ba
h
.
n

If x0 a and xn b, then in general,

xi+1 xi h
12

The positions of x0, x1, ,xn are shown


in the following figure.
y

h
|

f (x)

h
|

x0 x1 x2 x3 xn

Figure 3.5 Number of subintervals


13

3.3.2 Rectangular Rule

In this method, we suppose that every subinterval forms


a rectangle, where the height of each subinterval is

1
f ( xi ), xi ( xi xi 1 ).
2
Areas of all rectangles are computed.
Total area of these rectangles is the approximate area
below the curve of the function, which is also the
estimation of the integral that we want to determine.
*

14

f (x)
|

x1* x2* x3*

Figure 3.6 Rectangular Rule

15

We have given the length of each subinterval


denoted by h.
*
th
If the height of the i rectangle is f ( xi ),
*
th
h
f
(
x
then the area of the i rectangle is
i ).
Total area of all rectangles
*

h f ( x1 ) h f ( x2 ) h f ( xn )
*
1

h [ f ( x ) f ( x2 ) f ( xn )].
16

RECTANGULAR RULE

*
1

f ( x) dx h [ f ( x ) f ( x2 ) f ( xn ) ]

1
where xi ( xi xi 1 ).
2
Note :
*

Estimation of

f ( x) dx will be more accurate if

we increase the number of subintervals n.


17

Example 3.10
Estimate

x2

dx using ten subintervals.

Solution
Given a 0 and b 1, then the length of each
subinterval is
ba
h
n
1 0

0.1
10
Thus, from the table,

x2

dx 0.1(7.471308)
0.747131.
18

xi

xi *

f (xi* )

0.1

0.05

0.997503

0.2

0.15

0.977751

0.3

0.25

0.939413

0.4

0.35

0.884706

0.5

0.45

0.816686

0.6

0.55

0.738968

0.7

0.65

0.655406

0.8

0.75

0.569783

0.9

0.85

0.485537

10

0.95

0.405555

TOTAL

7.471308
19

3.3.3 Trapezoidal Rule

A revision of the Rectangular Rule.


While in the Rectangular Rule we make a rectangle
for each subinterval, in Trapezoidal Rule we make
a trapezoid for each subinterval.
Areas of all trapezoids are computed.
Total area of all trapezoids is the estimation of the
area below the curve of the function, which is also
the approximation of the integral of the function.
20

f
(x)
x0 x1 x2

xn

Figure 3.7 Trapezoidal Rule

21

Thus,
If the length of each subinterval is h,
Height of the left hand side of the ith trapezoid = f ( x ),
i 1
Height of the right hand side of the ith trapezoid = f ( x ),
i

Then the area of the ith trapezoid is

1
h( f ( xi ) f ( xi 1 )).
2
22

Total area of all trapezoids


1
1
h ( f ( x1 ) f ( x0 )) h ( f ( x2 ) f ( x1 ))
2
2
1
h ( f ( xn ) f ( xn 1 ))
2
1
1
1
1
h f ( x1 ) hf ( x0 ) h f ( x2 ) hf ( x1 )
2
2
2
2
1
1
h f ( xn ) hf ( xn 1 )
2
2
1
1

h f ( x0 ) f ( x1 ) f ( x2 ) f ( xn 1 ) f ( xn ) .
2
2

23

TRAPEZOIDAL RULE

1
1

f ( x) dx h f (a ) f ( x1 ) f ( x2 ) f ( xn 1 ) f (b)
2
2

where x0 a and xn b

24

Example 3.11
Use Trapezoida l Rule with ten subintervals
to estimate

x2

dx.

Solution
Given a 0 and b 1, then the length of each
subinterval is
1 0
h
10
0.1
25

f (xi ), i=,, n

xi

f (a) & f (b )

TOTAL

26

Thus, from the table


1

0 e dx 0.1 2 (1.367879) (6.778167)


0.746211.
To compute the error bound, we need to do
the following differentiation.
1

x2

27

3.3.4 Simpsons Rule


Let ( x0 , f ( x0 )), ( x1 , f ( x1 ))... ( xn , f ( x1 )),
be the points that define two successive subintervals
in the function that we want to integrate.
We formulate Simpson's Rule as follows:
Taking x0 a and xn b, we have

h
f ( x) dx ( f (a) f (b)
3
4( f ( x1 ) f ( x3 ) f ( x5 ) L f ( xn 1 ))
2( f ( x2 ) f ( x4 ) f ( x6 ) L f ( xn 2 )).

28

Example 3.12
Apply Simpson' s Rule with ten subintervals
to compute

x2

dx.

Solution
Given f ( x) e

x2

. We want to integrate f ( x) with

respect to x from a 0 to b 1.
1 0
The length of each interval h
0.1.
10
We make a table that will help us to compute the integral.

29

xi

f (a) & f (b)

TOTAL

f (xodd)

f (xeven)

30

From the table, we have


1
0.1
x2
0 e dx 3 1.367879 4(3.740266) 2(3.037901)
0.746825.

31

You might also like