Math 2207: Numerical Analysis and
Statistics
Md. Araf Hossan
Lecturer
Department of Mechanical and Production Engineering
Ahsanullah University of Science and Technology
Lectures on Numerical Analysis and Statistics
[Lecture on Integration (Simpson’s Rule)]
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 1
Simpson’s rule
If there are two points equally spaced between and , the four points can be connected
with a third-order polynomial
For example If there is an extra pint midway between
and , the three points can be connected
with a parabola.
If there are two points equally spaced
between and , the four points can be
connected with a third-order polynomial
The numerical integration method that is based on second and third order
polynomials are called Simpson’s rule.
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 2
Basis of Simpson’s 1/3 rule
Simpson’s 1/3rd rule is an extension of Trapezoidal rule where the integrand is
approximated by a second order polynomial
𝑏 𝑏
∫ 𝑓 ( 𝑥 ) 𝑑𝑥 ≈ ∫ 𝑓 2 ( 𝑥 ) 𝑑𝑥
𝑎 𝑎
𝑥𝑖 +1 , 𝑦 𝑖 +1 2
𝑓 2 ( 𝑥 ) =𝑎 0 +𝑎 1 𝑥+ 𝑎 2 𝑥
𝑥𝑖 , 𝑦 𝑖 𝑥𝑖 +2 , 𝑦 𝑖 +2
2
𝑓 2 ( 𝑥 ) = 𝑦 =𝑎 0 +𝑎 1 𝑥 +𝑎 2 𝑥
∆𝑥 ∆𝑥
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 3
Basis of Simpson’s 1/3 rule
Area=
3 3
𝑎2 ∆ 𝑥 𝑎2 ∆ 𝑥 𝑎1
¿ + + ( ∆ 𝑥 2 −∆ 𝑥 2 ) +𝑎 0 ( ∆ 𝑥+ ∆ 𝑥 )
3 3 2
2 3
¿ 𝑎2 ∆ 𝑥 +2 𝑎 0 ∆ 𝑥 (𝑖 )
3
At 𝑦 =
𝑖 𝑓 ¿
At 𝑦 𝑖+ 1 = 𝑓 ¿
At 𝑦 𝑖+ 2 = 𝑓 ¿
( 𝑖𝑖 ) +(𝑖𝑣 )
2 2
𝑦 𝑖+ 2+ 𝑦 𝑖 =𝑎 0 +𝑎 1 ∆ 𝑥 +𝑎 2 ∆ 𝑥 + 𝑎0 − 𝑎1 ∆ 𝑥+ 𝑎 2 ∆ 𝑥
2
𝑦 𝑖+ 2+ 𝑦 𝑖 =2 𝑎 0 +2 𝑎 2 ∆ 𝑥
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 4
Basis of Simpson’s 1/3 rule
𝑦 𝑖+ 2+ 𝑦 𝑖 =2 𝑎 0 +2 𝑎 2 ∆ 𝑥
2 ∴ 𝑦 𝑖 +1= 𝑎 0 𝑦 𝑖+ 2+ 𝑦 𝑖 =2 𝑦 𝑖 +1 +2 𝑎 2 ∆ 𝑥
2
2
𝑦 𝑖+ 2+ 𝑦 𝑖 − 2 𝑦 𝑖 +1 =2 𝑎 2 ∆ 𝑥
𝑦 𝑖+ 2+ 𝑦 𝑖 − 2 𝑦 𝑖+1
𝑎 2= 2
2 ∆𝑥
Substituting the values of , and in Eq.(i)
Area
1
¿ × 𝑦 𝑖 +2 + 𝑦 𝑖 −2 𝑦 𝑖 +1 × ∆ 𝑥+ 2× 𝑦 𝑖 +1 ×∆ 𝑥
3
∆𝑥
¿ ( 𝑦 𝑖 +2 + 𝑦 𝑖 − 2 𝑦 𝑖 +1+ 6 𝑦 𝑖 +1 )
3
∆𝑥
¿ ( 𝑦 𝑖 +2 +4 𝑦 𝑖 +1 + 𝑦 𝑖)
3
2h
¿ ( 𝑦 𝑖 +2 + 4 𝑦 𝑖+ 1+ 𝑦 𝑖 )
6
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 5
Multi segment Simpson’s 1/3 rule
• The accuracy of single application of Simpson’s 1/3rd rule can be improved by
dividing the interval into number of strips of equal width.
• Since three points are needed for defining a quadratic polynomial, the Simpson’s
1/3 method is applied to two adjacent subinterval at a time.
• The whole interval has to be divided into an even number of subintervals.
• Suppose we have equally spaced
points, with number of strips of
equal width. The step size, is
computed as:
𝑏 −𝑎 𝑥 𝑛 − 𝑥 0
h= =
𝑛 𝑛
• Here and are designated as and ,
respectively
𝑏 𝑥𝑛
∫ 𝑓 ( 𝑥 ) 𝑑𝑥=∫ 𝑓 ( 𝑥 ) 𝑑𝑥
𝑎 𝑥𝑖
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 6
Multi segment Simpson’s 1/3 rule
𝑏 𝑥2 𝑥4 𝑥𝑛 −2 𝑥𝑛
∫ 𝑓 ( 𝑥 ) 𝑑𝑥=∫ 𝑓 ( 𝑥 ) 𝑑𝑥+∫ 𝑓 ( 𝑥 ) 𝑑𝑥 +… … … … … … ..+ ∫ 𝑓 ( 𝑥 ) 𝑑𝑥 + ∫ 𝑓 ( 𝑥 ) 𝑑𝑥
𝑎 𝑥0 𝑥2 𝑥 𝑛− 4 𝑥 𝑛− 2
Applying Simpson’s 1/3rd rule for each interval
Since
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 7
Multi segment Simpson’s 1/3 rule
𝑏 − 𝑎 𝑥𝑛− 𝑥0
[ ∴ h= = ]
𝑛 𝑛
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 8
Multi segment Simpson’s 1/3 rule
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 9
Simpson’s1/3rd rule-example
Evaluate the following integral, using (i) analytically, (b) single application of Simpson’s 1/3
rule; (iii) multiple application Simpson’s 1/3 rule with =4
𝜋/ 2
∫ ¿ ¿
0
(i) Analytical solution
𝜋 / 2
∫ ¿ ¿
0
¿ ([ 6 × 3.1416
2 ) + 3 × ( sin (
3.1416
2 ) − sin ( 0 ) )]=9.4248+ 3 − 0=12.4248
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 10
Simpson’s1/3rd rule-example
(ii) Simpson’s 1/3 solution
𝜋
2
h
𝐼 =∫ 𝑓 ( 𝑥 ) 𝑑𝑥 =¿ ¿¿
0 3
𝜋
2
But, 𝑏 −𝑎
∴ 𝐼 =∫ 𝑓 ( 𝑥 ) 𝑑𝑥 =¿ ¿¿
0 3 ×2
𝑎=0 ; 𝑓 ( 𝑎) = 𝑓 ( 0 ) =(6+3 × cos ( 0 ))=9
𝑎+ 𝑏
2
=
𝜋
4
; 𝑓 ( 𝑎+ 𝑏
2
=𝑓 ) ( )𝜋
4
=¿
𝑏= 𝜋 / 2 ; 𝑓 ( 𝑏 ) = 𝑓 ( )=¿
𝜋
2
𝜋
2
𝑏 −𝑎
∴ 𝐼 =∫ 𝑓 ( 𝑥 ) 𝑑𝑥 =¿ ¿ ¿
0 2× 3
¿ 1 2.4316
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 11
Simpson’s1/3rd rule-example
(iii) Multiple application Simpson’s 1/3 solution with n=4
𝜋
−0
Given that 𝑏− 𝑎 2 𝜋
∴ h= = =
𝑛 4 8
0 1 2 3 4
0
9 8.7716 8.1213 7.1481 6
( 𝜋 / 2 − 0)
𝐼= [ 9+ 4 × ( 8.7716+7.1481)+2 ×8.1213 +6 ] =12.4252
3×4
Analytical solution:
Error:
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 12
Simpson’s1/3rd rule-example
Evaluate the following integral, using (i) single application of Simpson’s 1/3 rule; (ii) multiple
application Simpson’s 1/3 rule with =4
3
∫ (1 −𝑒−2 𝑥 ) 𝑑𝑥
0
Single application of Simpson’s 1/3 rule
3
𝑏 −𝑎
But ∴ 𝐼 =∫ 𝑓 ( 𝑥 ) 𝑑𝑥 =¿ ¿¿
0 3 ×2
− 2× 0
𝑎=0 ; 𝑓 ( 𝑎 ) = 𝑓 ( 0 ) =(1 −𝑒 )=0
𝑎+ 𝑏 3+ 0 −2 ×1.5
= =1.5 ; 𝑓 ( 𝑏 ) = 𝑓 (1.5 )=(1 −𝑒 )=0.9502
2 2
−2 × 3
𝑏=3 ; 𝑓 ( 𝑏 ) = 𝑓 ( 3 )=(1 −𝑒 )=0.9975
3
𝑏 −𝑎
∴ 𝐼 =∫ 𝑓 ( 𝑥 ) 𝑑𝑥 =¿ ¿ ¿
0 3 ×2
¿ 2 .399
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 13
Simpson’s1/3rd rule-example
Single application of Simpson’s 1/3 rule
𝑏− 𝑎 3 −0
Given that ∴ h= = =0.75
𝑛 4
0 1 2 3 4
0
0 0.77687 0.95021 0.9889 0.9975
( 3 − 0)
𝐼= [ 0+ 4 ×(0.77687 +0.9889)+2 × 0.9502+0.9975 ] =2.4902
3×4
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 14
Basis of Simpson’s 3/8 rule
Simpson’s 1/3rd rule is an extension of Trapezoidal rule where the integrand is
approximated by a third order polynomial
𝑏 𝑏
1 ∫ 𝑓 ( 𝑥 ) 𝑑𝑥 ≈ ∫ 𝑓 3 ( 𝑥 ) 𝑑𝑥
− ∆ 𝑥 , 𝑦 𝑖 +1
2 𝑎 𝑎
1
∆ 𝑥 , 𝑦 𝑖 +2 𝑓 3 ( 𝑥 ) =𝑎 0 +𝑎 1 𝑥 +𝑎 2 𝑥 +𝑎 3 𝑥
2 3
2
3 𝑓 3 ( 𝑥 ) = 𝑦 =𝑎 0 +𝑎 1 𝑥 +𝑎 2 𝑥 +𝑎 3 𝑥
2 3
− ∆ 𝑥 , 𝑦𝑖
2
3
∆ 𝑥 , 𝑦 𝑖 +3
2
∆𝑥 ∆𝑥 ∆𝑥
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 15
Basis of Simpson’s 3/8 rule
Area=
𝑎3
[( ) ( ) ] [( ) ( ) ] 𝑎2
4 4 3 3
3 3 3 3
¿ ∆𝑥 − − ∆𝑥 + ∆𝑥 − − ∆𝑥
4 2 2 3 2 2
[( ) ( ) ] [
+𝑎1
]
2 2
3 3 3 3
∆𝑥 − ∆ 𝑥 +𝑎 0 ∆𝑥− ∆𝑥
2 2 2 2 2
9 3
¿ 𝑎2 ∆ 𝑥 + 3 𝑎 0 ∆ 𝑥 (𝑖 )
4
27 9 3
At 𝑦 𝑖=− 𝑎 3 ∆ 𝑥 3 + 𝑎 2 ∆ 𝑥 2 − ∆ 𝑥 𝑎1 + 𝑎0 (ii)
8 4 2
1 3 1 2 1
At 𝑦 𝑖+1 =− 𝑎 3 ∆ 𝑥 + 𝑎2 ∆ 𝑥 − ∆ 𝑥 𝑎 1+ 𝑎 0 (iii)
8 4 2
1 1 1
At 𝑦 𝑖+ 2= 𝑎3 ∆ 𝑥 3 + 𝑎 2 ∆ 𝑥2 + ∆ 𝑥 𝑎 1+ 𝑎 0 (iv )
8 4 2
27 9 3
At 𝑦 𝑖+ 3= 𝑎 3 ∆ 𝑥 3 + 𝑎2 ∆ 𝑥 2+ ∆ 𝑥 𝑎1 +𝑎 0 ( v )
8 4 2
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 16
Basis of Simpson’s 3/8 rule
( 𝑖𝑖 ) +(𝑣 )
27 9 3 27 9 3
𝑦 𝑖 + 𝑦 𝑖 +3 =− 𝑎 3 ∆ 𝑥3 + 𝑎 2 ∆ 𝑥 2 − ∆ 𝑥 𝑎1 +𝑎 0 + 𝑎 3 ∆ 𝑥 3 + 𝑎2 ∆ 𝑥 2+ ∆ 𝑥 𝑎1 +𝑎 0
8 4 2 8 4 2
9 2 9 2 9 2 9 2
¿ 𝑎2 ∆ 𝑥 + 𝑎 0+ 𝑎 2 ∆ 𝑥 +𝑎 0 = 2 𝑎 2 ∆ 𝑥 +2 𝑎 0= 𝑎2 ∆ 𝑥 +2 𝑎 0
4 4 4 2
∴ 9 𝑎 2 ∆ 𝑥2 + 4 𝑎 0 =2 𝑦 𝑖 + 2 𝑦 𝑖+ 3 (𝑣𝑖)
( 𝑖𝑖𝑖 ) +(𝑖𝑣 )
1 1 1 1 1 1
𝑦 𝑖+1 + 𝑦 𝑖 +2=− 𝑎 3 ∆ 𝑥 3+ 𝑎 2 ∆ 𝑥 2 − ∆ 𝑥 𝑎 1 +𝑎 0 + 𝑎 3 ∆ 𝑥 3 + 𝑎2 ∆ 𝑥 2+ ∆ 𝑥 𝑎 1+ 𝑎 0
8 4 2 8 4 2
1 2 1 2 1 2 1 2
𝑦 𝑖+1 + 𝑦 𝑖 +2= 𝑎2 ∆ 𝑥 + 𝑎 0 + 𝑎 2 ∆ 𝑥 +𝑎 0 = 2 𝑎 2 ∆ 𝑥 +2 𝑎 0= 𝑎 2 ∆ 𝑥 + 𝑎 0
4 4 4 2
2
∴ 𝑎2 ∆ 𝑥 + 4 𝑎 0 =2 𝑦 𝑖 +1 + 2 𝑦 𝑖 + 2 (𝑣𝑖𝑖 )
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 17
Basis of Simpson’s 3/8 rule
( 𝑣𝑖 ) −(𝑣𝑖𝑖)
9 𝑎2 ∆ 𝑥2 + 4 𝑎0 − 𝑎2 ∆ 𝑥 2 − 4 𝑎0 =2 𝑦 𝑖 + 2 𝑦 𝑖 +3 − 2 𝑦 𝑖 +1 − 2 𝑦 𝑖 +2
2
8 𝑎2 ∆ 𝑥 =2 𝑦 𝑖 + 2 𝑦 𝑖 +3 −2 𝑦 𝑖 +1 − 2 𝑦 𝑖 +2
𝑦 𝑖 + 𝑦 𝑖 +3 − 𝑦 𝑖 +1 − 𝑦 𝑖 +2
𝑎 2= 2
( 𝑣𝑖𝑖𝑖)
4∆ 𝑥
Substituting Eq. in Eq. (
𝑦 𝑖 + 𝑦 𝑖 +3 − 𝑦 𝑖 +1 − 𝑦 𝑖+ 2 2
2
∆ 𝑥 + 4 𝑎0 =2 𝑦 𝑖 +1 +2 𝑦 𝑖 +2
4∆𝑥
𝑦 𝑖 + 𝑦 𝑖+ 3 − 𝑦 𝑖 +1 − 𝑦 𝑖 +2 8 𝑦 𝑖+1 + 8 𝑦 𝑖 +2 − 𝑦 𝑖 − 𝑦 𝑖 +3 + 𝑦 𝑖+1 + 𝑦 𝑖 +2
4 𝑎 0= 2 𝑦 𝑖 +1+ 2 𝑦 𝑖 +2 − =
4 4
9 𝑦 𝑖+ 1+ 9 𝑦 𝑖 +2 − 𝑦 𝑖 − 𝑦 𝑖 +3
4 𝑎 0=
4
9 𝑦 𝑖+ 1+ 9 𝑦 𝑖 +2 − 𝑦 𝑖 − 𝑦 𝑖 +3
∴ 𝑎 0= (𝑖𝑥)
16
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 18
Basis of Simpson’s 3/8 rule
Substituting the values and in Eq.
Area
9 9 𝑦 𝑖+1 + 9 𝑦 𝑖 +2 − 𝑦 𝑖 − 𝑦 𝑖 +3
¿ ( 𝑦 ¿ ¿ 𝑖+ 𝑦 𝑖+ 3 − 𝑦 𝑖 +1 − 𝑦 𝑖 +2 ) ∆ 𝑥 +3 ∆𝑥¿
16 16
3
¿ ∆ 𝑥( 3 𝑦 𝑖 + 3 𝑦 𝑖 +3 −3 𝑦 𝑖+1 −3 𝑦 𝑖 +2+ 9 𝑦 𝑖 +1 +9 𝑦 𝑖+ 2 − 𝑦 𝑖 − 𝑦 𝑖+ 3)
16
3
¿ ∆ 𝑥( 2 𝑦 𝑖 +6 𝑦 𝑖 +1+ 6 𝑦 𝑖 +2 + 2 𝑦 𝑖+ 3)
16
3 Here
¿ ∆ 𝑥( 𝑦 𝑖 + 3 𝑦 𝑖 +1 +3 𝑦 𝑖+2 + 𝑦 𝑖 +3 )
8
3 3 𝑏− 𝑎
∴ 𝐼= ∆ 𝑥 ( 𝑦 𝑖 +3 𝑦 𝑖+ 1+ 3 𝑦 𝑖 +2 + 𝑦 𝑖+ 3 )= ( 𝑦 𝑖 +3 𝑦 𝑖+ 1+ 3 𝑦 𝑖 +2 + 𝑦 𝑖+ 3 )
8 8 3
1
∴ 𝐼= (𝑏 − 𝑎) ( 𝑦 𝑖 +3 𝑦 𝑖 +1 +3 𝑦 𝑖 +2+ 𝑦 𝑖 +3 )
8
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 19
Multi segment Simpson’s 3/8 rule
• The accuracy of single application of Simpson’s 3/8th rule can be improved by
dividing the interval into number of strips of equal width.
• Since four points are needed for defining a quadratic polynomial, the Simpson’s 1/3
method is applied to three adjacent subinterval at a time.
• The whole interval has to be divided into a number of subintervals that is divisible
by 3.
• Suppose we have equally spaced
points, with number of strips of
equal width. The step size, is
computed as:
𝑏 −𝑎 𝑥 𝑛 − 𝑥 0
h= =
𝑛 𝑛
• Here and are designated as and ,
𝑥𝑛
𝑏
respectively
∫ 𝑓 ( 𝑥 ) 𝑑𝑥=∫ 𝑓 ( 𝑥 ) 𝑑𝑥
𝑎 𝑥𝑖
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 20
Multi segment Simpson’s 3/8 rule
𝑏 𝑥3 𝑥6 𝑥 𝑛− 3 𝑥𝑛
∫ 𝑓 ( 𝑥 ) 𝑑𝑥=∫ 𝑓 ( 𝑥 ) 𝑑𝑥+∫ 𝑓 ( 𝑥 ) 𝑑𝑥 +… … … … … … ..+ ∫ 𝑓 ( 𝑥 ) 𝑑𝑥+ ∫ 𝑓 ( 𝑥 ) 𝑑𝑥
𝑎 𝑥0 𝑥3 𝑥 𝑛− 6 𝑥 𝑛− 3
Applying Simpson’s 3/8th rule for each interval
…+ ( 𝑥𝑛 −6 − 𝑥 𝑛 −3 ) [ 𝑓 ( 𝑥 𝑛 −6 ) +3 𝑓 ( 𝑥𝑛 −5 ) + 3 𝑓 ( 𝑥 𝑛 − 4 ) + 𝑓 ( 𝑥𝑛 − 3 )
8 ]
Since
…+ 3 h [
𝑓 ( 𝑥𝑛− 6 ) + 3 𝑓 ( 𝑥 𝑛− 5 ) +3 𝑓 ( 𝑥 𝑛−4 ) + 𝑓 ( 𝑥 𝑛 −3 )
8 ] [
+3 h
𝑓 ( 𝑥𝑛 −3 ) + 3 𝑓 ( 𝑥 𝑛− 2 ) +3 𝑓 ( 𝑥𝑛 −1 ) + 𝑓 ( 𝑥 𝑛 )
8
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 21
Multi segment Simpson’s 3/8 rule
…+ 3 h [
𝑓 ( 𝑥𝑛− 6 ) + 3 𝑓 ( 𝑥 𝑛− 5 ) +3 𝑓 ( 𝑥 𝑛−4 ) + 𝑓 ( 𝑥 𝑛 −3 )
8 ] [
+3 h
𝑓 ( 𝑥𝑛 −3 ) + 3 𝑓 ( 𝑥 𝑛− 2 ) +3 𝑓 ( 𝑥𝑛 −1 ) + 𝑓 ( 𝑥 𝑛 )
8
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 22
Multi segment Simpson’s 3/8 rule
𝑏 − 𝑎 𝑥𝑛− 𝑥0
[ ∴ h= = ]
𝑛 𝑛
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 23
Simpson’s 3/8 Rule - Example
Evaluate the following integral, using (i) single application of Simpson’s 3/8 rule
𝜋/ 2
∫ ¿ ¿
0
True value=
(ii) Single application of Simpson’s 3/8 rule
𝜋
−0
𝜋
𝑎= 0 ; 𝑏= ; 𝑛=3 ; h=
2
𝑏 −𝑎
3
=
2
3
𝜋
= 𝑏=
6
; 𝜋 / 2 ; 𝑓 ( 𝑏 )= 𝑓 ( )=¿
𝜋
2
0
9 8.5981 7.5 6 𝑓 ( 𝑎 )= 𝑓 ( 0 )=(6+ 3 ×cos ( 0 ) )=9
∴ 𝐼=
1
8
( 𝑏− 𝑎 ) ( 𝑦 𝑖 + 3 𝑦 𝑖 +1 +3 𝑦 𝑖+ 2+ 𝑦 𝑖 +3 ) =
1
8 ( 𝜋
2 )
− 0 × (9+ 3 × 8.5981+3 × 7.5+6)
¿ 12.4278
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 24
Simpson’s 3/8 Rule - Example
Evaluate the following integral, using single application of Simpson’s 3/8 rule
3
∫ (1 −𝑒−2 𝑥 ) 𝑑𝑥 True value=
0
(ii) Single application of Simpson’s 3/8 rule
− 2× 0
𝑏− 𝑎 3− 0
𝑎=0 ; 𝑓 ( 𝑎 ) = 𝑓 ( 0 ) =(1 −𝑒 )=0
𝑎=0 ; 𝑏=3 ; 𝑛=3 ; h= = =1
3 3 𝑏=3 ; 𝑓 ( 𝑏 ) = 𝑓 ( 3 )=(1 −𝑒
−2 × 3
)=0.997
0
0 0.8647 0.9817 0.9975
1
∴ 𝐼= ( 𝑏− 𝑎 ) ( 𝑦 𝑖 + 3 𝑦 𝑖 +1 +3 𝑦 𝑖+ 2+ 𝑦 𝑖 +3 )
8
1
¿ ( 3 −0 ) ×(0 +3 × 0.8647+3 × 0.9817+ 0.9975)
8
¿ 2.4513
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 25
Simpson’s 3/8 Rule - Example
Evaluate the following integral, using Simpson’s 3/8 rule
1 2 ×1
∫ 14 2𝑥
𝑑𝑥 True value= 𝑏=3 ; 𝑓 ( 𝑏 ) = 𝑓 ( 3 )=14 =1
0
2 ×0
𝑎=0 ; 𝑓 ( 𝑎 ) = 𝑓 ( 0 ) =(14 )=1
𝑏 − 𝑎 1− 0 1
𝑎=0 ; 𝑏=1; 𝑛=3 ; h= = =
3 3 3
0
1 5.8088 33.742 196
1
∴ 𝐼= ( 𝑏− 𝑎 ) ( 𝑦 𝑖 + 3 𝑦 𝑖 +1 +3 𝑦 𝑖+ 2+ 𝑦 𝑖 +3 )
8
1
¿ ( 1− 0 ) ×(1+3 ×5.8088+ 3 ×33.742+196 )
8
¿ 39.4565
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 26
Simpson’s 3/8 Rule - Example
The function is given in the following tabulated form. Compute using composite Simpson’s 3/8
rule; n=6
0 1 2 3 4 5 6
I=
=3.1162
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 27
Simpson’s 3/8 Rule - Example
The equation of a circle with a radius of 1 (unit circle) is given by and its area is . Consequently:
Evaluate the integral using composite Simpson’s 3/8 method with n=9
𝑏 −𝑎 1−(−1) 2
𝑎=− 1 ; 𝑏=1 ; 𝑛=9 ; h= = =
𝑛 9 9
0 1 2 3
-1 -0.7778 -0.5556 -0.3333
0 0.6285 0.8315 0.9428
4 5 6 7 8 9
-0.1111 0.1111 0.3333 0.5556 0.7778 1
0.9938 0.9938 0.9428 0.8315 0.6285 0
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 28
Simpson’s 3/8 Rule - Example
0 1 2 3
-1 -0.7778 -0.5556 -0.3333
0 0.6285 0.8315 0.9428
4 5 6 7 8 9
-0.1111 0.1111 0.3333 0.5556 0.7778 1
0.9938 0.9938 0.9428 0.8315 0.6285 0
I=
=1.5411
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 29
Integration with unequal segments
• All formulas for numerical integration have been based on
equally spaced data points.
• Simpson’s 1/3 method is only valid for an even number of
subintervals, where as Simpson’s 3/8 method is only valid for a
number of subinterval that is divisible by 3.
In practice, there are many situations where this assumption
does not hold and we may deal with unequal-sized segments.
For example, experimentally derived data are often of this type.
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 30
Integration with unequal segments
The function can be used to generate the following table of unequally spaced data:
Evaluate the integral from using: (i) the trapezoidal rule, (ii) a combination of the
trapezoidal and Simpson’s rule
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 31
Integration with unequal segments
The work produced by a constant temperature, pressure-volume thermodynamic
process can be computed as:
where is work, is pressure, and is volume. Using a combination of the trapezoidal
rule, Simpson’s 1/3 rule and Simpson’s 3/8 rule, use the following data to compute the
work in kJ (kJ=kN.m)
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 32
Integration with unequal segments
Determine the distance traveled for the following data:
Use: (a) Trapezoidal rule, (b) the best combination of the trapezoidal, and Simpson’s
rule.
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 33
Conclusion
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 34
Courtesy
Dr. Md. Shahnewaz Bhuiyan
Associate Professor
Department of Mechanical and Production Engineering
Ahsanullah University of Science and Technology
L-2, T-2, Dept. MPE Math 2207: Numerical Analysis and Statistics 35