Uploaded by Precious Udtohan

M7.-Numerical-Differentiation (1)

advertisement
Title : Numerical Differentiation
Intended Learning Outcomes :
At the end of this lesson, you should be able to :
1. Estimate the derivative using the forward divided difference
2. Estimate the derivative using the backward divided difference
3. Estimate the derivative using the centered divided difference
Discussions :
Finite Divided Difference
First Forward Difference
f ( x i+1 ) −f ( x i )
f’ ( x )=
+O ( x i+i−x i )
x i+1 −x i
or
f’ ( x )=
Δfi
h
+O ( h )
where : h = step size
Δfi = first forward difference
O(h) = error
The term “forward” refers to the use i then i+1 for data computations
First Backward difference
f’ ( x )=
f ( x i ) −f ( x i−1 )
h
+O ( h )
First Centered Difference
f’ ( x )=
f ( x i+ 1 ) −f ( x i −1 )
2h
+O ( h2 )
Numerical Differentiation
page 1 of 3
Second Forward Difference
f'' ( x )=
f ( xi+ 2 )−2 f ( x i+1 ) +f ( xi )
h2
+O ( h )
Second Backward Difference
f'' ( x )=
f ( xi −2 )−2 f ( x i−1 ) +f ( x i )
h2
+O ( h )
Second Centered Difference
f'' ( x )=
f ( xi −1 )−2 f ( x i ) +f ( x i−1 )
h2
+O ( h2 )
Illustrative Problem 1.
Let f(x) = x4 – 5.1x3 + 5x2 +5x – 6. Estimate the first derivative f '(1.5) using the forward,
backward, and centered difference approximations.
Estimate the second derivative f''(1.5) using the second centered difference.
Use step size h = 0.01 and calculate the percent error.
Solution :
1. Calculate the "exact value" of f '(1.5)
f(x) = x4 – 5.1x3 + 5x2 +5x – 6.
f ' (x) = 4x3 – 15.3x2 + 10x +5
f '' (x) = 12x2 – 30.6x + 10
at x = 1.5
f ' (1.5) = 4(1.5)3 – 15.3(1.5)2 + 10(1.5) +5 = -0.925
f '' (1.5) = 12(1.5)2 - 30.6(1.5) +10 = -8.9
2. Prepare and populate the table
x
1.49
1.5
1.51
f(x) = x4 – 5.1x3 + 5x2 +5x – 6
0.608804
0.600000
0.590306
subscript
i-1
i
i+i
3. Calculate the approximate derivatives
First Forward Difference
f ' (1.5) ≈ (0.608804 –2(0.60) + 0.590306)/0.012 ≈ -8.9
First Backward Difference
Numerical Differentiation
page 2 of 3
f ' (1.5) ≈ (0.6 – 0.608804)/0.01 ≈ -0.8804
First Centered Difference
f ' (1.5) ≈ (0.590306 – 0.608804)/0.02 ≈ -0.9249
Second Centered Difference
f ''(1.5) ≈ (0.590306 – 0.608804)/0.02 ≈ -8.9
4. Calculate the percent error
First Forward Difference
%Error = | [-0.9694 - (-0.925)]/-0.925 | x 100% = 4.80 %
First Backward Difference
%Error = | [-0.8804 - (-0.925)]/-0.925 | x 100% = 4.82 %
First Centered Difference
%Error = | [-0.9249 - (-0.925)]/-0.925 | x 100% = 0.0108 %
Second Centered Difference
%Error = 0%
Self Assessment(Problem Set) :
P1. Let f(x) = x4 – 3x3 + 6x2 +5x – 9. Estimate the first derivative f '(2) using the forward,
backward, and centered difference approximations. Use step size h = 0.02 and calculate the percent
error.
P2. Let f(x) = x4 – 3x3 + 6x2 +5x – 9. Estimate the second derivative f''(2) using the second
forward, backward, centered difference approximations. Use step size h = 0.02 and calculate the
percent error.
References :
1. Applied Numerical Methods with MATLAB for Engineers and Scientist
Steven C. Chapra, McGraw Hill International Edition c.2005
2. Elementary Numerical Analysis 3rd Edition
Kendall Atkinson &Weimin Han, John Wiley and Sons c.2004
3. Numerical Methods for Engineers 5th Edition
Steven C. Chapra & Raymond P. Canale, McGraw Hill International Edition c.2006
Numerical Differentiation
page 3 of 3
Download