You are on page 1of 19

Finite Differences

Suppose the function y=f(x) tabulated equally spaced


Finite Differences value
x y
&
x0 y0
Interpolation x0 +h y1
x0 +2h y2

By x0 +3h y3
Dr. Pradeep K. Goyal
x0 +4h y4

Forward difference operator (D)

A forward difference is an expression of the form

Df(x) = f(x + h) - f(x)


Dyr = y r + 1 - yr, r = 0, 1, 2, …, n -1

Dy 0  y1  y 0 
Dy1  y 2  y1 

.  first forward differences
. 

Dy n 1  y n  y n 1 

1
D 2 y1  Dy2  Dy1
D2 y 0 , D2 y1 , D2 y 2 ,...., are called the sec ond differences
D 2 y1  y3  2 y2  y1
Now D2 y 0  D(Dy 0 )  D( y1  y 0 ) D2 y r  y r  2  2 y r 1  y r
 Dy1  Dy0 Note : D 3 y0  D 2 y1  D 2 y0
 ( y2  y1 )  ( y1  y0 ) D 3 y0  y3  3 y2  3 y1  y0
 y 2  2 y1  y 0
 Dk yr  yrk k C1yrk1 k C2 yrk2 ....(1) kyr

Forward Difference Table Example:


The following table gives a set of values of x and
the corresponding values of y = f(x)

Form the difference table and find Df (10), D2f (10),


D3f (20) D4f (15)

Dy0, D2y0, D3y0,…. are called the leading differences

2
Example:

Df (10)  1.54
D2f (10)   0.58
D3f (20)  0.03
D4f (15)  0.04

If y0 = 1, y1 = 11, y2 = 21, y3 = 28, y4 = 29.


Construct the difference table.

3
Backward difference operator () Backward difference table

------is called nable

Let y = f(x)
We define f(x) = f(x) - f(x - h)

i.e. y1 = y1 - y0 = Dy0

y2 = y2 - y1 = Dy1 first backward differences


'
'
yn = yn - yn-1 = D yn - 1

1. Given

Construct the difference table and write the values of


f (4), 2f (4), 3f (3)

4
Central Difference Operator ()

 h  h
 f (x )  f  x    f  x  
 2  2

 f ( x 0  h / 2)  f ( x1 )  f ( x 0 )

Note: Central ordinate is taken for convenience as y0


corresponding to x0

Note 2: Central difference table


Note 1:

Central Difference Forward Backward


y 3 / 2  y1 / 2   2 y1
 y1/ 2  y1  y0  Dy0  y1
y5 / 2  y3 / 2  2 y 2

 y3 / 2  y2  y1  Dy1  y2
y 7 / 2   5 / 2   2 y 3
 yn1/ 2  yn  yn1  Dyn1  yn

5
Problem Problem

1. Show that: 2. Show that:  2 y 0  y1  2 y 0  y 1


2
 y 5  y 6  2y 5  y 4
Solution
Solution  2 y 0  y1 / 2  y 1 / 2
y11 / 2  y 6  y 5 y1 / 2  y1  y 0
y 9 / 2  y 5  y 4 y 1 / 2  y 0  y 1
Now  2 y 5  y11/ 2  y 9 / 2  2 y 0  y1 / 2  y 1 / 2
 (y6  y5 )  (y5  y4 )  ( y1  y 0 )  ( y 0  y 1 )
 y 6  2y5  y 4  y1  2 y 0  y1

Solution
Problem

3. Given f(-2) = 12, f(-1) = 16, f(0) = 15, f(1) = 18, f(2) = 20
form the central difference table and write down
the values of y-3/2, 2y0, 3y1/2 by taking x0 = 0

y 3 / 2  4,  2 y 0  4,  3 y1 / 2  5

6
Shift operator (E)
Note: 1
D  E 1
E f(x) = f(x +h)
Dn y 0  y n  n C1 y n 1  n C 2 y n 2  ....  ( 1) n y 0
E2 f(x) = f(x + 2h)

En f(x) = f(x + nh) Note: 2

 1  E 1
  1     
 E  E 

Interpolations u (u  1) 2 u (u  1) (u  2) 3
f ( x)  y0  u Dy0  D y0  D y0  ....
2! 3!
u (u  1) (u  2) ...(u  n  1) n
 D y0
Interpolation:Finding the values of y corresponding n!
to any value of x between x0 and xn is called the Newton Gregory forward difference formula
x  x0
where u
h
Extrapolation: Finding the values of y outside the
Note :
given range 1. Newton forward interpolation is used to interpolate the
values of y near the beginning of a set of tabular values.
2. y0 may be taken as any point of the table but the
formula contains those values of y which come after the
value chosen as y0.

7
Example of Newton Gregory forward difference formula Solution

The table gives the distances in nautical miles of the visible


horizon for the given heights in feet above the earths surface.

Find the values of y when


(i) x = 120,
(ii) x = 218
Choose x0 = 100

120  100
(i) x  120, u  50
 0.4 (ii) Let x = 218, x0 = 200,

0.4 (0.4)(0.4  1)
f (120)  10.63  (2.40 )  (0.39) 218  200 18
1! 2! u   0.36
50 50
(0.4) (0.4  1) (0.4  2) (0.4  3) 0.36 (0.64)
 (0.07) f (218 )  15.04  0.36(1.77 )  (0.16)
4! 2
(0.4) (0.4  1)(0.4  2)
 (0.15 )
3! 0.36 (0.64) (1.64)
 (0.03)  ...
6
(0.4) (0.4  1) (0.4  2) (0.4  3)
 (0.07)
4!
= 15.7
(0.4) (0.4  1) (0.4  2) (0.4  3) (0.4  4) (0.4  5)
 (0.02)  11.649
6!

8
Example of Newton Gregory forward difference formula

Find the value of f(1.85)


x  x 0 1.85  1.8
Choose x 0  1.8, x 1.85 u    0.5
h 0.1

(0.5) (0.5)
f (1.85)  6.049  (0.5) (0.637)  (0.066)
2

(0.5)(0.5) ( 1.5)
 (0.008)
6

 6.049  0.3185 - 0.0008  0.0005  6.359

Example of Newton Gregory forward difference formula

Find the interpolating polynomial for the following data: Solution


f(0) = 1, f(1) = 0, f(2) = 1, f(3) = 10. Hence evaluate f(0.5) x0
u x
1

x ( x  1)
f ( x )  1  x (1)  (2)
2!

x ( x  1) ( x  2)
 6  x 3  2x 2  1
3!

f(0.5) = 0.625

9
Example of Newton Gregory forward difference formula

x0
Find the interpolating polynomial for the following data: u x
1
x ( x  1)
f ( x )  3  x (3)  (2)
2

x ( x  1)
 (0)
x!

 3  2x  x 2

Newton’s Backward Difference Interpolation formula Example of Newton Gregory Backward Interpolation formula

The values of tan x are given for values of x in the following


u (u  1) 2 u (u  1) ( u  2) 3 table. Estimate tan (0.26)
y  y n  u y n   yn   y n  ....
2! 3!

x  xn
where u 
h

Useful for interpolation near the end of tabular values.

10
Solution
0.26  0.3
u   0.8
0.05

(0.8)
f (0.26)  0.3093  (0.8)(0.054)  2
(0.2) (0.0014)

(0.8) (0.2) (1.2)


 (0.0004)  0.2659
6

Example of Newton Gregory Backward Interpolation formula


Solution

The deflection d measured at various distances x from one end of a


cantilever is given by the following table. Find d when x = 0.95

x 0 0.2 0.4 0.6 0.8 1.0


d 0 0.0347 0.1173 0.2160 0.2987 0.3333

0.95  1
u  0.25 d  0.3308 when x  0.95
0 .2

11
Example of Newton Gregory Backward Interpolation formula Solution

Find the interpolating polynomial which approximates the


following data.

18
f ( x )  35  ( x  4) (31)  ( x  4) ( x  3)
2!
( x  4) ( x  3) ( x  2) (6)
  x 3  2x 2  6x - 5
3!

Central Central difference interpolation formula


Difference
Interpolation
Formulae

Stirlings Bessels

These are used to find y at a value of x that


is in the middle of x0 and xn

12
Stirlings formula Problem

Apply sterling's formula to find f(14.2) from the following


 Dy  Dy 1  u 2 2
y  y0  u  0   2 D y 1 table:
 2 
2 2
u ( u 2  1)  D3 y  2  D3 y 1  u ( u  1) 4
   D y2
3! 2 4!
 
u ( u 2  1) (u 2  4)  D5 y  3  D5 y  2 
    ....
5! 2
 
x  x0
where u 
h
1 1
Stirlings formula is to be preferred if u
4 4

Solution Problem

Apply stirling's formula to find a polynomial f(x) of


x  x 0 14.2  14 degree 4 that approximates the following data and
u   0.1
h 2 hence find f(2.5)

2
 0.037  0.034  (0.1)
y  0.318  0.1   {0.003}
 2  2

(0.1) ((0.1) 2  1)  0.001  0.001


  
6  2 

 0.3215

13
Solution: x 3
u  x 3 Bessel's formula
1
u (u  1)  D 2 y1  D 2 y0 
y  y0  u Dy0   
 2  (2)  ( x  3) 2 2!  2 
f ( x )  1  ( x  3)   ( 4) 1
 2  2 (u  ) u (u  1)
( x  3)  2 D 3 y1
 8  8
 {( x  3) 2  1}   3!
3!  2 
(u  1) u (u  1) (u  2)  D 4 y2  D 4 y1 

( x  3) 2
4!

( x  3) 2  1 16 
4!

 2
  ....

x  x0
where u 
1

 2x 4  24 x 3  100x 2  168x  93
3
 h
1 3
f (2.5)  0.375 Bessel’s formula is to be preferred if u 
4 4

Problem
Solution
Using Bessels formula find f(12.5) for the data:
x  x 0 12.5  10
u   0.5
h 5

(0.5) (0.5)
f (12.5)  13  (0.5) (1)  ( 0.5)  0
2

 13.4375

14
Interpolation with unequal intervals Lagrange’s formula for unequal intervals:

 Newton backward and forward interpolation is If y = f(x) takes the values y0, y1, y2,….,yn
applicable only when x0, x1,…,xn-1 are equally corresponding to x = x0, x1, x2,…,xn then
spaced.

 Interpolation formulae for unequally spaced values of ( x  x 1 ) ( x  x 2 )...(x  x n )


f (x)  f (x 0 )
x. ( x 0  x 1 ) ( x 0  x 2 )...(x 0  x n )

( x  x 0 ) ( x  x 2 ) ( x  x 3 )...( x  x n )
1. Lagrange’s formula for unequal intervals  f (x1 )
( x 1  x 0 ) ( x 1  x 2 ) ( x 1  x 3 )...( x 1  x n )
2. Newton’s Divided differences formula

Problem

( x  x 0 ) ( x  x 1 ) ( x  x 3 )...( x  x n ) Given the values


 f ( x 2 )  ....
( x 2  x 0 ) ( x 2  x 1 ) ( x 2  x 3 )...( x 2  x n )

( x  x 0 ) ( x  x 1 ) ( x  x 2 )...( x  x n 1 )
 f (x n )
( x n  x 0 ) ( x n  x 1 ) ( x n  x 2 )...( x n  x n 1 ) Evaluate f(9) using Lagrange's formula

is known as the lagrange's interpolation formula

15
Solution
(x  x 1 ) ( x  x 2 )...(x  x n ) ( x  x 0 ) ( x  x 2 ) (x  x 3 )...(x  x n )
f ( x 0 )  ( x  x ) (x  x ) (x  x )...(x  x ) f ( x 1 )
(9  5) (9  7) (9  11) (9  17)
f (x) 
(x 0  x 1 ) ( x 0  x 2 )...(x 0  x n )
 (2366)
(13  5) (13  7) (13  11) (13  17)
1 0 1 2 1 3 1 n

(9  7) (9  11) (9  13) (9  17)


f (9)  (150) (9  5) (9  7) (9  11) (9  13)
(5  7) (5  11) (5  13) (5  17)  (5202)  810
(17  5) (17  7) (17  11) (17  13)
(9  5) (9  11) (9  13) (9  17)
 .392
(7  5) (7  11) (7  13) (7  17)
f (9)  810
(9  5) (9  7) (9  13) (9  17)
 (1452)
(11  5) (11  7) (11  13) (11  17)

ii) Divided differences (D) second divided difference


Divided difference of order 1

y1  y 0 Dy 1  Dy 0
D2 f ( x 0 )  D2 y 0 
Df ( x 0 )  Dy 0   [x 0 , x1 ] x2  x0
x1  x 0
[ x1 , x2 ]  [ x0 , x1 ]
y y   [ x0 , x1 , x2 ]
Dy1  2 1  [ x1 , x2 ] x2  x0
x2  x1 Dy2  Dy1
D 2 y1 
x3  x1
y n  y n 1 [ x2 , x3 ]  [ x1 , x2 ]
Dy n 1   [ x n 1 , x n ]  [ x1 , x2 , x3 ]
x n  x n 1 x3  x1
Similarly D3 y 0 ,.... can be defined

16
Problem
Newton's divided difference interpolation formula Given the values

2
y  f ( x )  y 0  ( x  x 0 ) Dy 0  ( x  x 0 ) ( x  x 1 ) D y 0
Evaluate f(9) using Newton's divided difference formula
 ( x  x 0 ) ( x  x1 )( x  x 2 ) D3 y 0

 ...  ( x  x 0 ) ( x  x 1 ) ...(x  x n ) Dn y 0

is called the Newton's divided difference formula.

Newton's divided difference formula


Problem
Using
i) Langranges interpolation and
ii) divided difference formula.
Find the value of y when x = 10.

f(9) = 150 + 121 (9 - 5) + 24 (9 - 5) (9 - 7)


+ 1(9 - 5) (9 - 7) (9 - 11) = 810

17
Solution Divided difference
Lagranges formula
(10  6) (10  9) (10  11)
y  f (10)   12
(5  6) (5  9) (5  11)

(10  5)(10  9)(10  11) (10  5)(10  6)(10  11)


  13   14
(6  5)(6  9)(6  11) (9  5)(9  6)(9  11)

(10  5)(10  6)(10  9) 44


  16 
(11  5)(11  6)(11  9) 3

Problem
f (10)  12  (10  5)
If y(1) = -3, y(3) = 9, y(4) =30, y(6) = 132 find the
 1 lagranges interpolating polynomial that takes the same
 (10  5)(10  6).   values as y at the given points.
 6

 1  Given:
 (10  5)(10  6)(10  9)  
 20 

44

3

18
Problem
Solution
( x  3) ( x  4) ( x  6)
Find the interpolating polynomial using Newton divided
f (x)  . ( 3) difference formula for the following data:
(1  3)(1  4)(1  6)

( x  1)( x  4)( x  6) ( x  1)( x  3)( x  6)


 .9  .30
(3  1)(3  4)(3  6) (4  1)(4  3)( 4  6)

( x  1)( x  3)( x  4)
 .132
(6  1)(6  3)(6  4)

 x 3 - 3x 2  5x - 6

Solution

F(x) = 2 + (x - 0)(1) + (x - 0) (x - 1) (4) + (x - 0) (x - 1) (x - 2) 1


= x3 + x2 - x + 2

19

You might also like