Numerical Method Slides SHB Chapter5
Numerical Method Slides SHB Chapter5
NUMERICAL DIFFERENTIATION
Introduction
Definition: The method of obtaining the derivative of a
function using a numerical technique.
There are two situations where numerical differentiation is
required:
Method 1: Differencing
Continuous Functions
Method 1a: Forward Difference Quotient
Method 1b: Central Difference Quotient
+ = + + "
. 5.1
2
By rearranging the terms. We get:
+ () "
=
. 5.2
2
Thus, if is chosen to sufficiently small, () can be
approximated by:
+
=
. 5.3
=
. 5.5
Example 5.1
Estimate approximate derivative of = 2 at = 1 for
= 0.2,0.1,0.05 0.01 using the first order forward difference
formula.
Solution 5.1
Step 1: Use the first order forward difference formula:
+ ()
Step 2: Replace
1 + (1)
Error
0.2
2.2
22.2 =0.2
0.1
2.1
22.1 =0.1
0.05
2.05
22.05 =0.05
0.01
2.01
22.01 =0.01
= + +
2!
3
+ 1
. 5.6
Similarly,
2
3
= + 1
2!
3!
. 5.7
+ = 2 +
1 + 2
. 5.8
3!
We have:
+ ( )
=
. 5.9
2
*Equation 5.9 is called the second-order central difference formula.
*This is also known as three-point formula.
Example 5.2
=
2
Solution 5.2
Step 1: By replacing : 1 =
1+ (1)
2
Error
0.2
2.0
0.1
2.0
0.05
2.0
. 5.11
We know that:
2
3
+ = + + +
2!
3!
and
2
3
= +
2!
3!
Adding these two expansions gives
+ + ( ) = 2 + 2
. 5.12
. 5.13
Therefore:
+ 2 + ( )
=
2
. 5.14
+ 2 + ( )
=
2
. 5.15
Example 5.3
Find approximation to second derivative of cos at = 0.75 with
= 0.01. Compare with the true value.
Solution 5.4
Step 1: =
+ 2 +()
2
0.75 =
0.012
0.7248360 2 0.7316888 + 0.7384685
0.75 =
0.0001
1.4633046 1.4633776
0.75 =
0.0001
0.75 = 0.73000
Method 2: Differentiating
Tabulated Functions
For Tabulated form
When function values are available in tabulated form, we
may approximate this function by an interpolation
polynomial () and the differentiate ().
We will use here Newtons divided difference interpolation
polynomial.
Step 1: Let us first consider the linear equation
1 = 0 + 1 ( 0 )
Step 2: The approximate derivative of the function is
given by = 1 = 1
1 (0 )
1 0
+ ()
=
Two-point forward
difference formula
Three-point forward
3 + 4 + ( + 2) difference formula
3 4 + ( 2)
=
2
Three-point backward
difference formula
Example 5.4
The table below gives the values of distance travelled by a
car at various time intervals during the initial running.
Time ()
Distance
travelled
()
10
14.5
19.5
25.5
32.0
Solution 5.4
Step 1: We know that velocity is given by the first derivative
of (). At = 5, we use the three-point forward difference,
3 + 4 + ( + 2)
=
2
Step 2: Then
3 10 + 4 14.5 19.5)
=
2(1)
= 4.25 /
25.5 14.5
2(1)
= 5.5 /
Step 4: At = 9, we use the three-point backward difference
3 9 4 8 + (7)
9 =
2
3 32 4 25.5 + 19.5
2
9 = 6.75 /
9 =