Professional Documents
Culture Documents
Module 9: Numerical Differentiation
Module 9: Numerical Differentiation
Module 9: Numerical Differentiation
For a given set of points, two approaches can be used to calculate a numerical
approximation of the derivative at one of the points.
The second approach is to approximate the points with an analytical expression that can
be easily differentiated, and then to calculate the derivative by differentiating the analytical
expression. The approximate analytical expression can be derived by using the curve
fitting.
engr.mryjnprz
CENGR 3140
Numerical Solutions to CE Problems
Graphically speaking:
Forward, backward, and central difference formulas for the first derivative
Note: The derivative at point (xi) is calculated from the values of two points. The derivative is estimated as
the value of the slope of the line that connects the two points.
Forward difference – slope of the line that connects points (xi, f(xi)) and (xi+1, f(xi+1)).
𝑑𝑓 𝑓(𝑥 ) − 𝑓(𝑥 )
=
𝑑𝑥 𝑥 −𝑥
Backward difference – slope of the line that connects points (xi-1, f(xi-1)) and (xi, f(xi)).
𝑑𝑓 𝑓(𝑥 ) − 𝑓(𝑥 )
=
𝑑𝑥 𝑥 −𝑥
Central difference – slope of the line that connects points (xi-1, f(xi-1)) and (xi+1, f(xi+1)).
𝑑𝑓 𝑓(𝑥 ) − 𝑓(𝑥 )
=
𝑑𝑥 𝑥 −𝑥
engr.mryjnprz
CENGR 3140
Numerical Solutions to CE Problems
Sample Problem:
Consider the function f(x) = x3. Calculate its first derivative at point x = 3 numerically with
forward, backward, and central finite difference formulas and using:
a) Points x = 2, x = 3, and x = 4.
b) Points x = 2.75, x = 3, and x = 3.25.
Solution:
Analytical Differentiation:
f’(x) = 3x2
f’(3) = 3 (3)2 = 27
Numerical Differentiation:
37 − 27
𝑒𝑟𝑟𝑜𝑟 = ⋅ 100 = 37.04%
27
19 − 27
𝑒𝑟𝑟𝑜𝑟 = ⋅ 100 = 29.63%
27
28 − 27
𝑒𝑟𝑟𝑜𝑟 = ⋅ 100 = 3.704%
27
engr.mryjnprz
CENGR 3140
Numerical Solutions to CE Problems
29.3125 − 27
𝑒𝑟𝑟𝑜𝑟 = ⋅ 100 = 8.565%
27
24.8125 − 27
𝑒𝑟𝑟𝑜𝑟 = ⋅ 100 = 8.102%
27
27.0625 − 27
𝑒𝑟𝑟𝑜𝑟 = ⋅ 100 = 0.2315%
27
Note: Smaller separation between the points gives a significantly more accurate approximation.
engr.mryjnprz