Numerical Integration II
Outline
• Introduction
• Newton-Cotes Formulas
• Simpson’s 1/3 Rule
• Simpson’s 3/8 Rule
• Boole’s Rule
Introduction
• Let the area under the curve (integral)
of ๐(๐ฅ) from ๐ฅ = ๐ to ๐ฅ = ๐ be the ๐ผ.
๐
๐ผ = เถฑ ๐ ๐ฅ ๐๐ฅ
๐
• We can try to integrate ๐(๐ฅ) using our
knowledge from integral calculus,
provided that its antiderivative is an
elementary function.
Introduction
• Some examples of nonelementary integrals:
2
3
เถฑ ๐ ๐ฅ ๐๐ฅ
เถฑ
1 − ๐ฅ 3 ๐๐ฅ
เถฑ ln(1 + ๐ ๐ฅ ) ๐๐ฅ
1
๐ฅ
เถฑ ๐ ๐๐ฅ
เถฑ 1 + ln ๐ฅ ๐๐ฅ
เถฑ ln(sin ๐ฅ) ๐๐ฅ
๐๐ฅ
เถฑ ๐๐ฅ
๐ฅ
เถฑ
2๐ฅ 3 + ๐ฅ๐๐ฅ
๐ฅ
๐๐ฅ
1 + ๐๐ฅ
เถฑ cos ๐ฅ ๐๐ฅ
เถฑ sin ๐ฅ 2 ๐๐ฅ
เถฑ ๐ ๐ฅ ln ๐ฅ ๐๐ฅ
เถฑ ๐ฅ sin ๐ฅ ๐๐ฅ
เถฑ cos
เถฑ
1
เถฑ
๐๐ฅ
ln ๐ฅ
1
๐๐ฅ
๐ฅ
Introduction
• Sometimes we also have discrete data
points instead of a continuous
function ๐(๐ฅ).
• We can use curve fitting first and then
do the integration using concepts from
integral calculus, provided that an
elementary form exists
Introduction
• We can use the following numerical integration schemes:
• Newton-Cotes Formulas – sampling points are usually spaced equally in the
domain
• Rectangle/Midpoint Rule
• Trapezoidal Rule
• Simpson’s 1/3 Rule
• Simpson’s 3/8 Rule
• Boole’s Rule
• Gaussian Quadrature – sampling points are not spaced equally in the domain
Newton-Cotes Formulas
• Newton-Cotes Formulas are based
on replacing a complicated function
or tabulated data by some
approximating function that can be
integrated easily.
• Also usually used when the sampling
points are spaced equally in the
domain.
• Use of a series of piecewise
polynomials can also be employed to
improve accuracy.
Newton-Cotes Formulas
๐
๐
๐ผ = เถฑ ๐ ๐ฅ ๐๐ฅ ≈ เถฑ ๐๐ ๐ฅ ๐๐ฅ
๐
๐
2
= ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ + โฏ + ๐๐−1 ๐ฅ ๐−1 + ๐๐ ๐ฅ ๐
๐๐ ๐ฅ
• The following are the Newton-Cotes Formulas that we will discuss:
• Rectangle Rule
• Midpoint Rule
• Trapezoidal Rule
• Simpson’s 1/3 Rule
• Simpson’s 3/8 Rule
• Boole’s Rule
Simpson’s 1/3 Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of
degree two (quadratic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2
• Forms an area of:
โ
๐ด = ๐ ๐ฅ๐−1 + 4๐(๐ฅ๐ ) + ๐ ๐ฅ๐+1
3
• Can only be used if the number of segments is
even.
• Since we start from ๐ฅ0 and end at ๐ฅ๐ , ๐ is also even
• Implies the number of points is ๐ + ๐ which is odd
Simpson’s 1/3 Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of degree
two (quadratic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2
• Integral of the function ๐(๐ฅ) can be approximated by the
sum of the area:
๐
๐ผ เถฑ ๐ ๐ฅ ๐๐ฅ
๐
โ
≈ ๐ ๐ฅ0 + 4๐ ๐ฅ1 + ๐ ๐ฅ2
3
โ
+ ๐ ๐ฅ2 + 4๐ ๐ฅ3 + ๐ ๐ฅ4 + โฏ
3
โ
+ [๐ ๐ฅ๐−2 + 4๐ ๐ฅ๐−1 + ๐ ๐ฅ๐ ]
3
Simpson’s 1/3 Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of degree two
(quadratic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2
• Integral of the function ๐(๐ฅ) can be approximated by the sum of the
area:
๐/2
๐
โ
๐ผ เถฑ ๐ ๐ฅ ๐๐ฅ ≈ เท ๐ ๐ฅ2๐−2 + 4๐(๐ฅ2๐−1 ) + ๐ ๐ฅ2๐
3
๐
๐=1
• Or more simply
๐
๐ฐ เถฑ ๐ ๐ ๐
๐
๐
๐−๐
๐−๐
๐=๐,๐,๐
๐=๐,๐,๐
๐
≈ ๐ ๐๐ + ๐ เท ๐ ๐๐ + ๐ เท ๐ ๐๐ + ๐ ๐๐
๐
Simpson’s 3/8 Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of
degree three (cubic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2 + ๐3 ๐ฅ 3
• Forms an area of:
3โ
๐ด=
๐ ๐ฅ๐−1 + 3๐ ๐ฅ๐ + 3๐ ๐ฅ๐+1 + ๐(๐ฅ๐+2 )
8
• Can only be used if ๐ is a multiple of three.
• Number of points is ๐ + ๐
Simpson’s 3/8 Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of degree
three (cubic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2 + ๐3 ๐ฅ 3
• Integral of the function ๐(๐ฅ) can be approximated by the
sum of the area:
๐
๐ผ เถฑ ๐ ๐ฅ ๐๐ฅ
๐
3โ
≈
๐ ๐ฅ0 + 3๐ ๐ฅ1 + 3๐ ๐ฅ2 + ๐(๐ฅ3 )
8
3โ
+
๐ ๐ฅ3 + 3๐ ๐ฅ4 + 3๐ ๐ฅ5 + ๐(๐ฅ6 ) + โฏ
8
3โ
+
๐ ๐ฅ๐−3 + 3๐ ๐ฅ๐−2 + 3๐ ๐ฅ๐−1 + ๐(๐ฅ๐ )
8
Simpson’s 3/8 Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of degree
three (cubic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2 + ๐3 ๐ฅ 3
• Integral of the function ๐(๐ฅ) can be approximated by the
sum of the area:
๐
๐ผ เถฑ ๐ ๐ฅ ๐๐ฅ
๐
๐/3
3โ
≈
เท ๐ ๐ฅ3๐−3 + 3๐(๐ฅ3๐−2 ) + 3๐(๐ฅ3๐−1 ) + ๐ ๐ฅ3๐
8
๐=1
Boole’s Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of
degree four (quartic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2 + ๐3 ๐ฅ 3 + ๐๐ฅ 4
• Forms an area of:
๐ด
2โ
[7๐ ๐ฅ๐−2 + 32๐ ๐ฅ๐−1 + 12๐ ๐ฅ๐
=
45
+ 32๐ ๐ฅ๐+1 + 7๐(๐ฅ๐+2 )]
• Can only be used if ๐ is a multiple of four.
• Number of points is ๐ + ๐
Boole’s Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of degree
four (quartic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2 + ๐3 ๐ฅ 3 + ๐๐ฅ 4
• Integral of the function ๐(๐ฅ) can be approximated by the
sum of the area:
๐
๐ผ เถฑ ๐ ๐ฅ ๐๐ฅ
๐
2โ
≈
7๐ ๐ฅ0 + 32๐ ๐ฅ1 + 12๐ ๐ฅ2 + 32๐ ๐ฅ3 + 7๐(๐ฅ4 )
45
2โ
+
7๐ ๐ฅ4 + 32๐ ๐ฅ5 + 12๐ ๐ฅ6 + 32๐ ๐ฅ7 + 7๐(๐ฅ8 ) + โฏ
45
2โ
+
7๐ ๐ฅ๐−4 + 32๐ ๐ฅ๐−3 + 12๐ ๐ฅ๐−2 + 32๐ ๐ฅ๐−1 + 7๐(๐ฅ๐ )
45
Boole’s Rule
• Uses a series of approximating functions ๐๐ (๐ฅ) of degree
four (quartic)
๐0 ๐ฅ = ๐0 + ๐1 ๐ฅ + ๐2 ๐ฅ 2 + ๐3 ๐ฅ 3 + ๐๐ฅ 4
• Integral of the function ๐(๐ฅ) can be approximated by the
sum of the area:
๐
๐ผ เถฑ ๐ ๐ฅ ๐๐ฅ
๐
๐/4
2โ
≈
แเทเตฃ7๐ ๐ฅ4๐−4 + 32๐ ๐ฅ4๐−3 + 12๐ ๐ฅ4๐−2
45
๐=1
+ 32๐ ๐ฅ4๐−1 + 7๐(๐ฅ4๐ )เตงแ
Any questions?