Department of Civil Engineering
CENUMES 313 – NUMERICAL SOLUTIONS TO CIVIL ENGINEERING PROBLEMS
Numerical Integration
8.2.2 Simpson’s Rule
Simpson’s rule is one of the numerical methods which is used to evaluate a definite integral. Usually,
to find the definite integral, we use the fundamental theorem of calculus, where we have to apply the
antiderivative techniques of integration. But sometimes it is difficult to find the antiderivative of an integral, like
in the case of Scientific Experiments, where the function has to be determined from the observed readings.
Therefore, the numerical methods are used to approximate the integral in such conditions. Other numerical
methods used are trapezoidal rule and midpoint rule. Here, we are going to discuss Simpson’s rule formula, 1/3
rule, 3/8 rule
[Link] Simpson 1/3 Rule
Simpson’s 1/3rd rule is an extension of the trapezoidal rule in which the integrand is approximated by
a second-order polynomial. Simpson rule can be derived from the various way using Newton’s divided
difference polynomial, Lagrange polynomial and the method of coefficients. Simpson’s 1/3 rule is defined by:
𝒃
𝒉
∫ 𝒇(𝒙)𝒅𝒙 = [(𝒇(𝒙𝟎 ) + 𝒇(𝒙𝒏 )) + 𝟒((𝒇(𝒙𝟏 ) + 𝒇(𝒙𝟑 ) + 𝒇(𝒙𝟓 )+. . . . +(𝒇(𝒙𝒏−𝟏 )) + 𝟐(𝒇(𝒙𝟐 ) + 𝒇(𝒙𝟒 ) + 𝒇(𝒙𝟔 )+. . . . +𝒇(𝒙𝒏−𝟐 )]
𝒂 𝟑
𝒃
𝒉
∫ 𝒇(𝒙)𝒅𝒙 = {[𝒇(𝒙𝟎 ) + 𝒇(𝒙𝒏 )] + 𝟒 ∑ 𝒇(𝒙𝒊 ) + 𝟐 ∑ 𝒇(𝒙𝒊 )}
𝒂 𝟑
𝒊= 𝒊=
𝐨𝐝𝐝 𝐞𝐯𝐞𝐧
Figure [Link] Graphical representation of Simpson’s 1/3 Rule
Two Cases of Simpson’s 1/3 Rule
a. If the number of intervals 𝑛 is EVEN.
(Use Pure Simpson’s 1/3 Rule)
b. If the number of intervals 𝑛 is ODD.
(Use Trapezoidal Rule for the last interval)
Example [Link].1 Calculate the area bounded by, 𝑦 = 5𝑥𝑒 −2𝑥 , from x = 0.1 to 1.3.
Assume 6 intervals, n = 6.
𝒃
𝒉
∫ 𝒇(𝒙)𝒅𝒙 = [(𝒇(𝒙𝟎 ) + 𝒇(𝒙𝒏 )) + 𝟒((𝒇(𝒙𝟏 ) + 𝒇(𝒙𝟑 ) + 𝒇(𝒙𝟓 )+. . . . +(𝒇(𝒙𝒏−𝟏 )) + 𝟐(𝒇(𝒙𝟐 ) + 𝒇(𝒙𝟒 ) + 𝒇(𝒙𝟔 )+. . . . +𝒇(𝒙𝒏−𝟐 )]
𝒂 𝟑
𝑏−𝑎 1.3−0.1
ℎ= = = 0.2
𝑛 6
Every interval has 0.2 units, we have six intervals with seven points, starting from 0.1 to 1.3
(0.1, 0.3, 0.5, 0.7, 0.9, 1.1, 1.3)
𝑥0 = 0.1
𝑥1 = 0.3
1
Department of Civil Engineering
CENUMES 313 – NUMERICAL SOLUTIONS TO CIVIL ENGINEERING PROBLEMS
𝑥2 = 0.5
𝑥3 = 0.7
𝑥4 = 0.9
𝑥5 = 1.1
𝑥6 = 1.3
Figure [Link].1 Graph of the function with even intervals
1.3
I = ∫ 5xe−2x dx
0.1
h
I= [(f(x0 ) + f(x6 )) + 4(f(x1 ) + f(x3 ) + f(x5 )) + 2(f(x2 ) + f(x4 ))]
3
0.2
I= [(f(0.1) + f(1.3)) + 4(f(0.3) + f(0.7) + f(1.1)) + 2(f(0.5) + f(0.9))]
3
0.2
I= [(0.4094 + 0.4828) + 4(0.8232 + 0.8631 + 0.6094) + 2(0.9197 + 0.7438)]
3
𝟏.𝟑
𝐈 = ∫ 𝟓𝐱𝐞−𝟐𝐱 𝐝𝐱 ≅ 𝟎. 𝟖𝟗𝟑𝟒𝟕
𝟎.𝟏
Example [Link].2 Calculate the area bounded by the curve, 𝑦 = √4 − √𝑥, from x = 0 to 16.
Assume 8 intervals, n = 8
𝒃
𝒉
∫ 𝒇(𝒙)𝒅𝒙 = [(𝒇(𝒙𝟎 ) + 𝒇(𝒙𝒏 )) + 𝟒((𝒇(𝒙𝟏 ) + 𝒇(𝒙𝟑 ) + 𝒇(𝒙𝟓 )+. . . . +(𝒇(𝒙𝒏−𝟏 )) + 𝟐(𝒇(𝒙𝟐 ) + 𝒇(𝒙𝟒 ) + 𝒇(𝒙𝟔 )+. . . . +𝒇(𝒙𝒏−𝟐 )]
𝒂 𝟑
𝑏−𝑎 16−0
ℎ= = =2
𝑛 8
Every interval has 2 units, we have eight intervals with nine points, starting from 0 to 16
(0, 2, 4, 6, 8, 10, 12, 14, 16)
𝑥0 = 0
𝑥1 = 2
𝑥2 = 4
𝑥3 = 6
𝑥4 = 8
𝑥5 = 10
𝑥6 = 12
𝑥7 = 14
𝑥8 = 16
2
Department of Civil Engineering
CENUMES 313 – NUMERICAL SOLUTIONS TO CIVIL ENGINEERING PROBLEMS
Figure [Link].2 Using number line to represent the intervals in Simpson’s 1/3 rule
16
∫ √4 − √𝑥𝑑𝑥
0
h
I= [(f(x0 ) + f(x8 )) + 4(f(x1 ) + f(x3 ) + f(x5 ) + f(x7 )) + 2(f(x2 ) + f(x4 ) + f(x6 ))]
3
2
I= [(f(0) + f(16)) + 4(f(2) + f(6) + f(10) + f(14)) + 2(f(4) + f(8) + f(12))]
3
2
I= [(2 + 0) + 4(1.6080 + 1.2452 + 0.9153 + 0.5083) + 2(1.4142 + 1.0824 + 0.7321)]
3
𝟏𝟔
∫ √𝟒 − √𝒙𝒅𝒙 ≅ 𝟏𝟕. 𝟎𝟒𝟑𝟏
𝟎
[Link] Simpson 3/8 Rule
Another method of numerical integration method is called “Simpson’s 3/8 rule”. It is completely based
on the cubic interpolation rather than the quadratic interpolation. Simpson’s 3/8 or three-eight rule is given by:
𝒃
𝟑𝒉
∫ 𝒇(𝒙)𝒅𝒙 = [(𝒇(𝒙𝟎 ) + 𝒇(𝒙𝒏 )) + 𝟑((𝒇(𝒙𝟏 ) + 𝒇(𝒙𝟐 ) + 𝒇(𝒙𝟒 ) + 𝒇(𝒙𝟓 )+. . . . +(𝒇(𝒙𝒏−𝟏 )) + 𝟐(𝒇(𝒙𝟑 ) + 𝒇(𝒙𝟔 )
𝒂 𝟖
+ 𝒇(𝒙𝟗 )+. . . . +𝒇(𝒙𝒏−𝟑 )]
The 3/8 rule is known as Simpson’s second rule of integration.
Three cases of Simpson’s 3/8 Rule
a. If the number of intervals 𝑛 is DIVISIBLE BY 3.
(Use Pure Simpson’s 3/8 Rule)
b. If 𝑛 has a REMAINDER OF 1 upon DIVIDING BY 3.
(Simpson’s 3/8 Rule + Trapezoidal Rule on the last interval)
c. If 𝑛 has a REMAINDER OF 2 upon DIVIDING BY 3.
(Simpson’s 3/8 Rule + Simpson’s 1/3 on the last 2 intervals)
Example [Link].1. Calculate the area bounded by, 𝑦 = 5𝑥𝑒 −2𝑥 , from 𝑥 = 0.1 to 𝑥 = 1.3. Assume 6
intervals, 𝑛 = 6.
Solution:
𝑏
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑓(𝑥0 ) + 𝑓(𝑥𝑛 ))
𝑎 8
+ 3((𝑓(𝑥1 ) + 𝑓(𝑥2 ) + 𝑓(𝑥4 ) + 𝑓(𝑥5 )+. . . . +(𝑓(𝑥𝑛−1 )) + 2(𝑓(𝑥3 ) + 𝑓(𝑥6 )
+ 𝑓(𝑥9 )+. . . . +𝑓(𝑥𝑛−3 ))]
Determine the step-size ℎ
𝑏 − 𝑎 1.3 − 0.1
ℎ= = = 0.2
𝑛 6
3
Department of Civil Engineering
CENUMES 313 – NUMERICAL SOLUTIONS TO CIVIL ENGINEERING PROBLEMS
Every interval has 0.2 𝑢𝑛𝑖𝑡𝑠, we have six intervals with seven points, starting from 0.1 to 1.3
𝑥0 = 0.1 𝑥1 = 0. 3 𝑥2 = 0.5 𝑥3 = 0.7 𝑥4 = 0.9 𝑥5 = 1.1 𝑥6 = 1.3
Expand the Simpson’s 3/8 rule
1.3
𝐼 = ∫ 5𝑥𝑒 −2𝑥 𝑑𝑥
0.1
3(0.2)
= ([𝑓(𝑥0 ) + 𝑓(𝑥6 )] + 3[𝑓(𝑥1 ) + 𝑓(𝑥2 ) + 𝑓(𝑥4 ) + 𝑓(𝑥5 )] + 2[𝑓(𝑥3 )])
8
𝑥0 = 0.1 𝑥1 = 0. 3 𝑥2 = 0.5 𝑥3 = 0.7 𝑥4 = 0.9 𝑥5 = 1.1 𝑥6 = 1.3
1.3
𝐼 = ∫ 5𝑥𝑒 −2𝑥 𝑑𝑥
0.1
3(0.2)
([𝑓(𝑥0 ) + 𝑓(𝑥6 )] + 3[𝑓(𝑥1 ) + 𝑓(𝑥2 ) + 𝑓(𝑥4 ) + 𝑓(𝑥5 )] + 2[𝑓(𝑥3 )])
=
8
Evaluate the original function with the obtained data points.
Substituting the values of the function
1.3
𝐼 = ∫ 5𝑥𝑒 −2𝑥 𝑑𝑥
0.1
3(0.2)
= ([0.40937 + 0.48278] + 3[0.82322 + 0.91970 + 0.74384 + 0.60942]
8
+ 2[0.86309])
𝑰 = 𝟎. 𝟖𝟗𝟑𝟎𝟐 𝐬𝐪. 𝐮𝐧𝐢𝐭𝐬
[Link] Boole’s Rule
Boole’s rule is an approximation to the integral of 𝑓(𝑥) over [x0, x4]. Boole’s rule named after George
Boole, a famous mathematician, is being derived by putting n = 4 in the general quadrature formula. n = 4
means f(x) can be approximated by a polynomial of 4th degree so that fifth and higher order differences are
vanishing in the general quadrature formula.
𝑥5
2ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [7𝑓(𝑥1 ) + 32𝑓(𝑥2 ) + 12𝑓(𝑥3 ) + 32𝑓(𝑥4 ) + 7𝑓(𝑥5 )]
𝑥1 45
Example [Link].1 Calculate the area bounded by, 𝑦 = 𝑙𝑛𝑥 from x = 1.5 to 2.5
𝑏−𝑎 2.5−1.5
ℎ= = = 0.25
𝑛 4
Figure [Link] Using number line to represent the intervals in Boole’s Rule
2.5
∫ ln(𝑥) 𝑑𝑥
1.5
2.5
2ℎ
∫ ln(𝑥) 𝑑𝑥 = [7𝑓(𝑥1 ) + 32𝑓(𝑥2 ) + 12𝑓(𝑥3 ) + 32𝑓(𝑥4 ) + 7𝑓(𝑥5 )]
1.5 45
2.5
2ℎ
∫ ln(𝑥) 𝑑𝑥 = [7𝑓(1.5) + 32𝑓(1.75) + 12𝑓(2) + 32𝑓(2.25) + 7𝑓(2.5)]
1.5 45
4
Department of Civil Engineering
CENUMES 313 – NUMERICAL SOLUTIONS TO CIVIL ENGINEERING PROBLEMS
2.5
2(0.25)
∫ ln(𝑥) 𝑑𝑥 = [7𝑓(1.5) + 32𝑓(1.75) + 12𝑓(2) + 32𝑓(2.25) + 7𝑓(2.5)]
1.5 45
2.5
2(0.25)
∫ ln(𝑥) 𝑑𝑥 = [7(0.4055) + 32(0.5596) + 12(0.6931) + 32(0.8109) + 7(0.9163)]
1.5 45
𝟐.𝟓
∫ 𝐥𝐧(𝒙) 𝒅𝒙 ≅ 𝟎. 𝟔𝟖𝟐𝟓
𝟏.𝟓