Numerical Integration 2018

You might also like

You are on page 1of 24

Numerical Integration

(a) Exact Integration (b) Approximate Integration


Newton-Kotes Formulas
When the function to be integrated is known at
equally spaced points, the Newton forward-
difference polynomial can be fit to the discrete data
with much less effort, thus significantly decreasing
the amount of effort required. The resulting
formulas are called Newton-Cotes formulas.
The Trapezoid Rule
The trapezoid rule for a single interval is obtained by fitting a first-
degree polynomial to two discrete points. The upper limit of
integration x corresponds to s = 1. Thus, Eq. gives

Newton-Cotes Formulas
(degree of the interpolating polynomial = n)
n Formula
0 Rectangle rule
1 Trapezoid rule
2 Simpson’1s /3 rule
3 Simpson’3s /8 rule
The limits of integration, x = a and x = b, are expressed in terms of
the interpolating parameter s by choosing x = a as the base point of
the polynomial, so that x = a corresponds to s = 0 and x = b
corresponds to s = s. Introducing these results into Eq. yields
𝒉
𝑰= [ 𝒇𝒐 + 𝒇𝒏 + 𝟐(𝒇𝟏 + 𝒇𝟐 + ⋯ … . 𝒇𝒏−𝟏 )]
𝟐
Example
5.2
Calculate the value of 4
𝑙𝑛𝑥 𝑑𝑥
By (i) Trapezoidal rule
Answer:
here, a= 4, b= 5.2, let us divide the interval into 6 equal
parts, h= (5.2-4)/6= 0.2

x 4 4.2 4.4 4.6 4.8 5 5.2


lnx 1.38629 1.43508 1.48160 1.52606 1.56862 1.60944 1.64866
Trapezoidal Rule
x 4 4.2 4.4 4.6 4.8 5 5.2
lnx 1.38629 1.43508 1.48160 1.52606 1.56862 1.60944 1.64866
𝒉
𝑰= 𝒇𝒐 + 𝒇𝒏 + 𝟐 𝒇𝟏 + 𝒇𝟐 + ⋯ … . 𝒇𝒏−𝟏
𝟐
0.2 1.43508 + 1.48160 + 1.52606 + 1.56862 + 1.60944
= 1.38629 + 1.64866 + 2
2

=1.82766
Romberg Integration
From error analysis for the trapezoidal rule, we have

(1)
Romberg Integration

(2)

(1)
(2)

(3)

(3)
Romberg Integration

(4)

(5)

(3)
(5)
Example: Romberg Integration
Example: Romberg Integration
Adaptive Quadrature
Thank you
8
−2
= ℎ 2𝑓𝑜 + 2∆𝑓𝑜 + 3 ∆2 𝑓𝑜
2
1
= ℎ 2𝑓𝑜 + 2(𝑓1 − 𝑓𝑜 ) + (𝑓𝑜 − 2𝑓1 + 𝑓2 )
3
1
= ℎ 2𝑓𝑜 + 4𝑓1 + 𝑓2
3
𝒉
𝑰= [ 𝒇𝒐 + 𝒇𝒏 + 𝟒 𝒇𝟏 + 𝒇𝟑 + 𝒇𝟓 + ⋯ . . 𝒇𝒏−𝟏 + 𝟐(𝒇𝟐 + 𝒇𝟒 + 𝒇𝟔 + ⋯ … . 𝒇𝒏−𝟐 )]
𝟑
9 27 9 ∆2 𝑓𝑜 81 ∆3 𝑓𝑜
= ℎ 3𝑓𝑜 + 𝑓𝑜 + − + ( − 27 + 9)
2 3 2 2! 4 3!

9 9 3
= ℎ 3𝑓𝑜 + (𝑓1 − 𝑓𝑜 ) + 𝑓2 − 2𝑓1 + 𝑓𝑜 + (𝑓3 − 3𝑓2 + 3𝑓1 − 𝑓𝑜 )
2 4 8

𝟑𝒉
𝑰= [ 𝒇𝒐 + 𝟑𝒇𝟏 + 𝟑𝒇𝟐 + 𝟐𝒇𝟑 + 𝟑𝒇𝟒 + 𝟑𝒇𝟓 + 𝟐𝒇𝟔 + ⋯ . . 𝟐𝒇𝒏−𝟑 + 𝟑𝒇𝒏−𝟐 + 𝟑𝒇𝒏−𝟏 + 𝒇𝒏 ]
𝟖
Simpson’s 1/3 Rule
x 4 4.2 4.4 4.6 4.8 5 5.2
lnx 1.38629 1.43508 1.48160 1.52606 1.56862 1.60944 1.64866

𝒉
𝑰 = [ 𝒇𝒐 + 𝒇𝒏 + 𝟒 𝒇𝟏 + 𝒇𝟑 + 𝒇𝟓 + ⋯ . . 𝒇𝒏−𝟏 + 𝟐(𝒇𝟐 + 𝒇𝟒 + 𝒇𝟔 + ⋯ … . 𝒇𝒏−𝟐 )]
𝟑

0.2 1.43508 + 1.52606 + 1.60944


= 1.38629 + 1.64866 + 4 + 2(1.48160 + 1.56862
3

=1.82785

You might also like