You are on page 1of 23

6.

Numerical Integration
6.1 Introduction:
If F(x) is a differentiable function whose derivative is f (x), then we can evaluate the definite integral I as:
𝒃

𝐼 = ∫ 𝒇(𝒙)𝒅𝒙 = 𝑭 (𝒃)– 𝑭 (𝒂), 𝑭 ′( 𝒙 ) = 𝒇 (𝒙) ( 𝟔. 𝟏)


𝒂
Most integrals can be evaluated by the formula given by Eq. (6.1) and there exists many
techniques for making such
evaluations. However, in many applications in science and engineering, most integrals cannot be evaluated because
most integrals do not have anti-derivatives 𝐹(𝑥) expressible in terms of elementary functions.
In other circumferences, the integrands could be empirical functions given by certain measured values. In all these
instances, we need to resort to numerical methods of integration. It should be noted here that, sometimes, it is difficult to
evaluate the integral by analytical methods. Numerical integration (or numerical quadrature, as it is sometimes called) is
an
alternative approach to solve such problems. As in other numerical techniques, it often results in approximate
solution. The
integration can be performed on a continuous function or a set of data.
The integration given by Eq. (6.1) is shown in Fig. (6.1).The integration shown in Fig. 6.1 is called closed since the
function values at the two points (a, b) where the limits of integration are located are used to find the integral. In open
integration, information on the function at one or both limits of integration is not required.

Fig. (6.1)

1
The range of integration (b – a) is divided into a finite number of intervals in numerical integration. The integration
techniques consisting of equal intervals are based on formulas known as Newton-Cotes closed quadrature formulas.
In this chapter, we present the following methods of integration with illustrative examples:
1. Midpoint rule.
1. Trapezoidal rule.
2. Simpson’s 1/3 rule.
3. Simpson’s 3/8 rule.

6.2 The mid-point rule (method):


𝑏
Let a required definite integral be denoted again by ∫ 𝑦 𝑑𝑥𝑎 and represented by the area under the graph of 𝑦 = 𝑓 (𝑥)
between the limits 𝑥 = 𝑎 and 𝑥 = 𝑏, as shown in Fig.
(6.2)

Fig.(6.2)

2
With the mid-ordinate rule each interval of width d is assumed to be replaced by a rectangle of height equal to the ordinate
at the middle point of each interval, shown as y1, y2, y3, . . . , yn in fig.(6.2).
Thus:
𝑏

∫ 𝑦 𝑑𝑥 ≈ 𝑑𝑦1 + 𝑑𝑦2 + 𝑑𝑦3 +··· +𝑑𝑦𝑛


𝑎
≈ 𝑑( 𝑦1 + 𝑦2 + 𝑦3 + ··· +𝑦𝑛)

i.e. the mid-point rule states:


𝑏
∫ 𝑦 𝑑𝑥 ≈ (𝒘𝒊𝒅𝒕𝒉 𝒐𝒇 𝒊𝒏𝒕𝒆𝒓𝒗𝒂𝒍) (𝑻𝒉𝒆 𝒐𝒓𝒅𝒊𝒏𝒂𝒕𝒆𝒔 𝒔𝒖𝒎 𝒐𝒇 𝒎𝒊𝒅 − 𝒊𝒏𝒕𝒆𝒓𝒗𝒂𝒍𝒔) … (𝟔.
𝑎 𝟐)

Example 6.1:
Use the mid-ordinate rule with (a) 4 intervals, (b) 8 intervals, to evaluate:
3 2
∫1√𝑥 𝑑𝑥 correct to 3 decimal places.

Solution:
(a) With 4 intervals, each will have a width of 𝟑−𝟏
𝟒
i.e. 0.5 and the ordinates will occur at 1.0, 1.5, 2.0, 2.5 and 3.0.
2
Hence the mid-ordinates y1, y2, y3 and y4 occur at 1.25, 1.75, 2.25 and 2.75. Corresponding values of are shown in the
√𝑥
following table.

𝒙 1.25 1.75 2.25 2.75


𝟐
1.7889 1.5119 1.3333 1.2060
√𝒙

3
3 2
∫1√𝑥 𝑑𝑥 =(0.5)[1.7889+1.5119 + 1.3333+1.2060]
= 2.920, correct to 3 decimal places. Ans.

(b) With 8 intervals, each will have a width of 0.25 and the ordinates will occur at 1.00, 1.25, 1.50, 1.75, . . . and thus mid-
ordinates at 1.125, 1.375,
𝟐
1.625, 1.875 . . . Corresponding values of are shown in the following table.
√𝒙
𝒙 1.125 1.375 1.625 1.875 2.125 2.375 2.625 2.875
𝟐
1.886 1.706 1.569 1.461 1.372 1.298 1.234 1.180
√𝒙

From equation (1):


3
2
∫ 𝑑𝑥 ≈ (0.25)[1.886 + 1.706 + 1.569 + 1.461 + 1.372 + 1.298 +
1.234
1 √𝑥 + 1.18]
≈ 𝟐. 𝟗𝟐𝟔, correct to 3 decimal places.

As previously, the greater the number of intervals the nearer the result is to the true value (of 2.928, correct to 3 decimal
places).

4
6.3 General Quadrature Formula:
Let 𝑦 = 𝑓(𝑥) be a function, where y takes the values y0, y1, y2, ..yn for x = x0, x1, x2, ...... xn. We want to find the value
𝒃
of 𝐼 = ∫ 𝒂𝒇(𝒙)𝒅𝒙.
𝑏−𝑎
Let the interval of integration (a, b) be divided into n equal subintervals of width ℎ = 𝑛
, so that:
𝑥0 = 𝒂, 𝑥1 = 𝑥0 + ℎ, 𝑥2 = 𝑥0 + 2ℎ, . . . . . . . . . . . . , 𝑥 𝑛 = 𝑥0 +
𝑛ℎ = 𝒃. 𝒃 𝑥 0 +𝑛

𝐼 = ∫ 𝒇(𝒙)𝒅𝒙 = ∫ … (𝟔. 𝟑)
𝒂 𝒇(𝒙)𝒅𝒙
Newton’s forward interpolation formula is given 𝑥0
by: 𝑦 = 𝑓(𝑥) = 𝑦 + 𝑢∆𝑦 +
𝑢 (𝑢 – 1) ∆ 𝑦0 + ⋯ + 𝑢 (𝑢 – 1)(𝑢 – 2) … . . (𝑢 – 𝑛 + 1) ∆𝑛 𝑦
2
0 0 2! 𝑛!
𝑥−𝑥 0 0
Where; 𝑢 = ℎ
1
∴ 𝑑𝑢 = 𝑑𝑥 → 𝑑𝑥 = ℎ𝑑𝑢

∴ Equation (6.3) becomes: 𝑛
𝒃 𝑢(𝑢 – 1) ∆2𝑦0 + ⋯ + 𝑢 (𝑢 – 1)(𝑢 – 2) … . . (𝑢 – 𝑛 + 1) ∆𝑛 𝑦 0 ] 𝑑𝑢
𝐼 = ∫ 𝒇(𝒙)𝒅𝒙 = ℎ ∫ [𝑦0 + 𝑢∆𝑦0 + 2! 𝑛!
𝒂 0
𝑛 2
𝐼 = 𝑛ℎ [𝑦0 + ∆𝑦0 + 𝑛(2𝑛 – 3) ∆2𝑦0 + 𝑛(𝑛 – 2) ∆3𝑦0 + ⋯ ]
2 12 24
𝑥𝑛
𝑛 2
∆𝑦0 + 𝑛(2𝑛 – 3) ∆2𝑦0 + 𝑛(𝑛 – 2) ∆3𝑦0 + ⋯ ] … (𝟔.
∴ 𝐼 = ∫ 𝒇(𝒙)𝒅𝒙 = 𝑛ℎ [𝑦0 +
12 24 𝟒)
𝑥0 2

5
This is called general Quadrature formula.

6.3 Trapezoidal rule:


Putting 𝑛 = 1 in equation (6.4) and taking the curve 𝑦 = 𝑓(𝑥) through (x0, y0) and (x1, y1) as a polynomial of degree one so
that differences of order higher than one vanishes, we get:
𝑥 0 +ℎ
1 ℎ ℎ
𝐼= ∫ 𝑓(𝑥)𝑑𝑥 = ℎ [𝑦0 + ∆𝑦0] = [2𝑦0 + (𝑦1 − 𝑦0)] = [𝑦0 + 𝑦1]
2 2 2
𝑥0
Similarly, for the next sub interval (𝑥0 + 2ℎ, … , 𝑥0 + 𝑛ℎ ),we get (see figure 6.3):

Fig.(6.3)

6
𝑥 0 +2ℎ 𝑥 0 +𝑛
ℎ ℎ ℎ
𝐼= ∫ 𝑓(𝑥)𝑑𝑥 = [𝑦1 + 𝑦2] … 𝐼 = ∫ 𝑓(𝑥)𝑑𝑥 = [𝑦𝑛−1
2 2
𝑥 0+ℎ + 𝑦𝑛 ]
Adding the above integrals, we get:
𝑥 0 +𝑛ℎ

𝐼 = ∫ 𝑓(𝑥)𝑑𝑥 = ℎ[(𝑦0 + 𝑦 𝑛 ) + 2(𝑦1 + 𝑦2 + ⋯ + 𝑦𝑛−1)] … . . (𝟔. 𝟓)


𝑥 0+(𝑛−1)ℎ
2
𝑥0
𝑏

𝑂𝑟; ∫ 𝑦 𝑑𝑥 ≈ (𝒘𝒊𝒅𝒕𝒉 𝒐𝒇 𝒊𝒏𝒕𝒆𝒓𝒗𝒂𝒍) [(𝒇𝒊𝒓𝒔𝒕 + 𝒍𝒂𝒔𝒕 𝒐𝒓𝒅𝒊𝒏𝒂𝒕𝒆) + 𝟐(𝒔𝒖𝒎 𝒐𝒇 𝒓𝒆𝒎𝒂𝒊𝒏𝒊𝒏𝒈 𝒐𝒓𝒅𝒊𝒏𝒂𝒕𝒆𝒔] − − − (𝟔. 𝟔)
𝟐
𝑎

This is known as Trapezoidal rule.

Example 6.2:
𝟑 𝟐
(a)Use integration to evaluate, correct to 3 decimal places, ∫𝟏 𝒙 𝒅𝒙.

(b) Use
i. the trapezoidal rule with:
4 intervals.
ii. 8 intervals correct to 3 decimal places.

Solution:
a) Exact solution
3 3
2
∫ 𝑑𝑥 = ∫ 2𝑥−1⁄2𝑑𝑥 ..
1 1
√𝑥

7
1 3
(− 2)+1
2𝑥 3
=[ 1 ] = [4𝑥1⁄2] 1 = 4[√3 − √1]
− +1
2 1
= 2.928 𝑐𝑜𝑟𝑟𝑒𝑐𝑡 𝑡𝑜 3 𝑑𝑒𝑐𝑖𝑚𝑎𝑙𝑠 𝑝𝑙𝑎𝑐𝑒𝑠

(b)
i) The range of integration is the difference between the upper and lower limits, i.e. 𝟑 − 𝟏 = 𝟐. Using
the 𝟑 −𝟏
trapezoidal rule with 4 intervals gives an interval width 𝒉 = 𝟒 = 𝟎. 𝟓 and ordinates situated at 1.0, 1.5, 2.0, 2.5 and
𝟐
3.0. Corresponding values of √𝒙are shown in the table below, each correct to 4 decimal places (which is one more
decimal place than required in
the problem):
𝒙 1.0 1.5 2.0 2.5 3.0
2⁄√𝑥 2.0000 1.6330 1.4142 1.2649 1.1547

From Trapezoidal rule:


3 2 0.5
∫1 𝑑𝑥 ≈ 2 [(2.0 + 1.1547) + 2(1.6330 + 1.4142 + 1.2649)]
√𝑥
≈2.945, correct to 3 decimal places.
This problem demonstrates that even with just 4intervals a close approximation to the true value of2.928 (correct to 3
decimal places) is obtained using the trapezoidal rule.

𝟑 −𝟏
ii) With 8 intervals, the width of each is 𝒉 = 𝟖
= 𝟎. 𝟐𝟓, giving ordinates at 1.00, 1.25, 1.50, 1.75, 2.00, 2.25, 2.50,
𝟐
2.75 and 3.00. Corresponding values of √ 𝒙are
shown
𝒙 in
1.0the table below:1.5
1.25 1.75 2.0 2.25 2.5 2.75 3.0

8
2⁄√𝑥 2.0000 1.7889 1.6330 1.5119 1.4142 1.3333 1.2649 1.2060 1.1547

From Trapezoidal rule:


3 2 0.25 1.7889 + 1.6330 + 1.5119
∫ 𝑑𝑥 ≈ )]
1 2 [ (2.0 + 1.1547 ) + 2 ( +1.4142 + 1.3333 + 1.2649 + 1.2060
√𝑥

≈2.932, correct to 3 decimal places.


This problem demonstrates that the greater the number of intervals chosen (i.e. the smaller the interval width) the more
accurate will be the value of the definite integral. The exact value is found when the number of intervals is infinite, which is,
of course, what the process of integration is based upon.

Example 6,3:
𝟏
𝝅⁄𝟐 𝒅𝒙,using 6 intervals. Give the answer correct to 4 significant figures.
Use the trapezoidal rule to evaluate ∫ 𝟎 𝟏+𝒔𝒊𝒏𝒙

Solution:
𝝅
−𝟎 𝝅 𝝅 𝝅 𝝅 𝝅 𝟓𝝅 𝝅
With 6 intervals, each will have a width of 𝟐
= 𝟏𝟐 rad (or 15◦ ) and the ordinates occur at 0, , , , , , .
𝟔 𝟏𝟐 𝟔 𝟒 𝟑 𝟏𝟐 𝟐
𝟏
𝝅⁄𝟐 𝒅𝒙, are shown in the table below.
Corresponding values of ∫ 𝟎 𝟏+𝒔𝒊𝒏𝒙

𝒙 0 𝜋⁄12 𝜋⁄6 𝜋 ⁄4 𝜋⁄3 5𝜋⁄12 𝜋⁄2


𝟏
𝟏 + 𝒔𝒊𝒏𝒙 1.0000 0.7944 0.6667 0.5858 0.5359 0.5087 0.5000

From Trapezoidal rule:

9
𝝅⁄𝟐
1 0.7944 + 0.6667 + 0.5858
∫ 𝑑𝑥 ≈ 𝜋 ⁄12 ( )]
0 1 + 𝑠𝑖𝑛𝑥 2 [ 1.0 + 0.5 ) + 2 ( +0.5359 + 0.5087

≈1.006, correct to 4 decimal places.

6.4 Simpson's (1/3) rule:


Putting n = 2 in equation (6.4) and taking the curve through (x0,y0),(x1,y1) and (x2,y2) as a polynomial of degree two so
that differences of order higher than two vanish, we get:
𝑥 0 +2ℎ
1
𝐼1 = ∫ 𝑓(𝑥)𝑑𝑥 = 2ℎ [𝑦 0 + ∆𝑦 0 + 6 ∆2𝑦0]
𝑥0
= 2ℎ [6𝑦0 + 6(𝑦1 − 𝑦0) + (𝑦2 − 2𝑦1 + 𝑦0) ] = ℎ (𝑦0 + 4𝑦1 + 𝑦2)
6 3
Similarly;
𝑥 0 +4ℎ
𝐼2 = ∫ℎ 𝑓(𝑥)𝑑𝑥 = (𝑦2 + 4𝑦3
3
+ 𝑦 4), … .
𝑥 0 +2ℎ
𝑥 0∫+𝑛ℎ 𝑓(𝑥)𝑑𝑥 = (𝑦𝑛−2 + 4𝑦𝑛−1
𝐼= + 𝑦𝑛 ) ℎ
3
𝑥 0+(𝑛−2)ℎ
Adding the above integrals, we get:
𝑥 0 +𝑛ℎ

… . . (𝟒.
𝐼= ∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦0 + 𝑦 𝑛 ) + 4(𝑦1 + 𝑦3 + ⋯ + 𝑦𝑛−1) + 4(𝑦2 + 𝑦4 + ⋯ + 𝑦𝑛−2)]
3 𝟕)
𝑥0

10
i.e. Simpson’s (1/3) rule states:

𝒃 𝟏 (𝒇𝒊𝒓𝒔𝒕 + 𝒍𝒂𝒔𝒕 𝒐𝒓𝒅𝒊𝒏𝒂𝒕𝒆)


𝑰 = ∫𝒂𝒚 𝒅𝒙 ≈ 𝟑 (𝒘𝒊𝒅𝒕𝒉 𝒐𝒇 𝒊𝒏𝒕𝒆𝒓𝒗𝒂𝒍) { +𝟒 ( 𝒕𝒉𝒆 𝒔𝒖𝒎 𝒐𝒇 𝒐𝒅𝒅 𝒐𝒓𝒅𝒊𝒏𝒂𝒕𝒆𝒔 )} --- (4.8)

Note that Simpson’s rule can only be applied when an even number
+𝟐of intervals
(𝒔𝒖𝒎 is chosen,
𝒐𝒇 𝒆𝒗𝒆𝒏 i.e. an)odd number of ordinates as
𝒐𝒓𝒅𝒊𝒏𝒂𝒕𝒆𝒔
shown in figure (6.4):

Fig.(6.4)

Example 6.4:
Use Simpson’s rule with:
(a) 4 intervals,
𝟑 𝟐
(b) 8 intervals, to evaluate ∫ 𝟏𝒅𝒙.
√𝒙
correct to 3 decimal places.

11
Solution:
𝟑 −𝟏
(a) With 4 intervals gives an interval width 𝒉 = 𝟒 = 𝟎. 𝟓 and ordinates situated at 1.0, 1.5, 2.0, 2.5 and 3.0. The values
of the ordinates are as shown in the following table:
𝒙 1.0 1.5 2.0 2.5 3.0
2⁄√𝑥 2.0000 1.6330 1.4142 1.2649 1.1547

Thus, from equation (4.6) or (4.7):


3 2 0.5
∫ 𝑑𝑥 ≈ 3 [(2.0 + 1.1547) + 4(1.6330 + 1.2649) + 2(1.4142)]
1
√𝑥
≈2.929, correct to 3 decimal places.
(a) With 8 intervals, the width of each is 𝒉 = 𝟑 −𝟏
𝟖
= 𝟎. 𝟐𝟓, giving ordinates at 1.00, 1.25, 1.50, 1.75, 2.00, 2.25, 2.50,
2.75 and 3.00The values of the ordinates are as shown in the table:
𝒙 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0
2⁄√𝑥 2.0000 1.7889 1.6330 1.5119 1.4142 1.3333 1.2649 1.2060 1.1547

3 2𝑑𝑥 ≈
0.25

1 3 [(2.0 + 1.1547) + 4(1.7889 + 1.5119 + 1.3333 + 1.2060) + 2(1.6330 + 1.4142 + 1.2649)]
√𝑥

≈ 𝟐. 𝟗𝟐𝟖, correct to 3 decimal places.


It is noted that the latter answer is exactly the same as that obtained by integration. In general, Simpson’s rule is regarded as
the more accurate of the previous approximate method used in numerical integration.

12
Example 6.5:
Evaluate:
𝜋 ⁄3 1
∫0 √ (1 − 3 𝑠𝑖𝑛 2 𝜃) 𝑑𝜃
correct to 3 decimal places, using Simpson’s rule (1/3) with 6 intervals.

Solution:
𝝅
−𝟎 𝝅 𝝅 𝝅 𝝅 𝟐𝝅 𝟓𝝅 𝝅
With 6 intervals, each will have a width of 𝟑
= 𝟏𝟖 rad (or 10◦ ) and the ordinates occur at 0, , , , , , .
𝟔 𝟏𝟖 𝟗 𝟔 𝟗 𝟏𝟖 𝟑

𝜋⁄3 1
Corresponding values of ∫ 0√ ( 1 − 𝑠𝑖𝑛32 𝜃 ) 𝑑𝜃are shown in the table below:

𝝅 𝝅 𝝅 𝟐𝝅 𝟓𝝅 𝝅
𝜃 0 𝟏𝟖 𝟗 𝟔 𝟗 𝟏𝟖 𝟑
Or 10o Or 20o Or 30o Or 40o Or 50o Or 60o
1
√(1 − 1.0000 0.9950 0.9803 0.9574 0.9286 0.8969 0.8660
𝑠𝑖𝑛2 𝜃) 3

From equation (6.7):


𝜋 ⁄3 1 (𝜋⁄18)
𝐼= ∫ √ (1 − 3 𝑠𝑖𝑛 2 𝜃) 𝑑𝜃 3 [(1.0 + 0.8660) + 4(0.9950 + 0.9574 + 0.8969) + 2(0.9803 + 0.9286)]
0
=
≈ 𝟎. 𝟗𝟗𝟒, correct to 3 decimal places.

13
6.5 Simpson's (3/8) rule:
Putting n = 3 in equation (6.4) and taking the curve through (x0, y0), (x1, y1), (x2, y2) and (x3, y3) as a polynomial of
degree three so that differences of order higher than three vanish, we get:
𝑥 0 +3𝑑
3 3 1
∫ 𝑓 (𝑥)𝑑𝑥 = 𝑛ℎ [𝑦0 + 2 ∆𝑦0 + 4 ∆ 𝑦0 + 8 ∆3 𝑦0 ]
2

𝑥0
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;
𝑥 0 +6𝑑
∫ 𝑓(𝑥)𝑑𝑥 =3ℎ [(𝑦3 + 3𝑦4 +
8
3𝑦5 + 𝑦6)], … ..
𝑥0
𝑥 0 +𝑛𝑑
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦𝑛−3 + 3𝑦𝑛−2 + 3𝑦𝑛−1 +
𝑦𝑛)] 8
𝑥 0+( 𝑛−3) 𝑑

Adding the above integrals, we get:


𝑥 0 +𝑛𝑑
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = 8 [(𝑦0 + 𝑦𝑛) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ + 𝑦𝑛−2 + 𝑦𝑛−1) + 2(𝑦3 + 𝑦6 + ⋯ + 𝑦𝑛−3)] … (𝟒.
𝑥0 𝟖)

Which is known as Simpson’s three-eighth rule.

14
Note that, using this formula, the given interval of integration must be divided into sub-intervals whose number n is a
multiple of 3.

Example 6.6:
𝒅𝒙
𝟔 by using:
Evaluate ∫ 𝟎 𝟏+𝒙𝟐
(i) Trapezoidal Rule
(ii) Simpson’s one-third rule
(iii) Simpson’s three-eighth rule
Solution:
Divide the interval [0, 6] into six parts each of width h = 1.
𝑑𝑥
The value of𝑓(𝑥) = 1+𝑥 2are given below:

(i) By Trapezoidal rule,


6
𝑑𝑥 ℎ
∫ = [((𝑦0 + 𝑦6) + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4
0 + 𝑦5))] 1 + 𝑥 2 2
1 1 1 1
= [( (1 + ) + 2 (0.5 + 0.2 + 0.1 + + )) ]
2 37 17 26
= 1.410798581.

15
(ii) By Simpson’s one-third rule,
6
𝑑𝑥 ℎ
∫ = [((𝑦0 + 𝑦6) + 4(𝑦1 + 𝑦3 + 𝑦5) + 2(𝑦2
0 + 𝑦4))] 1 + 𝑥 2 3
1 1 1 1
= [( (1 + ) + 4 (0.5 + 0.1 + ) + 2 (0.2 + )) ]
3 37 26 17
= 1.366173413.

(iii) By Simpson’s three-eighth rule,


6
∫ 𝑑𝑥 = 3ℎ [((𝑦 + 𝑦 ) + 3(𝑦 + 𝑦 + 𝑦 + 𝑦 ) + 2𝑦 )]
0 6 1 2 4 5 3
1 + 𝑥2 8
0
3 1 1 1
= 8 [((1 + 37 ) + 3 (0.5 + 0.2 + 17 + 26) + 2( 0.1))]

= 1.357080836.

6.6 Double Integration:


In this section we obtain double integration formulae by shifting the single integration formulae.

6.6.1 Trapezoidal rule:


Consider the integral of the form:
𝑐 𝑏
𝐼 = ∫ ( ∫ 𝑓(𝑥, 𝑦 )𝑑𝑥) 𝑑𝑦,
𝑑 𝑎
(6.9)
Over the rectangles 𝑥 = 𝑎, 𝑥 = 𝑏, and 𝑦 = 𝑐, 𝑦
= 𝑑.
Evaluating the inner integral by the Trapezoidal
rule we get:

16
𝑑
𝑏−𝑎
𝐼= (𝟔. 𝟏𝟎)
2 ∫ [ 𝑓 ( 𝑎, 𝑦) + 𝑓(𝑏, 𝑦)]𝑑𝑦
𝑐
Applying Trapezoidal rule again to evaluate the integral on the right hand side of (6.10) we get:
𝐼 = (𝑏 − 𝑎)(𝑑 − 𝑐) [ ( ) [ (
4 [ 𝑓 𝑎, 𝑐 + 𝑓 𝑎, 𝑑) + 𝑓(𝑏, 𝑐)]𝑓(𝑏, 𝑑)]] (𝟔. 𝟏𝟏)
As shown in figure (6.5).

Fig. (6.5) Weights in the trapezium rule.

If discrete value are given we can use the composite Trapezoidal rule by dividing the interval [a, b] into n equal
subintervals each of length h and the interval [c, d] into m equal subintervals each of length k.
We have:
xi = x0 + ih, x0 = a, xn = b yj

= y0 + jk, y0 = c, ym = d
Applying composite Trapezoidal rule in both the directions we get:

17
(6.12)
As shown in figure (6.6).

Fig. (6.6) Weights in the composite trapezium rule.

18
6.6.2 Simpson’s (1/3) rule:
Taking 𝒉 = 𝒃−𝒂
𝟐
, 𝒌 = 𝒅−𝒄𝟐and applying Simpson’s rule to evaluate (6.9) we get:
ℎ𝑘
𝐼 = 9 {[𝑓(𝑎, 𝑐 ) + 𝑓(𝑎, 𝑑) + 𝑓(𝑏, 𝑐 ) + 𝑓(𝑏, 𝑑)] + 4[𝑓(𝑎, 𝑐 + 𝑘) + 𝑓(𝑎 + ℎ, 𝑐 ) + 𝑓(𝑎 + ℎ, 𝑑) + 𝑓(𝑏, 𝑐 + 𝑘)]

+ 16𝑓(𝑎 + ℎ, 𝑐 + 𝑘)}

(𝟔. 𝟏𝟑)
As shown in figure (6.7):

Fig. (6.7) Weights in Simpson’s (1/3) rule


For composite Simpson’s rule;
Divide the interval [a, b] into 2N equal parts each of length ℎ = (𝑏 – 𝑎)/(2𝑁).
Divide the interval [c, d] into 2M equal parts each of length ℎ = (𝑑 – 𝑐)/(2𝑀).
We have odd number of points on each mesh line and the total number of points, (2𝑁 + 1) (2𝑀 + 1) is also odd.
The general grid point is given by (𝑥 𝑖 , 𝑦𝑗). Denote, 𝑓𝑖𝑗 = 𝑓(𝑥 𝑖 , 𝑦𝑗).
For M = N = 2, the weights in the composite Simpson’s rule are given in Figure (6.8):

19
Fig. (6.8). Weights in the Simpson’s (1/3) rule

Example 6.7:
Evaluate the integral:
𝟐 𝟐
𝒅𝒙 𝒅𝒚
𝑰=∫ ∫
(𝒙 + 𝒚)
𝟏 𝟏
Using Trapezoidal rule with ℎ = 𝑘 = 0.5.

Solution:
Using Trapezoidal rule, we get:

20
Example 6.8:
Evaluate the integral:
𝟎.𝟓 𝟎.𝟓
𝒙𝒚
𝑰=∫ ∫ 𝒅𝒙 𝒅𝒚
𝟎 (𝟏 + 𝒙𝒚)

𝟎
Using Simpson’s (1/3) rule for double integrals with both step sizes equal to 0.25

Solution
Taking;
We have;𝑛 = 𝑘 = 0.25,
𝑥0 = 0, 𝑥1 = 0.25, 𝑥2 = 0.5
𝑦0 = 0, 𝑦1 = 0.25, 𝑦2 = 0.5

𝑓 (0, 0) = 0, 𝑓 (0, 0.25) = 0, 𝑓 (0, 0.5) = 0


𝑓 (0.25, 0.25) = 0.05878525, 𝑓 (0.25, 0.5) = 0.11082
𝑓 (0.25, 0) = 0, 2
𝑓 (0.5, 0.25) = 0.110822, 𝑓 (0.5, 0.5) = 0.19792
𝑓 (0.5, 0) = 0, 3

21
Using Simpson’s (1/3) rule, we get:

1
𝐼=
144 [0 + 0 + 0 + 4(0 + 0.235141 + 0.110822) + 0 + 0.443288 + 0.197923]
= 0.014063

Another variant:

Example 6.9:
Suppose that the temperature of a rectangular heated plate is described by the following function:
𝑇 (𝑥, 𝑦) = 2𝑥𝑦 + 2𝑥 − 𝑥 2 − 2𝑦 2 + 72
If the plate is 8 m long (x dimension) and 6 m wide (y dimension), compute the average temperature.

Solution:
Let us merely use two-segment applications of the trapezoidal rule in each dimension. The temperatures at the necessary x
and y values are depicted in figure (9).
To make the evaluation numerically, the trapezoidal rule is first implemented along the x dimension for each y value. These
values are then integrated along the y dimension to give the final result.

22
23

You might also like