Numerical Differentiation
Numerical Differentiation: Numerical differentiation is the processes of calculating
the derivatives of a function by means of a set of given values of that function. The
problem is solved by representing by an interpolation formula and then differentiating
this formula as many times as desired.
For Newton’s forward formula:
x − x0 dy dy du 1 dy
u= and = . = ,
h dx du dx h du
u (u − 1) 2 u (u − 1)(u − 2) 3 u (u − 1)(u − 2)(u − 3) 4
y = y0 + uy0 + y0 + y0 + y0
2! 3! 4!
u (u − 1)(u − 2)(u − 3)(u − 4) 5 u (u − 1)(u − 2)(u − 3)(u − 4)(u − 5) 6
+ y0 + y0 + .....
5! 6!
(u 2 − 1) 2 (u 3 − 3u 2 + 2u ) 3 (u 4 − 6u 3 + 11u 2 − 6u ) 4
y = y0 + uy0 + y0 + y0 + y0
2 6 24
(u 5 − 10u 4 + 35u 3 − 50u 2 + 24u ) 5 (u 6 − 15u 5 + 85u 4 − 225u 3 + 274u 2 − 120u ) 6
+ y0 + y0 + .
120 720
(2u − 1) 2 (3u 2 − 6u + 2) 3
y0 + y0 + y0
2 6
dy 1 (4u − 18u + 22u − 6) 4 (5u − 40u + 105u − 100u + 24) 5
3 2 4 3 2
= + y0 + y0
dx h 24 120
(6u 5 − 60u 4 + 340u 3 − 676u 2 + 548u − 120) 6
+ y 0 + ....
720
2 (6u − 6) 3 (12u 2 − 36u + 22) 4
y0 + y0 + y0 +
d2y 1 6 24
=
dx 2 h 2 (20u 3 − 120u 2 + 210u − 100) 5 (30u 4 − 240u 3 + 1020u 2 − 1352u + 548) 6
y0 + y0 +
120 720
For the point x = x0 we have u = 0 . Hence on substituting this value of u in the
formulas above, we get
dy 1 1 1 1 1 1
Now = [y0 − y0 + y0 − y0 + y0 − y0 + ....]
2 3 4 5 6
dx x = x0 h 2 3 4 5 6
d 2 y 1 2 11 4 5 5 137 6
= 2 [ y0 − y0 + y0 − y0 + y0 − ....]
3
2
dx x = x0 h 12 6 180
For Newton’s backward formula:
dy 1 1 2 1 3 1 4 1 5 1 6
dx = [ y n + y n + y n + y n + y n + y n + ....]
x = xn h 2 3 4 5 6
d 2 y 1 2 11 4 5 5 137 6
= 2 [ y n + y n + y n + y n + y n + ....]
3
2
dx x = xn h 12 6 180
For Stirling’s formula:
x − x0 dy dy du 1 dy
u= and = . = ,
h dx du dx h du
(y −1 + y0 ) u 2 2 u (u 2 − 1) ( y −2 + y −1 ) u 2 (u 2 − 1) 4
3 3
y = y0 + u + y −1 + + y −2
2 2! 3! 2 4!
u (u 2 − 1)(u 2 − 2 2 ) ( y −3 + y −2 ) u 2 (u 2 − 1)(u 2 − 2 2 ) 6
5 5
+ + y −3
5! 2 6!
(y −1 + y0 ) (3u 2 − 1) ( y −2 + y −1 ) (4u 3 − 2u ) 4
3 3
+ u y −1 + + y −2
2
dy 1 2 3! 2 4!
=
dx h (5u 4 − 15u 2 + 4) ( y −3 + y −2 ) (6u 5 − 20u 3 + 8u ) 6
5 5
+ + y −
3
5! 2 6!
2 (3 y − 2 + 3 y −1 ) (12u 2 − 2) 4
+ +
d 2 y 1 −1
y u y −2
2 4 !
= 2
dx 2
h (20u − 30u ) ( y −3 + y − 2 ) (30u − 60u + 8) 6
3 5 5 4 2
+ + y −3
5! 2 6!
For the point x = x0 we have u = 0 . Hence on substituting this value of u in the
formulas above, we get
dy 1 (y −1 + y0 ) − 1 ( y −2 + y −1 ) 4 ( y −3 + y − 2 )
3 3 5 5
Now = [ − + + ....]
dx x = x0 h 2 3! 2 5! 2
d 2 y 1 2 1 4 8 6
2 = 2 [ y −1 − y −2 + y −3 + ....]
dx x = x0 h 12 6!
For Bessel’s formula:
x − x0 dy dy du 1 dy
u= and = . = ,
h dx du dx h du
y0 + y1 u (u − 1) ( y −1 + y0 ) u (u − 12 )(u − 1) 3
2 2
y= + (u − 2 )y0 +
1
+ y −1
2 2! 2 3!
u (u 2 − 1)(u − 2) ( y −2 + y −1 )
4 4
u (u − 12 )(u 2 − 1)(u − 2) 5
+ + y −2
4! 2 5!
(2u − 1) ( y −1 + y0 ) ( 12 − 3u + 3u ) 3
2 2 2
y0 + + y −1
dy 1 2! 2 3!
=
dx h (2 − 2u − 6u + 4u ) ( y −2 + y −1 )
2 3 4 4
(−1 + 5u − 10u + 5u )) 5
3 4
+ + y −2
4! 2 5!
(2 y −1 + 2 y0 ) (−3 + 6u ) 3
+ y −1
d2y 1 2 3!
= 2
dx 2
h (−2 − 12u + 12u 2 ) (4 y −2 + 4 y −1 ) (5 − 30u + 20u )) 5
2 3
+ + y −2
4! 2 5!
For the point x = x0 we have u = 0 . Hence on substituting this value of u in the
formulas above, we get
dy 1 1 ( y −1 + y 0 ) 1 3 1 ( y −2 + y −1 )
2 2 4 4
1 5
dx = y 0 − + y −1 + − y −2 + ..
x = x0 h 2 2 12 12 2 120
d 2 y 1 ( y −1 + y0 ) 1 ( y −2 + y −1 )
2 2 4 4
1 5
= 2 − y −1 − + y −2 + ..
3
2
dx x = x0 h 2 12 2 24
Example1: The following values of a distance traveled by a car at various time
intervals during the initial running
Time, t (s ) 5 6 7 8 9
Distance traveled, 10.0 14.5 19.5 25.5 32.0
s (t ), (km)
Estimate the velocity and acceleration at time t = 5, 7, 9 .
5−5
Solution: : Here, t 0 = 5 , s0 = 10. , h = 1 , t = 5 , u = =0
1
First we prepare forward difference table as follow
s s s s
2 3 4
t s
5 10.0
4.5
6 14.5 0.5
5.0 0.5
7 19.5 1.0 − 1.0
6.0 − 0.5
8 25.5 0.5
6.5
9 32.0
By Newton’s forward formula, the velocity at t = 5 is
ds 1 1 2 1 3 1 4
dt = h [y0 − 2 y0 + 3 y0 − 4 y0 ]
t =5
1 1 1 1
= [4.5 − 0.5 + 0.5 − (−1.)]
1 2 3 4
14
= = 4.67
3
By Newton’s forward formula, the acceleration at t = 5 is
d 2s 1 2 11 4
2 = 2 [ y0 − y0 + y0 ]
3
dt t =5 h 12
1 11 11
= 2 [0.5 − 0.5 + (−1) = −
1 12 12
By Newton’s backward formula, the velocity at t = 9 is
ds 1 1 2 1 3 1 4
dt = [ y n + y n + y n + yn ]
t =9 h 2 3 4
1 1 1 1
= [6.5 + 0.5 + (−0.5) + (−1)]
1 2 3 4
19
= = 6.33
3
By Newton’s backward formula, the acceleration at t = 9 is
d 2s 1 2 11 4
2 = 2 [ y n + y n + y n ]
3
dt t =9 h 12
1 11
= 2 [0.5 − 0.5 + (−1)]
1 12
11
=−
12
7−7
Here, t 0 = 7 , s0 = 19.5 , h = 1 , t = 7 , u = =0
1
First we prepare central difference table as follow
s s s s
2 3 4
t u s
5 −2 10.0
4.5
6 −1 14.5 0.5
5.0 0.5
7 0 19.5 1.0 − 1.0
6. 0 − 0.5
8 1 25.5 0.5
6.5
9 2 32.0
By Stirling’s formula, the velocity at t = 7 is
ds 1 (y −1 + y0 ) ( y −2 + y −1 )
3 3
dt = h [ 2
−
12
]
t =7
1 (5 + 6) (0.5 − 0.5)
= [ − ]
1 2 12
= 5.5
By stirling’s formula, the acceleration at t = 7 is
d 2s 1 2 1 4
2 = 2 [ y −1 − y −2 ]
dt t =7 h 12
1 1 13
= 2 [1 − (−1)] = = 1.0833
1 12 12