Numerical Integration
Numerical Integration
Numerical Integration
or
I ∼= (b − a) × average height
where, for the trapezoidal rule, the average height is the average
of the function values at
the end points, or [ f (a) + f (b)]/2.
Generally;
Trapezoidal rule is given as
𝒙𝟎 +𝒏𝒉
𝒉
𝑰=∫ 𝒇(𝒙)𝒅𝒙 = [(𝒚𝟎 + 𝒚𝒏 ) + 𝟐(𝒚𝟏 + 𝒚𝟐 + ⋯ + 𝒚𝒏−𝟏 )]
𝒙𝟎 𝟐
𝒃
RULES FOR EVALUATING ∫𝒂 𝒇(𝒙)𝒅𝒙 USING
TRAPEZOIDAL RULE OR SIMPSON’S RULE
𝒃
1. Compare the given definite integral, say I, with ∫𝒂 𝒇(𝒙)𝒅𝒙 to
get the values of f(x) and limits a, b,
𝒃−𝒂
2. Compute h= , where n denotes the number of sub-intervals
𝒏
for the problem.
3. Find the values of y=f(x), corresponding to 𝒙𝟎 = 𝒂, 𝒙𝟏 = 𝒂 +
𝒉, 𝒙𝟐 = 𝒙𝟎 + 𝟐𝒉, … . , 𝒙𝒏 = 𝒙𝟎 + 𝒏𝒉 =
𝒃 𝒂𝒏𝒅 𝒅𝒆𝒏𝒐𝒕𝒆 𝒕𝒉𝒆𝒔𝒆 𝒗𝒂𝒍𝒖𝒆𝒔 𝒂𝒔 𝒚𝟎 , 𝒚𝟏 , 𝒚𝟐 , … . . , 𝒚𝒏. .
4. Apply the specified rule to calculate I (either Trapezoidal rule
or Simpson’s rule).
By trapezoidal rule, we have
𝒙𝟎 +𝒏𝒉
𝒉
𝑰=∫ 𝒇(𝒙)𝒅𝒙 = [(𝒚𝟎 + 𝒚𝒏 ) + 𝟐(𝒚𝟏 + 𝒚𝟐 + ⋯ + 𝒚𝒏−𝟏 )]
𝒙𝟎 𝟐
𝟏
Example: Use Trapezoidal Rule to evaluate ∫𝟎 𝒙𝟑 𝒅𝒙 considering 5
subintervals.
𝟏
Sol. Let 𝑰 = ∫𝟎 𝒙𝟑 𝒅𝒙.
h=0.2, f(x) = 𝒙𝟑
𝟏
𝑰 = ∫ 𝒙𝟑 𝒅𝒙
𝟎
𝟎. 𝟐
= [(𝟎 + 𝟏) + 𝟐(𝟎. 𝟎𝟎𝟖 + 𝟎. 𝟎𝟔𝟒 + 𝟎. 𝟐𝟏𝟔
𝟐
+ 𝟎. 𝟓𝟏𝟐)]
𝟏 𝒅𝒙 𝟏
Example: Evaluate ∫𝟎
𝟏+𝒙 𝟐 dx using Simpson’s
𝟑
rule taking h=0.25
𝟏
𝒅𝒙 𝒉
𝑰=∫ = [(𝒚𝟎 + 𝒚𝟒 ) + 𝟒(𝒚𝟏 + 𝒚𝟐 ) + 𝟐𝒚𝟐 ]
𝟎 𝟏 + 𝒙𝟐 𝟑
𝟏
f(x) = , h=0.25
𝟏+𝒙𝟐
𝟏 𝒅𝒙 𝟎.𝟐𝟓
𝑰 = ∫𝟎 = [(𝟏 + 𝟎. 𝟓) + 𝟒(𝟎. 𝟗𝟒𝟏𝟐 + 𝟎. 𝟔𝟒) + 𝟐 × 𝟎. 𝟖]
𝟏+𝒙𝟐 𝟑
= 0.7854
CLASSWORK
1. Given that
x 4.0 4.2 4.4 4.6 4.8 5.0 5.2
lo 1.3863 1.4351 1.4816 1.5261 1.5686 1.6094 1.6487
gx
𝟓.𝟐
Evaluate ∫𝟒 𝒍𝒐𝒈 𝒙 𝒅𝒙 by (i) Trapezoidal Rule (ii) Simpson’s
𝟏
Rule ANSWERS: (i) 1.82766 (ii)1.82785
𝟑
𝟒
2. Evaluate ∫𝟎 𝒆𝒙 𝒃𝒚 𝑺𝒊𝒎𝒑𝒔𝒐𝒏′ 𝒔𝑹𝒖𝒍𝒆 𝒈𝒊𝒗𝒆𝒏 𝒕𝒉𝒂𝒕 𝒆 =
𝟐. 𝟕𝟐, 𝒆𝟐 = 𝟕. 𝟑𝟗, 𝒆𝟑 = 𝟐𝟎. 𝟎𝟗, 𝒆𝟒 = 𝟓𝟒. 𝟔
ANSWER:53.87
3. A curve is drawn to pass through the points given by the
following table:
x 1 1.5 2 2.5 3.0 3.5 4.0
y 2 2.4 2.7 2.8 3 2.6 2.1
Estimate the area bounded by the curve, x-axis and the line x=1
and x=4.
𝒌𝟏 = 𝒉𝒇(𝒙𝟎 , 𝒚𝟎 )
𝒉 𝒌𝟏
𝒌𝟐 = 𝒉𝒇(𝒙𝟎 + , 𝒚𝟎 + )
𝟐 𝟐
𝒉 𝒌𝟐
𝒌𝟑 = 𝒉𝒇(𝒙𝟎 + , 𝒚𝟎 + )
𝟐 𝟐
𝒌𝟒 = 𝒉𝒇(𝒙𝟎 + 𝒉, 𝒚𝟎 + 𝒌𝟑 )
𝟏
𝒌 = (𝒌𝟏 + 𝟐𝒌𝟐 + 𝟐𝒌𝟑 + 𝒌𝟒 )
𝟔
𝒅𝒚
Example1. Solve the differential equation = 𝒙𝒚 𝒘𝒊𝒕𝒉 𝒚(𝟏) =
𝒅𝒙
𝟓 𝒇𝒐𝒓 𝒙 = 𝟏. 𝟏 𝒈𝒊𝒗𝒆𝒏 𝒕𝒉𝒂𝒕 𝒉 = 𝟎. 𝟏
Sol.
F(x,y)= xy
𝒙𝟎 = 𝟏, 𝒚𝟎 = 𝟓, 𝒉 = 𝟎. 𝟏
𝒌𝟏 = 𝒉 × 𝒇(𝒙𝟎 , 𝒚𝟎 ) = 𝟎. 𝟏 × 𝟓 = 𝟎. 𝟓
𝒉 𝒌𝟏
𝒌𝟐 = 𝒉 × 𝒇 (𝒙𝟎 + , 𝒚𝟎 + ) = 𝟎. 𝟏 × 𝒇(𝟏. 𝟎𝟓, 𝟐. 𝟕𝟓)
𝟐 𝟐
=0.1× 𝟏. 𝟎𝟓 × 𝟐. 𝟕𝟓 = 𝟎. 𝟐𝟖𝟖𝟕
𝒉 𝒌
𝒌𝟑 = 𝒉 × 𝒇(𝒙𝟎 + , 𝒚𝟎 + 𝟐) = 𝟎. 𝟏 × 𝒇(𝟏. 𝟎𝟓, 𝟐. 𝟔𝟒𝟒𝟑)
𝟐 𝟐
=0.1× 𝟏. 𝟎𝟓 × 𝟐. 𝟔𝟒𝟒𝟑=0.27765
𝒌𝟒 = 𝒉 × 𝒇(𝒙𝟎 + 𝒉, 𝒚𝟎 + 𝒌𝟑 ) = 𝟎. 𝟏 × 𝒇(𝟏. 𝟏, 𝟓. 𝟐𝟕𝟕𝟔𝟓)
= 𝟎. 𝟏 × 𝟏. 𝟎𝟓 × 𝟐. 𝟔𝟒𝟒𝟑 = 𝟎. 𝟐𝟕𝟕𝟔𝟓 = 𝟎. 𝟓𝟖𝟎𝟓𝟒
𝟏
𝒌 = (𝒌𝟏 + 𝟐𝒌𝟐 + 𝟐𝒌𝟑 + 𝒌𝟒 )
𝟔
𝟏
= (𝟎. 𝟓 + 𝟐 × 𝟎. 𝟐𝟖𝟖𝟕 + 𝟐 × 𝟎. 𝟐𝟕𝟕𝟔𝟓 + 𝟎. 𝟓𝟖𝟎𝟓𝟒)
𝟔
=0.3688
𝒚𝟏 = 𝒚𝟎 + 𝒌 = 𝟓 + 𝟎. 𝟑𝟔𝟖𝟖 = 𝟓. 𝟑𝟔𝟖𝟖
𝒚𝟏 (𝟏. 𝟏) = 𝟓. 𝟑𝟔𝟖𝟖