Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

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 i
f’ ( x )= +O ( h )
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 i ) −f ( x i−1 )
f’ ( x )= +O ( h )
h

First Centered Difference


f ( x i+1 ) −f ( x i−1 )
f’ ( x )= +O ( h2 )
2h

Numerical Differentiation page 1 of 3


Second Forward Difference
f ( xi+ 2 )−2 f ( x i+1 ) +f ( xi )
f'' ( x )= 2
+O ( h )
h

Second Backward Difference


f ( xi−2 )−2 f ( x i−1 ) +f ( x i )
f'' ( x )= 2
+O ( h )
h

Second Centered Difference


f ( xi−1 )−2 f ( x i ) +f ( x i−1 )
f'' ( x )= 2
+O ( h2 )
h

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. Use step size h = 0.10 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
at x = 1.5
f ' (1.5) = 4(1.5)3 – 15.3(1.5)2 + 10(1.5) +5 = -0.925

2. Prepare and populate the table

x f(x)
1.4 0.6472 i-1
1.5 0.6000 i
1.6 0.4640 i+i

3. Calculate the approximate derivative


Forward Difference
f ' (1.5) ≈ (0.4640 – 0.60)/0.10 ≈ -1.36

Backward Difference
f ' (1.5) ≈ (0.6 – 0.6472)/0.10 ≈ -0.472

Centered Difference
f ' (1.5) ≈ (0.4640 – 0.6472)/0.20 ≈ -0.916

Numerical Differentiation page 2 of 3


4. Calculate the percent error
Forward Difference
%Error = | [-1.36 - (-0.925)]/-0.925 | x 100% = 47.03%

Backward Difference
%Error = | [-0.472 - (-0.925)]/-0.925 | x 100% = 48.97%

Centered Difference
%Error = | [-0.916 - (-0.925)]/-0.925 | x 100% = 0.97%

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.10 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

You might also like