Forward Divided Difference

Forward 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 + Δx ) − f ( x )
f ′( x ) =
Δx → 0
Δx
.
Slope at xi
y
f(x)
xi
2
x
http://numericalmethods.eng.usf.edu
Forward Divided Difference
f (x + Δx ) − f (x )
f ′( x ) ≅
Δx
f (x)
x
3
x + Δx
f (x i + Δ x ) − f (x i )
f ′( x i ) ≅
Δx
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
the first derivative of
Δt = 2s.
t is given in seconds. Use forward difference approximation of
ν(t ) to calculate the acceleration at t = 16s. Use a step size of
Solution:
ν(ti +1 ) − ν(ti )
a (ti ) ≅
Δt
ti = 16
4
http://numericalmethods.eng.usf.edu
Example (contd.)
Δt = 2
t i +1 = t i + Δt = 16 + 2 = 18
a (16 ) =
ν (18) − ν (16 )
2
⎡
⎤
14 × 10 4
ν (18) = 2000 ln ⎢
⎥ − 9.8(18) = 453.02m / s
4
(
)
14
×
10
−
2100
18
⎣
⎦
⎡
⎤
14 ×10 4
= 392.07m / s
ν (16) = 2000 ln ⎢
⎥ − 9.8(16)
4
⎣14 ×10 − 2100(16) ⎦
5
http://numericalmethods.eng.usf.edu
Example (contd.)
Hence
a(16) =
ν (18) −ν (16)
2
The exact value of
= 453.02 − 392.07 = 30.475m / 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 − 30.475
×100
29.674
= 2.6993%
=
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 forward difference method.
f ' (0.2)
88.69336
84.26239
82.15626
81.12937
80.62231
80.37037
80.24479
80.18210
80.15078
80.13512
80.12730
Ea
-4.430976
-2.106121
-1.0269
-0.507052
-0.251944
-0.125579
-0.062691
-0.031321
-0.015654
-0.007826
εa %
5.258546
2.563555
1.265756
0.628923
0.313479
0.156494
0.078186
0.039078
0.019535
0.009767
Significant
digits
0
1
1
1
2
2
2
3
3
3
Et
εt %
-8.57389
-4.14291
-2.03679
-1.00989
-0.50284
-0.25090
-0.12532
-0.06263
-0.03130
-0.01565
-0.00782
10.70138
5.170918
2.542193
1.260482
0.627612
0.313152
0.156413
0.078166
0.039073
0.019534
0.009766
http://numericalmethods.eng.usf.edu
Effect of Step Size in Forward
Divided Difference Method
Initial step size=0.05
92
f'(0.2)
88
84
80
76
0
1
2
3
4
5
6
7
8
9
10
11
12
Num ber of tim es step size halved, n
9
http://numericalmethods.eng.usf.edu
Effect of Step Size on
Approximate Error
Number of times step size halved, n
0
0
2
4
6
8
10
12
-1
Ea
-2
-3
-4
Initial step size=0.05
-5
10
http://numericalmethods.eng.usf.edu
Effect of Step Size on Absolute
Relative Approximate Error
6
5
Initial step size=0.05
|Ea| %
4
3
2
1
0
0
1
2
3
4
5
6
7
8
9
10
11
12
Num ber of tim es step size halved, n
11
http://numericalmethods.eng.usf.edu
Effect of Step Size on Least
Number of Significant Digits
Correct
Least number of significant digits
correct
4
Initial step size=0.05
3
2
1
0
1
2
3
4
5
6
7
8
9
10
11
Num ber of tim es step size halved, n
12
http://numericalmethods.eng.usf.edu
Effect of Step Size on True Error
Num ber of tim es step size halved, n
0
0
2
4
6
8
10
12
Et
-3
-6
-9
Initial step size=0.05
Initial step size=0.05
13
http://numericalmethods.eng.usf.edu
Effect of Step Size on Absolute
Relative True Error
Initial step size=0.05
12
10
|Et| %
8
6
4
2
0
1
2
3
4
5
6
7
8
9
10
11
Number of times step size halved, n
14
http://numericalmethods.eng.usf.edu