Central Divided Difference

Central Divided Difference
Topic: Differentiation
Major: General Engineering
Authors: Autar Kaw, Sri Harsha Garapati
5/21/2008
http://numericalmethods.eng.usf.edu
1
Definition
lim f ( x ) − f ( x − Δx )
f ′( x ) =
Δx → 0
Δx
.
Slope at xi
y
f(x)
xi
2
x
http://numericalmethods.eng.usf.edu
Central Divided Difference
f (x + Δx ) − f (x − Δx )
f ′( x ) ≅
2 Δx
f (x)
x − Δx
3
x
x + Δx
x
f (x i + Δ x ) − f (x i − Δ x )
f ′( x i ) ≅
2Δx
http://numericalmethods.eng.usf.edu
Example
Example:
The velocity of a rocket is given by
ν (t ) = 2000
where
ν
⎡
⎤
14 × 10 4
ln ⎢
⎥ − 9 . 8 t , 0 ≤ t ≤ 30
4
×
−
t
14
10
2100
⎣
⎦
given in m/s and t is given in seconds. Use central difference approximation of
the first derivative of
Δt = 2s.
Solution:
a (ti ) ≅
ν(t ) to calculate the acceleration at t = 16s. Use a step size of
ν (ti +1 ) −ν (ti − 1)
2 Δt
ti = 16
4
http://numericalmethods.eng.usf.edu
Example (contd.)
Δt = 2
t i +1 = t i + Δt = 16 + 2 = 18
ti −1 = ti − Δt
a (16 ) =
= 16 − 2 = 14
ν (18) −ν (14 ) ν (18) −ν (14 )
2( 2)
=
4
⎡
⎤
14 × 10 4
ν (18) = 2000 ln ⎢
− 9.8(18) = 453.02m / s
⎥
4
⎣14 × 10 − 2100(18)⎦
⎡
⎤
14 ×10 4
ν (14) = 2000 ln ⎢
⎥ − 9.8(14) = 334.24m / s
4
(
)
14
×
10
−
2100
14
⎣
⎦
5
http://numericalmethods.eng.usf.edu
Example (contd.)
Hence
a(16) =
ν (18) −ν (14)
4
The exact value of
= 453.02 − 334.24 = 29.695m / s 2
a(16) can be calculated by differentiating
⎡
⎤
14 × 10 4
ν (t ) = 2000 ln ⎢
⎥ − 9.8t
4
⎣14 × 10 − 2100t ⎦
as
d
[ν (t )] = − 4040 − 29.4t
dt
− 200 + 3t
a(16) = 29.674m / s 2
a(t ) =
6
http://numericalmethods.eng.usf.edu
Example (contd.)
The absolute relative true error is
εt =
TrueValue − ApproximateValue
×100
TrueValue
29 .674 − 29 .695
× 100
29 .674
= 0.070769 %
=
7
http://numericalmethods.eng.usf.edu
Effect Of Step Size
f ( x ) = 9e
Value of
h
0.05
0.025
0.0125
0.00625
0.003125
0.001563
0.000781
0.000391
0.000195
9.77E-05
4.88E-05
8
4x
f ' (0.2) Using Central Divided Difference difference method.
f ' (0.2)
80.65467
80.25307
80.15286
80.12782
80.12156
80.12000
80.11960
80.11951
80.11948
80.11948
80.11947
Ea
-0.4016
-0.100212
-0.025041
-0.00626
-0.001565
-0.000391
-9.78E-05
-2.45E-05
-6.11E-06
-1.53E-06
εa %
0.500417
0.125026
0.031252
0.007813
0.001953
0.000488
0.000122
3.05E-05
7.63E-06
1.91E-06
Significant
digits
1
2
3
3
4
5
5
6
6
7
Et
εt %
-0.53520
-0.13360
-0.03339
-0.00835
-0.00209
-0.00052
-0.00013
-0.00003
-0.00001
0.00000
0.00000
0.668001
0.16675
0.041672
0.010417
0.002604
0.000651
0.000163
4.07E-05
1.02E-05
2.54E-06
6.36E-07
http://numericalmethods.eng.usf.edu
Effect of Step Size in Central
Divided Difference Method
f'(0.2)
95
Initial step size=0.05
85
75
1
3
5
7
9
11
Num ber of tim es the step size is halved, n
9
http://numericalmethods.eng.usf.edu
Effect of Step Size on
Approximate Error
Num ber of steps involved, n
0
3
5
7
9
11
E(a)
1
-1
10
Initial step size=0.05
http://numericalmethods.eng.usf.edu
Effect of Step Size on Absolute
Relative Approximate Error
0.6
Initial step size=0.05
0.5
|E(a)|,%
0.4
0.3
0.2
0.1
0
0
1
2
3
4
5
6
7
8
9
10
11
12
Num ber of steps involved, n
11
http://numericalmethods.eng.usf.edu
Least number of significant digits
correct
Effect of Step Size on Least
Number of Significant Digits Correct
8
Initial step size=0.05
7
6
5
4
3
2
1
0
1
2
3
4
5
6
7
8
9
10
11
Num ber of steps involved, n
12
http://numericalmethods.eng.usf.edu
Effect of Step Size on True Error
Num ber of steps involved, n
0.0
-0.1
0
2
4
6
8
10
12
E(t)
-0.2
-0.3
-0.4
-0.5
-0.6
13
Initial step size=0.05
http://numericalmethods.eng.usf.edu
Effect of Step Size on Absolute
Relative True Error
0.8
0.7
Initial step size=0.05
0.6
|Et| %
0.5
0.4
0.3
0.2
0.1
0
1
2
3
4
5
6
7
8
9
10
11
Num ber of tim es step size halved,n
14
http://numericalmethods.eng.usf.edu