Finite Difference
Finite Difference
By x0 +3h y3
Dr. Pradeep K. Goyal
x0 +4h y4
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 yrk k C1yrk1 k C2 yrk2 ....(1) kyr
2
Example:
Df (10) 1.54
D2f (10) 0.58
D3f (20) 0.03
D4f (15) 0.04
3
Backward difference operator () Backward difference table
Let y = f(x)
We define f(x) = f(x) - f(x - h)
1. Given
4
Central Difference Operator ()
h h
f (x ) f x f x
2 2
f ( x 0 h / 2) f ( x1 ) f ( x 0 )
y3 / 2 y2 y1 Dy1 y2
y 7 / 2 5 / 2 2 y 3
yn1/ 2 yn yn1 Dyn1 yn
5
Problem Problem
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)
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
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
(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
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
x0
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
x xn
where u
h
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.95 1
u 0.25 d 0.3308 when x 0.95
0 .2
11
Example of Newton Gregory Backward Interpolation formula Solution
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!
Stirlings Bessels
12
Stirlings formula Problem
Solution Problem
2
0.037 0.034 (0.1)
y 0.318 0.1 {0.003}
2 2
0.3215
13
Solution: x 3
u x 3 Bessel's formula
1
u (u 1) D 2 y1 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 y1
8 8
{( x 3) 2 1} 3!
3! 2
(u 1) u (u 1) (u 2) D 4 y2 D 4 y1
( 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.
( 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 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
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
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
17
Solution Divided difference
Lagranges formula
(10 6) (10 9) (10 11)
y f (10) 12
(5 6) (5 9) (5 11)
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 3)( x 4)
.132
(6 1)(6 3)(6 4)
x 3 - 3x 2 5x - 6
Solution
19