Professional Documents
Culture Documents
Numerical Chapter-5
Numerical Chapter-5
5.1. Introduction
Calculus is the mathematics of change. Because engineers and scientists must continuously deal with
systems and processes that change, calculus is an essential tool of their profession.
There are so many methods available to find the derivative and definite integration of a function. But
when we have a complicated function or a function given in tabular form, then we use numerical
methods. In this unit, we shall be concerned with the problem of numerical differentiation and integration.
The function to be differentiated or integrated will typically be in one of the following three forms:
1. A simple continuous function such as a polynomial, an exponential or a trigonometric function.
2. A complicated continuous function that is difficult or impossible to differentiate or integrate
directly.
3. A tabulated function where values of 𝑥 and 𝑓(𝑥) are given at a number of discrete points
In the first case, the derivative or integral of a simple function may be evaluated analytically using
calculus. For the second case, analytical solutions are often impractical, and sometimes impossible, to
obtain. In these instances, as well as in the third case of discrete data, approximate methods must be
employed.
5.2. Numerical Differentiation
The method of obtaining the derivatives of a function using a numerical technique is known as numerical
differentiation. There are essentially two situations where numerical differentiation is required.
1. The function values are known but the function is unknown, such functions are called tabulated
function.
2. The function to be differentiated is complicated and, therefore, it is difficult to differentiate.
The choice of the formula is the same as the choice for interpolation. If the derivative at a point near
the beginning of a set of values given by a table is required then we use Newton forward interpolation
formula, and if the same is required at a point near the end of the set of given tabular values, then we
use Newton backward interpolation formula. The central difference formula (Bessel’s and Sterling’s)
used to calculate value for points near the middle of the set of given tabular values. If the values of 𝑥
are not equally spaced, we use Newton’s divided difference interpolation formula to get the required
value of the derivative.
5.2.1. Derivatives Using Newton’s Forward Interpolation Formula
Newton’s forward interpolation is given by
𝑷(𝑷−𝟏) 𝟐 𝑷(𝑷−𝟏)(𝑷−𝟐) 𝟑 𝑷(𝑷−𝟏)(𝑷−𝟐)...(𝑷−𝒏+𝟏) 𝒏
𝒚(𝒙) = 𝒚𝟎 + 𝑷∆𝒚𝟎 + 𝟐!
∆ 𝒚𝟎 + 𝟑!
∆ 𝒚𝟎 + ⋯+ 𝒏!
∆ 𝒚𝟎 …….(𝒊)
𝒙−𝒙𝟎
Where 𝑷 = 𝒉
1
𝑑𝑦 𝑑𝑦 𝑑𝑃 1 𝑑𝑦
And = . =
𝑑𝑥 𝑑𝑃 𝑑𝑥 ℎ 𝑑𝑃
Therefore
𝑑𝑦 1 2𝑃−1 2 3𝑃2 −6𝑃+2 3 4𝑃3 −18𝑃2 +22𝑃−6 4
𝑑𝑥
= ℎ [∆𝑦0 + 2!
∆ 𝑦0 + 3!
∆ 𝑦0 + 4!
∆ 𝑦0 + ⋯ +] …………(𝑖𝑖)
1 6𝑃2 −18𝑃+11 4
= ℎ2 [∆2 𝑦0 + (𝑃 − 1)∆3 𝑦0 + 12
∆ 𝑦0 + ⋯ ] …………………..(𝑖𝑖𝑖)
𝒅𝟑 𝒚 𝟏 𝟑
Similarly, [𝒅𝒙𝟑 ] = 𝒉𝟑 [∆𝟑 𝒚𝟎 − 𝟐 ∆𝟒 𝒚𝟎 + ⋯ ]
𝒙=𝒙𝟎
𝑑𝑦 𝑑𝑦 𝑑𝑃 1 𝑑𝑦
And 𝑑𝑥 = 𝑑𝑃 . 𝑑𝑥 = ℎ 𝑑𝑃
2
𝑑2 𝑦 1 𝟔𝑷+𝟔 𝟑 𝟏𝟐𝑷𝟐 +𝟑𝟔𝑷+𝟐𝟐 𝟒
𝑑𝑥 2
= ℎ2 [𝛁 𝟐 𝒚𝒏 + 𝟔
𝛁 𝒚𝒏 + 𝟐𝟒
𝛁 𝒚𝒏 + ⋯ ] ……….(𝑖𝑣)
𝒅𝟑 𝒚 𝟏 𝟑
Similarly, [𝒅𝒙𝟑 ] = 𝒉𝟑 [𝛁 𝟑 𝒚𝒏 + 𝟐 𝛁 𝟒 𝒚𝒏 + ⋯ ]
𝒙=𝒙𝒏
Example
From the following table, find
𝑑𝑦
i. [𝑑𝑥 ]
𝑥=1.1
𝑑2 𝑦
ii. [𝑑𝑥 2 ]
𝑥=1.1
𝑑𝑦
iii. [𝑑𝑥 ]
𝑥=1.5
𝑥 1.0 1.1 1.2 1.3 1.4 1.5 1.6
𝑦 7.989 8.403 8.781 9.129 9.451 9.750 10.031
Solution
Since the approximation is required around the beginning and end of the table we apply Newton’s
forward difference formula for 𝒊 &𝒊𝒊𝒊 Newton’s backward difference formula for𝒊𝒊.
Forward difference table:
𝑥 𝑦 ∆ ∆2 ∆3 ∆4 ∆5 ∆6
1.0 7.989
0.414
1.1 8.403 −0.036
0.378 0.006
1.2 8.781 -0.030 -0.002
0.348 0.004 0.001
1.3 9.129 -0.026 -0.001 -0.002
0.322 0.003 -0.001
1.4 9.451 -0.023 -0.002
0.299 0.005
1.5 9.750 -0.018
3
0.281
1.6 10.031
We have
𝒅𝒚 𝟏 𝟏 𝟏 𝟏 𝟏 𝟏
i. [𝒅𝒙] = 𝒉 [∆𝒚𝟎 − 𝟐 ∆𝟐 𝒚𝟎 + 𝟑 ∆𝟑 𝒚𝟎 − 𝟒 ∆𝟒 𝒚𝟎 + 𝟓 ∆𝟓 𝒚𝟎 − 𝟔 ∆𝟔 𝒚𝟎 + ⋯ ]
𝒙=𝒙𝟎
Here 𝒉 = 𝟎. 𝟏, & 𝒙𝟎 = 𝟏. 𝟏
𝒅𝒚 𝟏 𝟏 𝟏 𝟏 𝟏 𝟏
[𝒅𝒙] = 𝟎.𝟏 [𝟎. 𝟑𝟕𝟖 − 𝟐 (−𝟎. 𝟎𝟑𝟎) + 𝟑 (𝟎. 𝟎𝟎𝟒) − 𝟒 (−𝟎. 𝟎𝟎𝟏) + 𝟓 (−𝟎. 𝟎𝟎𝟏) − 𝟔 (𝟎) … ]
𝒙=𝟏.𝟏
𝒅𝒚
[𝒅𝒙] = 𝟑. 𝟗𝟒𝟑𝟓
𝒙=𝟏.𝟏
𝒅𝟐 𝒚 𝟏 𝟏𝟏 𝟓
ii. [𝒅𝒙𝟐 ] = 𝒉𝟐 [∆𝟐 𝒚𝟎 − ∆𝟑 𝒚𝟎 + 𝟏𝟐 ∆𝟒 𝒚𝟎 − 𝟔 ∆𝟓 𝒚𝟎 … ]
𝒙=𝒙𝟎
𝒅𝟐 𝒚 𝟏 𝟏𝟏 𝟓
[𝒅𝒙𝟐 ] = (𝟎.𝟏)𝟐 [(−𝟎. 𝟎𝟑𝟎) − (𝟎. 𝟎𝟎𝟒) + 𝟏𝟐 (−𝟎. 𝟎𝟎𝟏) − 𝟔 (−𝟎. 𝟎𝟎𝟏) … ]
𝒙=𝟏.𝟏
𝒅𝟐 𝒚
[𝒅𝒙𝟐 ] = −𝟎. 𝟑𝟒𝟏
𝒙=𝟏.𝟏
𝑥 𝑦 = 𝑓(𝑥) ∇ ∇2 ∇3 ∇4 ∇5 ∇6
1.0 7.989
0.414 = ∇𝑦1
1.1 8.403 −0.036 = ∇2 𝑦2
0.378= ∇𝑦2 0.006 = ∇3 𝑦3
1.2 8.781 2
-0.030= ∇ 𝑦3 -0.002 = ∇4 𝑦4
0.348= ∇𝑦3 0.004= ∇ 𝑦4 3 0.001= ∇5 𝑦5
1.3 9.129 -0.026= ∇2 𝑦4 -0.001= ∇4 𝑦5 -0.002=
0.322= ∇𝑦4 0.003= ∇ 𝑦5 3 5
-0.001= ∇ 𝑦6 ∇6 𝑦6
1.4 9.451 -0.023= ∇2 𝑦5 -0.002= ∇4 𝑦6
0.299= ∇𝑦5 0.005= ∇3 𝑦6
1.5 9.750 -0.018= ∇2 𝑦6
0.281= ∇𝑦6
4
1.6 10.031
𝑑𝑦
iii. [𝑑𝑥 ]
𝑥=1.5
Here 𝒉 = 𝟎. 𝟏, & 𝒙𝒏 = 𝟏. 𝟓
𝑑𝑦 1 𝟏 𝟏 𝟏 𝟏 𝟏
[𝑑𝑥 ] = ℎ [𝛁𝒚𝒏 + 𝟐 𝛁 𝟐 𝒚𝒏 + 𝟑 𝛁 𝟑 𝒚𝒏 + 𝟒 𝛁 𝟒 𝒚𝒏 + 𝟓 𝛁 𝟓 𝒚𝒏 + 𝟔 𝛁 𝟔 𝒚𝒏 + ⋯ ]
𝑥=𝑥𝑛
𝑑𝑦 1 𝟏 𝟏 𝟏 𝟏 𝟏
[𝑑𝑥 ] = 0.1 [(𝟎. 𝟐𝟗𝟗) + 𝟐 (−𝟎. 𝟎𝟐𝟑) + 𝟑 (𝟎. 𝟎𝟎𝟑) + 𝟒 (−𝟎. 𝟎𝟎𝟏) + 𝟓 (𝟎. 𝟎𝟎𝟏) + 𝟔 (𝟎) ]
𝑥=1.5
𝑑𝑦
[𝑑𝑥 ] =
𝑥=1.5
𝒅𝟐 𝒚 𝟏 𝟏𝟏 𝟒 𝟓 𝟏𝟑𝟕 𝟔
[𝒅𝒙𝟐 ] =
𝒉𝟐
[𝛁 𝟐 𝒚𝒏 + 𝛁 𝟑 𝒚𝒏 +
𝟏𝟐
𝛁 𝒚𝒏 + 𝛁 𝟓 𝒚𝒏 +
𝟔 𝟏𝟖𝟎
𝛁 𝒚𝒏 +⋯]
𝒙=𝒙𝒏
𝒅𝟐 𝒚 𝟏 𝟏𝟏 𝟓 𝟏𝟑𝟕
[𝒅𝒙𝟐 ] = (𝟎.𝟏)𝟐 [(−𝟎. 𝟎𝟐𝟑) + (𝟎. 𝟎𝟎𝟑) + (−𝟎. 𝟎𝟎𝟏) + (𝟎. 𝟎𝟎𝟏) + (𝟎)]
𝒙=𝟏.𝟓 𝟏𝟐 𝟔 𝟏𝟖𝟎
𝒅𝟐 𝒚
[𝒅𝒙𝟐 ] =
𝒙=𝟏.𝟓
5
Let 𝑦 = 𝑓(𝑥) be a function, where 𝑦 takes the values 𝑦0 , 𝑦1 , 𝑦2 , … , 𝑦𝑛 for 𝑥0 , 𝑥1 , 𝑥2 , … , 𝑥𝑛 . we want to
𝑏
find the value of 𝐼 = ∫𝑎 𝑓(𝑥)𝑑𝑥.
𝑏−𝑎
Let the interval of integration (𝑎, 𝑏) be divided into 𝑛 equal subintervals of width ℎ = ( 𝑛
) so
that𝑥0 = 𝑎, 𝑥1 = 𝑥0 + ℎ, 𝑥2 = 𝑥0 + 2ℎ, … , 𝑥𝑛 = 𝑥0 + 𝑛ℎ = 𝑏.
𝑏 𝑥 +𝑛ℎ
Therefore𝐼 = ∫𝑎 𝑓(𝑥)𝑑𝑥 = ∫𝑥 0 𝑓(𝑥) 𝑑𝑥…………………(𝑖)
0
We can approximate 𝑓(𝑥) by Newton’s forward interpolation formula which is given by:
𝑷(𝑷−𝟏) 𝟐 𝑷(𝑷−𝟏)(𝑷−𝟐) 𝟑 𝑷(𝑷−𝟏)(𝑷−𝟐)...(𝑷−𝒏+𝟏) 𝒏
𝒚(𝒙) = 𝒚𝟎 + 𝑷∆𝒚𝟎 + 𝟐!
∆ 𝒚𝟎 + 𝟑!
∆ 𝒚𝟎 + ⋯+ 𝒏!
∆ 𝒚𝟎
𝑥−𝑥0 1
Where P= ℎ
⟹ 𝑑𝑃 = ℎ 𝑑𝑥 ⟹ 𝑑𝑥 = ℎ𝑑𝑃
𝒏 𝒏(𝟐𝒏−𝟑) 𝟐 𝒏(𝒏−𝟐)𝟐 𝟑
𝐼 = ℎ𝑛 [𝒚𝟎 + 𝟐 ∆𝒚𝟎 + 𝟏𝟐
∆ 𝒚𝟎 + 𝟐𝟒
∆ 𝒚𝟎 + ⋯ + 𝒖𝒑 𝒕𝒐 (𝒏 + 𝟏)𝒕𝒆𝒓𝒎𝒔] …(𝑖𝑖)
𝑦1
𝑦0
Area
𝑥0 𝑥1
6
𝑥 +ℎ 1 ℎ ℎ
∫𝑥 0 𝑓(𝑥) 𝑑𝑥 = ℎ (𝑦0 + 2 ∆𝑦0 ) = 2 (2𝑦0 + (𝑦1 − 𝑦0 )) = 2 (𝑦1 + 𝑦0 )
0
Similarly, for the next sub intervals(𝑥0 + ℎ, 𝑥0 + 2ℎ), (𝑥0 + 2ℎ, 𝑥0 + 3ℎ), …, we get:
𝑥 +2ℎ ℎ 𝑥 +3ℎ ℎ 𝑥 +𝑛ℎ
∫𝑥 0+ℎ 𝑓(𝑥) 𝑑𝑥 = 2 (𝑦0 + 𝑦1 ), ∫𝑥 0+2ℎ 𝑓(𝑥) 𝑑𝑥 = 2 (𝑦2 + 𝑦3 ), … , ∫𝑥 0+(𝑛−1)ℎ 𝑓(𝑥) 𝑑𝑥 =
0 0 0
ℎ
(𝑦𝑛−1 + 𝑦𝑛 )
2
𝑥 +𝑛ℎ 1 ℎ
∫𝑥 0+(𝑛−1)ℎ 𝑓(𝑥) 𝑑𝑥 = ℎ (𝑦𝑛−1 + 2 ∆𝑦𝑛−1 ) = 2 (𝑦𝑛−1 + 𝑦𝑛 )Which is known as Trapezoidal rule.
0
𝑥 +4ℎ 1 ℎ
Similarly ∫𝑥 0+2ℎ 𝑓(𝑥) 𝑑𝑥 = 2ℎ (𝑦2 + ∆𝑦2 + 6 ∆2 𝑦2 ) = 3 (𝑦2 + 4𝑦3 + 𝑦4 ), …,
0
𝑥0 +𝑛ℎ 1 ℎ
∫𝑥 𝑓(𝑥) 𝑑𝑥 = 2ℎ (𝑦𝑛−2 + ∆𝑦𝑛−2 + 6 ∆2 𝑦𝑛−2 ) = 3 (𝑦𝑛−2 + 4𝑦𝑛−1 + 𝑦𝑛 )
0 +(𝑛−2)ℎ
3ℎ
= [8𝑦0 + 12(𝑦1 − 𝑦0 ) + 6(𝑦2 − 2𝑦1 + 𝑦0 ) + (𝑦3 − 3𝑦2 + 3𝑦1 − 𝑦0 )]
8
3ℎ
= (𝑦0 + 3𝑦1 + 3𝑦2 + 𝑦3 )
8
Similarly
7
𝑥 +6ℎ 3ℎ 𝑥 +𝑛ℎ 3ℎ
∫𝑥 0+3ℎ 𝑓(𝑥) 𝑑𝑥 = 8
(𝑦3 + 3𝑦4 + 3𝑦5 + 𝑦6 ), … , ∫𝑥 0+(𝑛−3)ℎ 𝑓(𝑥) 𝑑𝑥 = 8
(𝑦𝑛−3 + 3𝑦𝑛−2 +
0 0
3𝑦𝑛−1 + 𝑦𝑛 )
Adding the above integrals, we get:
𝑏 3ℎ
𝐼 = ∫𝑎 𝑓(𝑥) 𝑑𝑥 ≅ [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 … + 𝑦𝑛−2 + 𝑦𝑛−1 ) + 2(𝑦3 + 𝑦6 + ⋯ +
8
𝑦𝑛−3 )]
Which is known as Simpson’s three-eight rule.
Note : To use Simpson’s one-third rule, the given interval of integration must be divided in to
subintervals whose number 𝑛 is a multiple of 3.
5.3.5. Boole’s-Rules
Putting 𝑛 = 4 in equation (𝑖𝑖) and taking the curve 𝑦 = 𝑓(𝑥)
through(𝑥0 , 𝑦0 ), (𝑥1 , 𝑦1 ),(𝑥2 , 𝑦2 ), (𝑥3 , 𝑦3 ) & (𝑥4 , 𝑦4 ) as a polynomial of degree four so that
differences of order higher than four vanish, we get:
𝑏 2ℎ
𝐼 = ∫𝑎 𝑓(𝑥) 𝑑𝑥 ≅ 45 [7(𝑦0 + 𝑦𝑛 ) + 32(𝑦1 + 𝑦3 … + 𝑦2𝑛−1 ) + 12(𝑦2 + 𝑦6 + ⋯ + 𝑦4𝑛−2 ) +
14(𝑦4 + 𝑦8 + ⋯ + 𝑦4𝑛 )]
5.3.6. Weddle’s-Rules
Putting 𝑛 = 6 in equation (𝑖𝑖) and taking the curve 𝑦 = 𝑓(𝑥)
through(𝑥0 , 𝑦0 ), (𝑥1 , 𝑦1 ),(𝑥2 , 𝑦2 ), (𝑥3 , 𝑦3 ),(𝑥4 , 𝑦4 ), (𝑥5 , 𝑦5 ) 𝑎𝑛𝑑 (𝑥6 , 𝑦6 ) as a polynomial of degree
six so that differences of order higher than six vanish, we get:
𝑏 3ℎ
𝐼 = ∫𝑎 𝑓(𝑥) 𝑑𝑥 ≅ 10 [𝑦0 + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 + 2𝑦6 + 5𝑦7 + 𝑦8 ]
Example
6 𝑑𝑥
Evaluate ∫0 1+𝑥 2
by using
a. Trapezoidal rule
b. Simpson’s 1/3 rule
c. Simpson’s 3/8 rule
d. Boole’s rule
e. Weddle’s rule
Solution
1
Divide the interval(0,6) in to six parts each of widthℎ = 1. The value of 𝑓(𝑥) = 1+𝑥2 are 𝑓(0) =
1, 𝑓(1) = 0.5, 𝑓(2) = 0.2, 𝑓(3) = 0.1, 𝑓(4) = 0.0588, 𝑓(5) = 0.0385 𝑎𝑛𝑑 𝑓(6) = 0.027
a. By Trapezoidal rule
8
6 𝑑𝑥 ℎ
∫01+𝑥 2
= 2 [𝑦0 + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 ) + 𝑦6 ]
1
= [1 + 2(0.5 + 0.2 + 0.1 + 0.0588 + 0.0385) + 0.027 ]
2
= 𝟏. 𝟒𝟏𝟎𝟖
b. By Simpson’s 1/3 rule
6 𝑑𝑥 ℎ
∫0 2 =
[𝑦0 + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 ) + 𝑦6 ]
1+𝑥 3
1
= [1 + 4(0.5 + 0.1 + 0.0385) + 2(0.2 + 0.0588) + 0.027] = 𝟏. 𝟑𝟔𝟔𝟐
3
c. By Simpson’s 3/8 rule
6 𝑑𝑥 3ℎ
∫0 2 =
[(𝑦0 + 𝑦6 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 ) + 2(𝑦3 )]
1+𝑥 8
3
= [(1 + 0.027) + 3(0.5 + 0.2 + 0.0588 + 0.0385) + 2(0.1)] = 𝟏. 𝟑𝟓𝟕𝟏
8