Numerical Differentiation
1. What is numerical differentiation ?
Ans: Numerical differentiation is a process of calculating the derivatives of a function with the help of a
given set of values of that function.
2. What is tabulated function?
Ans: The function values are known but the function is unknown such functions are tabulated function.
3. Write first derivative of 𝑦 = 𝑓(𝑥) at 𝑥 = 𝑥0 by using Newton’s forward difference formula
𝑑𝑦 1 1 1 1
Ans: (𝑑𝑥 ) = ℎ [∆𝑦0 − 2 ∆2 𝑦0 + 3 ∆3 𝑦0 − 4 ∆4 𝑦0 + ⋯ … … . ]
𝑥=𝑥0
1.Theorem: Derivatives obtained by newtons forward difference interpolation formula:
Newtons forward difference interpolation formula is
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2)
𝑓(𝑎 + ℎ𝑢) = 𝑓(𝑥) = 𝑓(𝑎) + 𝑢∆𝑓(𝑎) + ∆2 𝑓(𝑎) + ∆3 𝑓(𝑎) +
2! 3!
𝑢(𝑢−1)(𝑢−2)(𝑢−3)
∆3 𝑓(𝑎) +……………………………….(1)
4!
Where 𝑥 = 𝑎 + 𝑢ℎ ………………………………………………………………………….(2)
𝑑𝑓 𝑑𝑢 1 𝑑𝑓
Hence, 𝑓 ′ (𝑥) = 𝑑𝑢 . 𝑑𝑥 = ℎ . 𝑑𝑢
1 2𝑢−1 3𝑢2 −6𝑢+2 4𝑢3 −18𝑢2 +22𝑢−6
⇒ 𝑓 ′ (𝑥) = ℎ [∆𝑓(𝑎) + ∆2 𝑓(𝑎) + ∆3 𝑓(𝑎) + ∆4 𝑓(𝑎) + ⋯ . . ].................(3)
2 6 24
Differentiating (3) with respect to 𝑥 we get,
1 6𝑢2 −18𝑢+11
𝑓′′ (𝑥) = ℎ2 [∆2 𝑓(𝑎) + (𝑢 − 1)∆3 𝑓(𝑎) + ∆4 𝑓(𝑎)+. . … . . ]....................................................(4)
12
Similarly,
1 12𝑢−18
𝑓′′′ (𝑥) = ℎ3 [∆3 𝑓(𝑎) + ∆4 𝑓(𝑎)+. . … . . ] …………………………………………………………(5)
12
Setting 𝑥 = 𝑎. i.e., 𝑢 = 0 in (3) ,(4) , (5) we get,
1 1 1 1
𝑓 ′ (𝑥) = ℎ [∆𝑓(𝑎) − 2 ∆2 𝑓(𝑎) + 3 ∆3 𝑓(𝑎) − 4 ∆4 𝑓(𝑎) + ⋯ . . ] ………………………………………….(6)
1 11
𝑓′′ (𝑥) = ℎ2 [∆2 𝑓(𝑎) − ∆3 𝑓(𝑎) + 12 ∆4 𝑓(𝑎)+. . … . . ].................................................................................(7)
1 3
𝑓′′′ (𝑥) = ℎ3 [∆3 𝑓(𝑎) − 2 ∆4 𝑓(𝑎)+. . … . . ] ………………………………………………………….……(8)
Equations (6) ,(7) and (8) gives the values of first 2nd and 3rd derivative at the starting value 𝑥 = 𝑎
Problem 1: Find the first and second derivatives of the function tabulated below at the point 𝑥 = 3.0
𝑥 3.0 3.2 3.4 3.6 3.8 4.0
𝑦 = 𝑓(𝑥) -14.0 -10.032 -5.296 0.256 6.672 14.0
𝑑𝑦 𝑑2 𝑦
Solution: Since we require 𝑑𝑥 and 𝑑𝑥 2 at 𝑥 = 3.0 which is near the beginning of the table so we shall use
Newton’s forward formula.
Now we construct the difference table is given below :
𝑥 𝑦 ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
3.0 -14.0
3.968
3.2 -10.032 0.768
4.736 0.048
3.4 -5.296 0.816 0
5.552 0.048 0
3.6 0.256 0.864 0
6.416 0.048
3.8 6.672 0.912
7.328
4.0 14.0
By Newton’s forward difference formula, we have,
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2)
𝑦(𝑥) = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 ……………………………………….(1)
2! 3!
taking up to third difference
Hence,
𝑥 − 𝑥0
𝑑𝑦 𝑑𝑦 𝑑𝑢 ℎ𝑒𝑟𝑒 𝑥 = 𝑥0 + 𝑢ℎ ⇒ u =
= 𝑑𝑢 . 𝑑𝑥 ℎ ]
𝑑𝑥 [ 𝑑𝑢 1
=
𝑑𝑥 ℎ
𝑑𝑦 1 2𝑢−1 3𝑢2 −6𝑢+2
⇒ 𝑑𝑥 = ℎ [∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 ] …………………………………………………(2)
2 6
Also,
𝑑2 𝑦 1
= ℎ2 [∆2 𝑦0 + (𝑢 − 1)∆3 𝑦0 ] ………………………………………………………………...(3)
𝑑𝑥 2
In our case 𝑥0 = 3.0 , ℎ = 0.2
Hence, 𝑥 = 𝑥0 + 𝑢ℎ
𝑥−𝑥0 3.0−3.0
⇒u= = =0
ℎ 0.2
From (2) we get
𝑑𝑦 1 1 1
(𝑑𝑥 ) = 0.2 [3.968 − 2 × 0.768 + 3 × 0.048]
𝑥=3.0
𝑑𝑦
⇒ (𝑑𝑥 ) = 18.0 (Ans:)
𝑥=3.0
From (3) we get
𝑑2 𝑦 1
(𝑑𝑥 2 ) = (0.2)2 [0.768 − 1 × 0.0480] = 18.0 (Ans:)
𝑥=3.0
Problem 2: Evaluate the first and second derivative of √𝑥 at 𝑥 = 15 from the following data
𝑥 15 17 19 21 23
𝑦 = √𝑥 3.873 4.123 4.354 4.583 4.796
Solution: Let 𝑦 = √𝑥 . To find the derivative of 𝑦 = √𝑥 at 𝑥 = 15 we use Newton’s forward difference
formula, we choose the origin at 𝑥0 = 15 . Here ℎ = 2
Hence,
𝑥−𝑥0 15−15
𝑢= = =0
ℎ 2
At 𝑥 = 15 , 𝑢 = 0
Now the difference table is as below
𝑥 𝑦 = √𝑥 ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
15 3.387
0.250
17 4.123 -0.019
0.231 0.017
19 4.354 -0.002 -0.031
0.229 -0.014
21 4.583 -0.016
0.213
23 4.796
By Newton’s forward difference formula, we have,
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2) 𝑢(𝑢−1)(𝑢−2)(𝑢−4)
𝑦(𝑥) = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 + ∆4 𝑦0 ……………………….(1)
2! 3! 4!
[ taking up to four differences]
Hence,
𝑥 − 𝑥0
𝑑𝑦 𝑑𝑦 𝑑𝑢 ℎ𝑒𝑟𝑒 𝑥 = 𝑥0 + 𝑢ℎ ⇒u=
= 𝑑𝑢 . 𝑑𝑥 ℎ ]
𝑑𝑥 [ 𝑑𝑢 1
=
𝑑𝑥 ℎ
𝑑𝑦 1 2𝑢−1 3𝑢2 −6𝑢+2 4𝑢3 −18𝑢2 +22𝑢−6
⇒ 𝑑𝑥 = ℎ [∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 + ∆4 𝑓(𝑎)] ………………………………(2)
2 6 24
Since 𝑢 = 0, so that
𝑑𝑦 1 1 1 1
(𝑑𝑥 ) = ℎ [∆𝑦0 − 2 ∆2 𝑦0 + 3 ∆3 𝑦0 − 4 ∆4 𝑦0 + ⋯ . . ]
𝑥=15
𝑑𝑦 1 1 1 1
⇒ 𝑑𝑥 = 2 [0.250 − 2 × (−0.019) + 3 × (0.017) − 4 × (−0.031)]
= 0.5 [0.250 + 0.0095 + 0.00567 + 0.00775]
= 0.13646
(Ans:)
Also, for 𝑢 = 0 we get,
𝑑2 𝑦 1 11
= [∆2 𝑦0 − ∆3 𝑦0 + ∆4 𝑦0 ] …………………………………………………...(3)
𝑑𝑥 2 ℎ2 12
𝑑2 𝑦 1 11
(𝑑𝑥 2 ) = 22 [−0.019 − 0.017 + 12 (−0.031)]
𝑥=15
1
= 4 [−0.019 − 0.017 − 0.0284]
= −0.0161.
(Ans:)
Problem 3: Find the value of sec 31° using the following table.
θ° 31° 32° 33° 34°
tan θ 0.6008 0.6249 0.6494 0.6745
𝑑𝑦
Solution: Let 𝑦 = tan θ . If we find 𝑑𝑥 at θ = 31° then we use Newton’s forward difference formula.
θ−θ0 31°−31°
In this case, ℎ = 1° , 𝑢 = = =0
h 1°
Now we construct the difference table is given below :
θ° tan θ° ∆𝑦 ∆2 𝑦 ∆3 𝑦
31° 0.6008
0.0241
32° 0.6249 0.0004
0.0245 0.0002
33° 0.6494 0.0006
0.0251
34° 0.6745
By Newton’s forward difference formula, we have,
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2)
𝑦(𝑥) = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 [taking up to third difference] ……………….(1)
2! 3!
Hence,
𝑥 − 𝑥0
𝑑𝑦 𝑑𝑦 𝑑𝑢 ℎ𝑒𝑟𝑒 𝜃 = 𝜃0 + 𝑢ℎ ⇒ u =
= 𝑑𝑢 . 𝑑𝜃 ℎ ]
𝑑𝜃 [ 𝑑𝑢 1
=
𝑑𝜃 ℎ
𝑑𝑦 1 2𝑢−1 3𝑢2 −6𝑢+2
⇒ 𝑑𝜃 = ℎ [∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 ] ……………………………………………….…(2)
2 6
Since 𝑢 = 0, so that
𝑑𝑦 1 1 1
(𝑑𝜃) = ℎ [∆𝑦0 − 2 ∆2 𝑦0 + 3 ∆3 𝑦0 ]
θ=31°
𝑑𝑦 1 1 1
(𝑑𝜃) = 1° [0.0241 − 2 × 0.0004 + 3 × 0.0002]
θ=31°
180
= [0.0241 − 0.0002 + 0.000067]
𝜋
180
= [0.023967]
𝜋
= 1.3732
𝑑𝑦
But 𝑦 = tan θ ⇒ 𝑑𝜃 = sec 2 θ
𝑑𝑦
(𝑑𝜃) = sec 2 31° = 1.3732
θ=31°
Hence, we get,
sec 31° = √1.3732 = 1.17184
(Ans:)