Professional Documents
Culture Documents
21 Numerical Differentiation
21 Numerical Differentiation
21 Numerical Differentiation
Objective
Solving the problem of Rate of Change of physical quantities
df d df f f
f ' ( x) = , f ' ' ( x) = , etc f ' ( x, y ) = , f ' ' ( x, y ) = , etc
x x x
Numerical Differentiation dx dx dx
1 2
3 4
Backward Diff. Approx. -from (1b), and using 2 terms Forward Approx f ( xi +1 ) − f ( xi )
f '( xi ) = ; E_ a =
hf ( xi )
h 2!
f ( xi ) − f ( xi −1 ) hf ' ' ( xi ) f ( xi +1 ) − f ( xi ) cos(.82) − cos(.8)
f ' ( xi ) = + = + O ( h) (3) h = 0.02, f '(0.8) = = - 0.7242751
h 2! h 0.02
cos(.82) − cos(.8)
Central Diff. Approx. -from (1a-1b), and using 2 terms h = 0.01, f '(0.8) = = - 0.72082764
0.01
f ( xi +1 ) − f ( xi −1 ) 2h f '''( xi ) f ( xi +1 ) − f ( xi −1 )
2
Associated Error true & approx
f '( xi ) = + + O(h 2 ) ( 4) 0.02 cos(.8)
2h 3! 2h h = 0.02, Ea = = .0069671
2
E t =|− sin(0.8) − f '(0.8)| = .00691901
5 6
5 6
LF_S20 1
MTH 510 Numerical Analysis 7/30/2020
Central Approx
Backward Expansion;
h TRUE Central Error Rel ER (%) Approx Er
4 f ' ' ( xi )h 2 8 f ' ' ' ( xi )h 3
0.02 -0.717356091 -0.717308268 -4.782E-05 0.00666653 4.645E-05 f ( xi − 2 ) = f ( xi ) − 2 f ' ( xi )h + − + .... (1d )
0.01 -0.717356091 -0.717344135 -1.196E-05 0.00166666 1.161E-05 2! 3!
7 8
7 8
9 10
11 12
LF_S20 2
MTH 510 Numerical Analysis 7/30/2020
13 14
Central Approx
• Derivative of data with error-find best-fit (Least
h TRUE Central Error Rel ER (%) Square regression), derivative on the basis of the
0.02 -0.71735609 -0.717356087 -3.8E-09 5.33E-07 function
0.01 -0.71735609 -0.717356091 -2.4E-10 3.33E-08 15 16
15 16
Example 3: Unequally spaced Data f ' ( x), & f ( x)dx for Data with Error
Find the derivative of the function a) Data free of error b) Data with error
30 30
f ( x) = 5 xe − x 25
f (x) 25 f (x)
20 20
10 10
0 0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
17 18
LF_S20 3
MTH 510 Numerical Analysis 7/30/2020
Estimate;
a) the velocity (v) and
b) the acceleration (a)
19 20
19 20
280
Measured Displacement vs time data
Using the least square polynomial
240
220
Distance [m]
200
180
160
140
0 0.5 1 1.5 2 2.5 3 3.5 4
Time [s]
a) The velocity;
v(t ) = P2 ' (t ) = 70.4297 − 20.3568t m / s
b) The acceleration
a(t ) = P2 ' ' (t ) = 20.3568 m / s 2 21 22
21 22
Questions?
23
23
LF_S20 4