Professional Documents
Culture Documents
26 Numerical Differentiation 05-10-2022
26 Numerical Differentiation 05-10-2022
• Trapezoidal method
• Simpson’s method
Differentiation
• Forward difference
• Central difference
• Backward difference
• For the second case, analytical solutions are often impractical, and
Solution:
Solution:
Solution:
Solution:
As the derivatives are required near the middle of variate range, we
use Stirling’s formula.
Hence, the velocity is 5.34 cm/s and acceleration is –45.6 cm/s2.
Practice Problem 1:
Obtain dy/dx and d2y/dx2 for x = 1.2 from the following table:
Solution:
Solution:
xn = 2.2, yn = 9.0250 and h = 0.2 Use the difference Table in PP-1
dy/dx = 9.0228 and d2x/dy2 =8.992 (at x = 2.2) dy/dx = 7.3896 (at x = 2.0)
Forward difference
Forward difference
df f (x h) f (x)
lim
dx h0 h
Taylor’s Theorem
2
f x h f x hf x f x
h
2
3 4
h
f x
h f x ............
3! 4!
f x h f x
f x O(h) Forward difference
h approximation of first
f x h f x
derivative
f x O(h)
h
Dr. S K Behera BCHE201L CMCE 27
Backward difference
Backward difference
df f (x) f (x h)
lim
dx h0 h
Taylor’s Theorem
2
f x h f x hf x f x
h
2
3 4
h
f x
h f x ............
3! 4!
f x f x h
f x O(h) Backward difference
h approximation of first
f x f x h
derivative
f x O(h)
h
Dr. S K Behera BCHE201L CMCE 28
Centered difference
Centered difference
df f (x h) f (x)
lim
dx h0 h
Taylor’s Theorem 2
f x h f x hf x f x
h
2
3 4
h
f x
h f x ............ (1)
3! 4!
2 3 4
f x - h f x - hf x f x - f x f x -............ (2)
h h h
2 3! 4!
Eq. (1) – Eq. (2):
f x h f x h
f x O(h2 )
2h
Dr. S K Behera BCHE201L CMCE 29
High accuracy differentiation formulas
High-accuracy finite-difference formulas can be generated by including additional
terms from the Taylor series expansion.
f ‘xi 2
f xi1 f x i f x i h h ..... Terms refers to
2!
f (xi1 ) f (x h)
Solve for f’(x) f (xi1 ) f (x h)
f xi1 f xi f “xi
f xi
h
2!
h O h2
f xi2 2 f xi1 f xi
f “xi Oh
Substitute the
forward-difference
h2
approx. of f”(x)
2.
1.
2.
1.
2.
The latter version incorporates more terms of the Taylor series expansion and is more accurate.
Backward finite divided-difference formula
Improved versions can be developed for the
1. backward formulas as well as for the
approximations of the higher derivatives:
2. 1 Normal backward-divided difference formula
2 High accuracy backward-divided difference
formula (including more terms)
1.
2.
1.
2.
1.
2.
2.
1.
2.
1.
2.
o The notation O(h) and O(h2) respectively means that the error is of
order 'h' and h2.
Find f’(x) at x = 0.5 with h = 0.5 and 0.25 (exact sol. = - 0.9125)
Solution:
f x h f x
f x h O(h)
Forward difference
Centered difference
h 0.5, f (0.5) f (1) f (0) 0.2 1.2 1.0,f x f x h f x h O(h2 )
1 0 1 2h
t 9.6%
h 0.25, f (0.5) f (0.75) f (0.25) 0.63632813 1.10351563 -0.934, 2.4%
0.75 0.25 0.5
t
Et = (-0.9125+0.859375)×100/-0.9125 = 5.82%
The backward difference of accuracy O(h2) is computed as:
Et = (-0.9125+0.878125)×100/-0.9125 = 3.77%
Et = 0%