You are on page 1of 10

NUMERICAL ANALYSIS

Lecture -23

Muhammad Rafiq
Assistant Professor
University of Central Punjab
Lahore Pakistan
𝟏
Simpson’s Rule
𝟑

Consider the integral


𝑏 𝑥 +𝑛ℎ
I = ∫𝑎 𝑓 (𝑥) 𝑑𝑥 = ∫𝑥 0 𝑓 (𝑥) 𝑑𝑥
0

𝑛 𝑢(𝑢−1) 2 𝑢(𝑢−1)(𝑢−2) 3
= h∫0 [𝑓0 + 𝑢∆𝑓0 + ∆ 𝑓0 + ∆ 𝑓0 + ⋯ ] 𝑑𝑢... (a)
2! 3!

In this case if we take interval of integration from x₀ to x₀+2h then


there are 3 functional value y₀ , y₁
and y₂ in the interval and consequently there is no difference higher
than 2.
Therefore neglecting all the differences of order higher than two
We can write equation (a) as :
Taking n=2
𝑥0 +2ℎ 2 (𝑢2 −𝑢) 2
I= ∫𝑥 𝑓(𝑥) 𝑑𝑥 = h∫0 [𝑓0 + 𝑢∆𝑓0 + ∆ 𝑓0 ] 𝑑𝑢
0 2!
2
𝑢2 1 𝑢3 𝑢2 2
I= h |𝑢𝑓0 + ∆𝑓0 + ( − )∆ 𝑓0 |
2 2 3 2 0
1
I= h[2𝑓0 + 2∆𝑓0 + ∆2 𝑓0 ]
3
1
I= h[2𝑓0 + 2(𝑓1 − 𝑓0 ) + (𝑓2 − 2𝑓1 + 𝑓0 )]
3
1 4 1
I= h[ 𝑓0 + 𝑓 + 𝑓]
3 3 1 3 2

I= [𝑓 + 4𝑓1 + 𝑓2 ]
3 0

This rule can be extended for ‘ n ’ multiple of ‘ 2 ‘ intervals as


follows :
𝑥0 +𝑛ℎ 𝑥0 +2ℎ 𝑥0 +4ℎ
I = ∫𝑥 𝑓 (𝑥) 𝑑𝑥 = ∫𝑥 𝑓(𝑥) 𝑑𝑥 + ∫𝑥 +2ℎ 𝑓 (𝑥) 𝑑𝑥
0 0 0
𝑥0 +6ℎ 𝑥0 +𝑛ℎ
+ ∫𝑥 +4ℎ 𝑓(𝑥) 𝑑𝑥 + ⋯ + ∫𝑥 +(𝑛−2)ℎ 𝑓(𝑥) 𝑑𝑥
0 0

ℎ ℎ ℎ
I= {𝑓 + 4𝑓1 + 𝑓2 }+ {𝑓2 + 4𝑓3 + 𝑓4 }+ {𝑓4 + 4𝑓5 + 𝑓6 }+
3 0 3 3

{𝑓 + 4𝑓𝑛−1 + 𝑓𝑛 }
3 𝑛−2
𝑏 ℎ
∫𝑎 𝑓(𝑥) 𝑑𝑥 = [𝑓0 + 4𝑓1 + 2𝑓2 + 4𝑓3 + 2𝑓4 + 4𝑓5 + 2𝑓6 + ⋯ +
3
2𝑓𝑛−2 + 4𝑓𝑛−1 + 𝑓𝑛 ]
𝑏 ℎ
∫𝑎 𝑓(𝑥) 𝑑𝑥 = [𝑓0 + 4(𝑓1 + 𝑓3 + 𝑓5 + ⋯ 𝑓𝑛−1 ) + 2(𝑓2 + 𝑓4 +
3
𝑓6 + ⋯ + 𝑓𝑛−2 ) + 𝑓𝑛 ]
The above formula is called Simpsons 1/3Rule.
Example No: 1

1 1
Evaluate the integral ∫0 1+𝑥 2 𝑑𝑥 Using

(i) Trapezoidal Rule ( n=4 )


1
(ii) Simpson’s Rule ( n=4 )
3

Obtain the exact solution and justify which method is superior .


Solution:-
(i) Trapezoidal Rule ( n=4 )

𝑏−𝑎 1−0
a=0 b=1 , h= = =0.25
𝑛 4
x 0 0.25 0.50 0.75 1.0

f(x) 0 0.94118 0.80 0.64 0.5

1 1 ℎ
∫0 1+𝑥 2 𝑑𝑥 = [𝑓 + 2(𝑓1 + 𝑓2 + 𝑓3 ) + 𝑓4 ]
2 0

1 1 0.25
∫0 1+𝑥 2 𝑑𝑥 = [1 + 2(0.94118 + 0.8 + 0.64) + 0.5]
2
1 1
∫0 1+𝑥 2 𝑑𝑥 = 0.782795
1
(ii) Simpson’s Rule ( n=4 )
3
1
Using Simpson’s Rule :
3
1 ℎ
∫0 𝑓(𝑥) 𝑑𝑥 = [𝑓 + 4(𝑓1 + 𝑓3 ) + 2𝑓2 + 𝑓4 ]
3 0
1 0.25
∫0 𝑓(𝑥) 𝑑𝑥 = [1 + 4(0.94118 + 0.64) + 2(0.8) + 0.5]
3
1
∫0 𝑓(𝑥) 𝑑𝑥 = 0.785393
Exact Value:-
1 1
∫0 1+𝑥 2 𝑑𝑥 = | tan−1 𝑥|10

=tan−1 (1) - tan−1 (0)


1 1
∫0 1+𝑥 2 𝑑𝑥 = 0.785398

Note:-
1
The answer obtained by Simpson’s ( ) Rule is closer to
3
exact value than the answer calculated by Trapezoidal Rule.
Therefore Simpson’s 1/3 Rule is superior than Trapezoidal Rule.
𝑬𝒙𝒆𝒓𝒄𝒊𝒔𝒆
Evaluate the following integrals using Simpson’s 1/3 Rule .
𝜋
𝑄#1. ∫ 𝑆𝑖𝑛 𝑥 𝑑𝑥 𝑓𝑜𝑟 𝑛 = 6
0
𝜋
𝑄#2. ∫ 𝐶𝑜𝑠 𝑥 𝑑𝑥 𝑓𝑜𝑟 𝑛 = 6
0
7
1
𝑄#3. ∫ 𝑑𝑥 𝑓𝑜𝑟 𝑛 = 6
2 ln 𝑥
1
𝑥2
𝑄#4. ∫ 𝑒 𝑑𝑥 𝑓𝑜𝑟 𝑛 = 6
0
𝑄#5.
10
Evaluate the integral ∫0 𝑦 𝑑𝑥 using 5 points simpson’s
1
( ) rule from the following data.
3

X 0 2.5 5.0 7.5 10

Y 0 18.25 75.0 168.75 300

If y = 3𝑥 2 compare your result with exact value.

You might also like