You are on page 1of 61

EEP312

NUMERICAL METHODS
AND ANALYSIS
CHAPTER 6
NUMERICAL INTEGRATION
6.1 The Definite Integral
6.2 Trapezoidal Rule
6.3 The Composite Trapezoidal Rule
6.4 The Error Analysis
6.5 Simpson’s Rule
6.5.1 Simpson’s 1/3 Rule
6.5.2 Composites Simpson’s 1/3 Rule
6.5.3 Simpson’s 3/8 Rule
NUMERICAL INTEGRATION

•Its main objective is to measure


the approximate value of the
integrals that are difficult to
evaluate using the available
integration techniques.
6.1 THE DEFINITE INTEGRAL
• Definite integration represents the process of finding the area under a curve
from one point to another which is represented by
𝑏

න 𝑓 𝑥 𝑑𝑥
𝑎
Where ‫׬‬ integral sign
a and b lower and upper limits of integration
f integrand of the integral
x variable of integration
If F(x) represents the integral of f(x), then
𝑏

න 𝑓 𝑥 𝑑𝑥 = 𝐹 𝑏 − 𝐹(𝑎)
𝑎
6.1 THE DEFINITE INTEGRAL
Let f be defined on the closed interval [a,b], and let Δ be an
arbitrary partition P of [a,b]. If this P is finite ordered collection of
nodes x, then
𝑎 = 𝑥0 < 𝑥1 < 𝑥2 < ⋯ < 𝑥𝑛1 < 𝑥𝑛 = 𝑏
Where ∆𝑥𝑖 is the length of the ith subinterval.
If ci is any point in the ith
𝑛
subinterval [xi,xi+1], then the sum
෍ 𝑓 𝑐𝑖 ∆𝑥𝑖 , 𝑥𝑖−1 ≤ 𝑐𝑖 ≤ 𝑥𝑖
𝑖=1
is called a Riemann sum of the function f for the partition Δ on the
interval [a,b]. For a given partition Δ, the length of the longest
subinterval is called the norm of the partition. It is denoted by ∆
(the norm of Δ).
6.1 THE DEFINITE INTEGRAL
The following limit is used to𝑛define the definite integral:
lim ෍ 𝑓 𝑐𝑖 ∆𝑥𝑖 = 𝐼
∆ →0
𝑖=1
This limit exists if and only if for any positive number ε, there
exists a positive number δ such that for every partition Δ of
[a,b] with ∆ < 𝛿, it follows𝑛 that
𝐼 − ෍ 𝑓 𝑐𝑖 ∆𝑥𝑖 < 𝜀
𝑖=1
For any choice of ci in the ith subinterval of Δ.
6.1 THE DEFINITE INTEGRAL
The following limit is used to define
𝑛
the definite integral:
lim ෍ 𝑓 𝑐𝑖 ∆𝑥𝑖 = 𝐼
∆ →0
𝑖=1
This limit exists if and only if for any positive number ε, there exists a
positive number δ such that for every partition Δ of [a,b] with
∆ < 𝛿, it follows that 𝑛

𝐼 − ෍ 𝑓 𝑐𝑖 ∆𝑥𝑖 < 𝜀
𝑖=1
For any choice of ci in the ith subinterval of Δ.
If the limit of a Riemann sum of f exists, then the function f is said to
be integrable over [a,b] and the Riemann sum of f on [a,b]
approaches the number I.
6.1 THE DEFINITE INTEGRAL
The above concepts follow that the upper and lower bounds
for any subinterval [xi,xi+1] is
𝑚𝑖 = inf{𝑓(𝑥)/𝑥𝑖 ≤ 𝑥 ≤ 𝑥𝑖+1
𝑀𝑖 = sup{𝑓(𝑥)/𝑥𝑖 ≤ 𝑥 ≤ 𝑥𝑖+1
Then, this follows that for any function f and partition P, the
upper and lower sums are
𝑛−1

𝐿 𝑓, 𝑃 = ෍ 𝑚𝑖 (𝑥𝑖+1 − 𝑥𝑖 )
𝑖=0
𝑛−1

𝑈 𝑓, 𝑃 = ෍ 𝑀𝑖 (𝑥𝑖+1 − 𝑥𝑖 )
𝑖=0
6.1 THE DEFINITE INTEGRAL

By observation, the following conclusions were drawn:


(1) 𝐿 𝑓, 𝑃 ≤ 𝑈 𝑓, 𝑃
(2) When the interval of P decreases, the L(f,P) increases and
U(f,P) decreases.
6.1 THE DEFINITE INTEGRAL
Using those concepts, we can also conclude that a function f is integrable over [a,b] if
sup 𝐿 𝑓, 𝑃 = inf 𝑈 𝑓, 𝑃
𝑃 𝑃

Where the supremum and infimum are over all partitions of [a,b]. In addition, if f is
integrable then
𝑏

න 𝑓 𝑥 𝑑𝑥 = inf 𝑈 𝑓, 𝑃
𝑃
𝑎

To approximate the integral of f in a closed interval [a,b], it is simply identified as the


mean or average of the lower and upper sums of the given function. That is,
𝑏
𝐿 𝑓, 𝑃 + 𝑈(𝑓, 𝑃)
න 𝑓 𝑥 𝑑𝑥 ≈
2
𝑎
6.1 THE DEFINITE INTEGRAL
Example: Find the area of the region between the curve 𝑦 =
2 𝑥 and the x-axis on the interval [1,4]. Use Riemann’s sum
with four partitions.
Solution:
Determine the ∆𝑥 over [1,4] for h=4, that is,
4−1
∆𝑥 = = 0.75
4
This implies that the partitions are 𝑥0 = 1, 𝑥1 = 1.75, 𝑥2 = 2.5, 𝑥3 =
3.25, 𝑥4 = 4.
6.1 THE DEFINITE INTEGRAL
Choosing ci’s to be the right hand endpoint of its subinterval gives
𝑐1 = 𝑥1 = 1.75, 𝑐2 = 𝑥2 = 2.5, 𝑐3 = 𝑥3 = 3.25, 𝑐4 = 𝑥4 = 4
The rectangles defined by these choices have the following areas:
𝑓 𝑐1 ∆𝑥 = 𝑓(1.75) × (0.75) ≈ 1.9843
𝑓 𝑐2 ∆𝑥 = 𝑓(2.5) × (0.75) ≈ 2.3717
𝑓 𝑐3 ∆𝑥 = 𝑓(3.25) × (0.75) ≈ 2.7042
𝑓 𝑐4 ∆𝑥 = 𝑓(4) × (0.75) ≈ 3
Summing the result gives the approximate integral of f(x). That is,
4 4

න 𝑓 𝑥 𝑑𝑥 ≈ ෍ 𝑓(𝑐𝑖 )∆𝑥 ≈ 1.9843 + 2.3717 + 2.7042 + 3.0 ≈ 10.0602


1 𝑖=1

The exact value is 9.3333. Thus, there is an error of approximately 0.7269.


6.1 THE DEFINITE INTEGRAL
Example: What are the numerical values of the upper and
lower sums for 𝑦 = 2 𝑥 on the interval [1,4] with the partitions
𝑃 = {1,1.75,2.5,3.25,4}?
Solution:
Using the formula, 𝐿 𝑓, 𝑃 = σ𝑛−1
𝑖=0 𝑚𝑖 (𝑥𝑖+1 − 𝑥𝑖 ) and 𝑈 𝑓, 𝑃 =
σ𝑛−1
𝑖=0 𝑀𝑖 (𝑥𝑖+1 − 𝑥𝑖 )
𝑚0 = 2, 𝑚1 ≈ 2.6458, 𝑚2 ≈ 3.1623, 𝑚3 ≈ 3.6056 while
𝑀0 ≈ 2.6458, 𝑀1 ≈ 3.1623, 𝑀2 ≈ 3.6056, 𝑀3 = 4 such that the
4−1
width of the interval in both cases is ∆𝑥 = 4 = 0.75.
6.1 THE DEFINITE INTEGRAL
Now,
𝑛−1

𝐿 𝑓, 𝑃 = ෍ 𝑚𝑖 (𝑥𝑖+1 − 𝑥𝑖 ) ≈ (0.75)(2 + 2.6458 + 3.1623 + 3.6056) ≈ 8.5603


𝑖=0
𝑛−1

𝑈 𝑓, 𝑃 = ෍ 𝑀𝑖 (𝑥𝑖+1 − 𝑥𝑖 ) ≈ (0.75)(2.6458 + 3.1623 + 3.6056 + 4) ≈ 10.0603


𝑖=0
Taking the average of the lower and upper sum as the best estimates
and subtracting to the exact integral, we get the error
8.5603 + 10.0603
𝐸𝑟𝑟𝑜𝑟 ≈ − 9.3333 = −0.023
2
6.1 THE DEFINITE INTEGRAL
Example: Show if the following functions are Riemann-integrable
at a given interval: a) The Dirichlet Function for any P of [a,b], b)
The Heaviside Function
Solution: a) the Dirichlet Function is defined as
0, 𝑖𝑓 𝑥 𝑖𝑠 𝑟𝑎𝑡𝑖𝑜𝑛𝑎𝑙
𝑓 𝑥 =ቊ
1, 𝑖𝑓 𝑥 𝑖𝑠 𝑖𝑟𝑟𝑎𝑡𝑖𝑜𝑛𝑎𝑙
For any partition P of the closed interval [a,b], the value of
L(f,P)=0. On the other hand, the value of U(f,P)=1. This implies that
the sup 𝐿 𝑓, 𝑃 ≠ inf 𝑈 𝑓, 𝑃 . Therefore, this is not a Riemann-
𝑃 𝑃
integrable.
6.1 THE DEFINITE INTEGRAL
Example: Show if the following functions are Riemann-integrable
at a given interval: a) The Dirichlet Function for any P of [a,b], b)
The Heaviside Function
Solution: b) the Heaviside Function is defined as
0, 𝑥<0
𝑓 𝑥 =ቊ
1, 𝑥≥0
The function is not continuous on any interval containing 0, but it is
Riemann-integrable on every closed bounded interval, because
every continuous function on a closed bounded interval of the
real line is Riemann integrable.
6.2 TRAPEZOIDAL RULE

•Trapezoidal Rule is based


on the estimation of area
beneath a curve using
trapezoids.
6.2 TRAPEZOIDAL RULE

• Using the lower and upper limit of integration in the form of [a,b] by
dividing it into subintervals to create a partition 𝑃 = {𝑎 = 𝑥0 < 𝑥1 < 𝑥2 <
⋯ < 𝑥𝑛−1 < 𝑥𝑛 = 𝑏}. First, consider that a=x0 and b=xn.
• By observation,
𝑏
𝑓 𝑎 + 𝑓(𝑏)
න 𝑓 𝑥 𝑑𝑥 ≈ (𝑏 − 𝑎)
2
𝑎
6.2 TRAPEZOIDAL RULE
•Trapezoidal Rule methods:
•Using Geometry
•Using Calculus
•Using Newton’s Divided Difference
•Using the Methods of Coefficient
6.2 TRAPEZOIDAL RULE
• Using Geometry
The area under the curve f(x) is the area of a trapezoid. The integral
𝑏

න 𝑓 𝑥 𝑑𝑥 ≈ 𝐴𝑟𝑒𝑎 𝑜𝑓 𝑡𝑟𝑎𝑝𝑒𝑧𝑜𝑖𝑑
𝑎
𝑏
1
න 𝑓 𝑥 𝑑𝑥 ≈ (𝑏1 + 𝑏2 )(ℎ)
2
𝑎

Such that b1+b2 is the sum of length of parallel sides, and h is a perpendicular distance between parallel sides
𝑏
1
න 𝑓 𝑥 𝑑𝑥 ≈ (𝑓(𝑏) + 𝑓(𝑎))(𝑏 − 𝑎)
2
𝑎

Now, the approximate integral of f(x) is


𝑏
𝑓 𝑎 + 𝑓(𝑏)
න 𝑓 𝑥 𝑑𝑥 ≈ (𝑏 − 𝑎)
2
𝑎
6.2 TRAPEZOIDAL RULE
• Using Calculus
Suppose 𝑓 𝑥 = 𝑎0 + 𝑎1 𝑥 (a linear form). Then
𝑏 𝑏

න 𝑓 𝑥 𝑑𝑥 = න 𝑎0 + 𝑎1 𝑥 𝑑𝑥
𝑎 𝑎
𝑏
𝑏2 − 𝑎 2
න 𝑓 𝑥 𝑑𝑥 = 𝑎0 𝑏 − 𝑎 + 𝑎1
2
𝑎

To define the a0 and a1, let us consider two points (a,f(a)) and (b,f(b)) to approximate f(x) by a straight line from a
to b. That is,
𝑓 𝑎 = 𝑎0 + 𝑎1 𝑎
𝑓 𝑏 = 𝑎0 + 𝑎1 𝑏
Solving to get a1 and a0, we get
𝑓 𝑏 − 𝑓(𝑎)
𝑎1 =
𝑏−𝑎
𝑓 𝑎 𝑏−𝑓 𝑏 𝑎
𝑎0 =
𝑏−𝑎
6.2 TRAPEZOIDAL RULE
• Using Calculus
Substituting the results gives
𝑏
𝑓 𝑎 𝑏−𝑓 𝑏 𝑎 𝑓 𝑏 − 𝑓(𝑎) 𝑏 2 − 𝑎 2
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑏−𝑎 +
𝑏−𝑎 𝑏−𝑎 2
𝑎
Simplifying the result, we get the approximate integral
𝑏
𝑓 𝑎 − 𝑓(𝑏)
න 𝑓 𝑥 𝑑𝑥 ≈ (𝑏 − 𝑎)
2
𝑎
6.2 TRAPEZOIDAL RULE
• Using Newton’s Divided Difference
Suppose f(x) can be approximated using Newton’s divided difference polynomial as
𝑓 𝑏 −𝑓 𝑎
𝑓 𝑥 =𝑓 𝑎 + 𝑥−𝑎
𝑏−𝑎
Therefore,
𝑏 𝑏
𝑓 𝑏 −𝑓 𝑎 𝑓 𝑏 −𝑓 𝑎 𝑥2 𝑏
න 𝑓 𝑥 𝑑𝑥 = න 𝑓 𝑎 + (𝑥 − 𝑎) 𝑑𝑥 = 𝑓 𝑎 𝑥 + − 𝑎𝑥
𝑏−𝑎 𝑏 −𝑎 2 𝑎
𝑎 𝑎

𝑓 𝑏 −𝑓 𝑎 𝑏2 𝑎2 𝑓 𝑏 −𝑓 𝑎 𝑏2 𝑎2
= 𝑓 𝑎 𝑏−𝑓 𝑎 𝑎+ − 𝑎𝑏 − + 𝑎2 = 𝑓 𝑎 𝑏 − 𝑓 𝑎 𝑎 + − 𝑎𝑏 +
𝑏−𝑎 2 2 𝑏−𝑎 2 2
𝑓 𝑏 −𝑓 𝑎 1 2
1
= 𝑓 𝑎 𝑏−𝑓 𝑎 𝑎+ 𝑏−𝑎 = 𝑓 𝑎 𝑏−𝑓 𝑎 𝑎+ 𝑓 𝑏 −𝑓 𝑎 𝑏−𝑎
𝑏−𝑎 2 2
1 1 1 1 1 1 1 1 𝑓 𝑎 + 𝑓(𝑏)
= 𝑓 𝑎 𝑏 − 𝑓 𝑎 𝑎 + 𝑓 𝑏 𝑏 − 𝑓 𝑏 𝑎 − 𝑓 𝑎 𝑏 + 𝑓 𝑎 𝑎 = 𝑓 𝑎 𝑏 − 𝑓 𝑎 𝑎 + 𝑓 𝑏 𝑏 ± 𝑓 𝑏 𝑎 ≈ (𝑏 − 𝑎)
2 2 2 2 2 2 2 2 2
6.2 TRAPEZOIDAL RULE
• Using the Methods of Coefficient
Suppose that
𝑏 𝑏−𝑎 𝑏−𝑎 𝑏
‫≈ 𝑥𝑑 𝑥 𝑓 𝑎׬‬ 2
𝑓 𝑎 + 2
𝑓(𝑏) and ‫𝑐 = 𝑥𝑑 𝑥 𝑓 𝑎׬‬1 𝑓 𝑎 + 𝑐2 𝑓(𝑏)
𝑏
Let the right-hand side be exact for integrals of the form ‫𝑎( 𝑎׬‬0 + 𝑎1 𝑥) 𝑑𝑥.
𝑏 𝑥2 𝑏 𝑏2−𝑎2
So, ‫𝑎( 𝑎׬‬0 + 𝑎1 𝑥) 𝑑𝑥 = 𝑎0 𝑥 + 𝑎1 = 𝑎0 𝑏 − 𝑎 + 𝑎1
2 𝑎 2

Since we are interested in


𝑏

න (𝑎0 + 𝑎1 𝑥) 𝑑𝑥 = 𝑐1 𝑓 𝑎 + 𝑐2 𝑓(𝑏)
𝑎

To have the same result, use 𝑓 𝑥 = 𝑎0 + 𝑎1 𝑥. Now


𝑏 𝑏
‫𝑎( 𝑎׬‬0 + 𝑎1 𝑥) 𝑑𝑥 = 𝑐1 𝑎0 + 𝑎1 𝑎 + 𝑐2 𝑎0 + 𝑎1 𝑏 or ‫𝑎( 𝑎׬‬0 + 𝑎1 𝑥) 𝑑𝑥 = 𝑎0 𝑐1 + 𝑐2 + 𝑎1 𝑐1 𝑎 + 𝑐2 𝑏 .
Therefore,
𝑏2 − 𝑎 2
𝑎0 𝑏 − 𝑎 + 𝑎1 = 𝑎0 𝑐1 + 𝑐2 + 𝑎1 𝑐1 𝑎 + 𝑐2 𝑏
2
6.2 TRAPEZOIDAL RULE
• Using the Methods of Coefficient
Since a0 and a1 are arbitrary for a general straight line,
𝑏 2−𝑎2
𝑐1 + 𝑐2 = 𝑏 − 𝑎 and𝑐1 𝑎 + 𝑐2 𝑏 =
2

Solving simultaneously gives


𝑏−𝑎 𝑏−𝑎
𝑐1 = and 𝑐2 =
2 2

Now
𝑏
𝑏−𝑎 𝑏−𝑎
න 𝑓(𝑥) 𝑑𝑥 ≈ 𝑐1 𝑓 𝑎 + 𝑐2 𝑓 𝑏 = 𝑓 𝑎 + 𝑓(𝑏)
2 2
𝑎

Or simply
𝑏
𝑓 𝑎 + 𝑓(𝑏)
න 𝑓(𝑥) 𝑑𝑥 ≈ (𝑏 − 𝑎)
2
𝑎
6.2 TRAPEZOIDAL RULE
• Example: Find the approximate integral of the curve between 𝑦 = 2 𝑥
and the x-axis on the interval [1,4] using the trapezoidal rule.
• Solution: Using the derived formula,
𝑏
𝑓 𝑎 +𝑓 𝑏 2 4+2 1
න 𝑓(𝑥) 𝑑𝑥 ≈ 𝑏 − 𝑎 = (4 − 1)
2 2
𝑎
4

න 2 𝑥 𝑑𝑥 ≈ 9.0000
1
Thus, the difference from the exact integral is approximately 0.3333.
6.3 THE COMPOSITE TRAPEZOIDAL RULE
• Suppose we are interested in extending the division in order to come up
with the composite trapezoidal rule. First, we need to get the ratio h of the
deviation of upper and lower limit, [a,b] and n that represents the number
of trapezoids exists. Then, the sum of the results obtained in each segment is
the approximate value of integral I. That is,
𝑏−𝑎
ℎ=
𝑛

The integral I can be broken into h integrals. That is,

𝑏 𝑎+ℎ 𝑎+2ℎ 𝑎+ 𝑛−1 ℎ 𝑏


𝐼 = න 𝑓 𝑥 𝑑𝑥 = න 𝑓 𝑥 𝑑𝑥 + න 𝑓 𝑥 𝑑𝑥 + ⋯ + න 𝑓 𝑥 𝑑𝑥 + න 𝑓 𝑥 𝑑𝑥
𝑎 𝑎 𝑎+ℎ 𝑎+ 𝑛−2 ℎ 𝑎+ 𝑛−1 ℎ
6.3 THE COMPOSITE TRAPEZOIDAL RULE
• Applying trapezoidal rule gives
𝑏
න 𝑓 𝑥 𝑑𝑥
𝑎
𝑓 𝑎 +𝑓 𝑎+ℎ 𝑓 𝑎 + ℎ + 𝑓 𝑎 + 2ℎ
≈ 𝑎+ℎ −𝑎 + 𝑎 + 2ℎ − 𝑎 + ℎ +⋯
2 2
𝑓 𝑎+ 𝑛−2 ℎ +𝑓 𝑎+ 𝑛−1 ℎ
+ 𝑎+ 𝑛−1 ℎ − 𝑎+ 𝑛−2 ℎ
2
𝑓 𝑎+ 𝑛−1 ℎ +𝑓 𝑏
+ 𝑏− 𝑎+ 𝑛−1 ℎ
2
𝑓 𝑎 +𝑓 𝑎+ℎ 𝑓 𝑎 + ℎ + 𝑓 𝑎 + 2ℎ 𝑓 𝑎+ 𝑛−2 ℎ +𝑓 𝑎+ 𝑛−1 ℎ
≈ℎ +ℎ + ⋯+ ℎ
2 2 2
𝑓 𝑎+ 𝑛−1 ℎ +𝑓 𝑏 𝑓 𝑎 + 2𝑓 𝑎 + ℎ + 2𝑓 𝑎 + 2ℎ + ⋯ + 2𝑓 𝑎 + 𝑛 − 1 ℎ + 𝑓(𝑏)
+ℎ ≈ℎ
2 2
𝑛−1 𝑛−1
ℎ 𝑏−𝑎
≈ 𝑓 𝑎 + 2 ෍ 𝑓 𝑎 + 𝑖ℎ + 𝑓(𝑏) ≈ 𝑓 𝑎 + 2 ෍ 𝑓 𝑎 + 𝑖ℎ + 𝑓(𝑏)
2 2𝑛
𝑖=1 𝑖=1
6.3 THE COMPOSITE TRAPEZOIDAL RULE
• Similarly, since 𝑎 = 𝑥0 < 𝑥1 < 𝑥2 < ⋯ < 𝑥𝑛−1 < 𝑥𝑛 = 𝑏 with 𝑥𝑖 = 𝑎 + 𝑖ℎ, the
composite trapezoidal rule can be written as
𝑏 𝑛−1
1
න 𝑓 𝑥 𝑑𝑥 ≈ ෍ 𝑥𝑖+1 − 𝑥𝑖 𝑓 𝑥𝑖 + 𝑓(𝑥𝑖+1 )
𝑎 2
𝑖=1
Since each subinterval ℎ = 𝑥𝑖+1 − 𝑥𝑖 ,
𝑏 𝑛−1

න 𝑓 𝑥 𝑑𝑥 ≈ ෍ 𝑓 𝑥𝑖 + 𝑓(𝑥𝑖+1 )
𝑎 2
𝑖=1
Or
𝑏 𝑛−1
𝑓 𝑎 + 𝑓(𝑏)
න 𝑓 𝑥 𝑑𝑥 ≈ ℎ + ෍ 𝑓(𝑥𝑖 )
𝑎 2
𝑖=1
6.3 THE COMPOSITE TRAPEZOIDAL RULE
• Example: Find the approximate integral of the curve between 𝑦 = 2 𝑥 and
the x-axis on the interval [1,4] using composite trapezoidal rule for n=4.
• Solution:
𝑏 𝑛−1
𝑓 𝑎 + 𝑓(𝑏) 4−1 2 1+2 4
න 𝑓 𝑥 𝑑𝑥 ≈ ℎ + ෍ 𝑓(𝑥𝑖 ) ≈ + 2.6456 + 3.1623 + 3.6056
𝑎 2 4 2
𝑖=1
4
න 2 𝑥𝑑𝑥 ≈ 9.3101
1
Thus, the approximate error from the exact integral is 0.0232.
6.3 THE COMPOSITE TRAPEZOIDAL RULE
• Example: Find the approximate integral of 𝑓 𝑥 = cos 3 2𝑥 − 1 on the interval
[0, /2] using composite trapezoidal rule for n=5.
• Solution:
𝑏 𝑛−1
𝑓 𝑎 + 𝑓(𝑏)
න 𝑓 𝑥 𝑑𝑥 ≈ ℎ + ෍ 𝑓(𝑥𝑖 )
𝑎 2
𝑖=1
𝜋
2 − 0 0.9995 + 0.9979
≈ + 0.9999 + 1.0000 + 0.9996 + 0.9999
5 2 𝜋
4
න cos 3 2𝑥 − 1 𝑑𝑥 ≈ 1.5702
0
While the exact integral is 1.5700, which implies that there is an approximately 0.0002 error
based on the exact value.
6.4 THE ERROR ANALYSIS
• Consider the composite trapezoidal rule for the partitions of equal
subintervals. Let p(xi) be the polynomial of degree at most n that interpolates
f(x) at xi, xi+1. Let
𝑥𝑖 +1
𝐼𝑖 = න 𝑓 𝑥 𝑑𝑥
𝑥𝑖
And
𝑝𝑖 𝑥𝑖 + 𝑝𝑖 𝑥𝑖+1 ℎ
𝑇𝑖 = න 𝑝𝑖 𝑥𝑖 =⇔ 𝑥𝑖+1 − 𝑥𝑖 ⇕ = 𝑓 𝑥𝑖 + 𝑓 𝑥𝑖+1
2 2
That is, the composite trapezoidal rule approximates the integral f(x) over
[xi,xi+1] by the integral of pi(x) over the same interval.
6.4 THE ERROR ANALYSIS
• In error in interpolation, for 𝑥 𝜉 ∈ 𝑥𝑖 , 𝑥𝑖+1 , we have
1
𝑓 𝑥 −𝑝 𝑥 = 𝑥 − 𝑥𝑖 𝑥 − 𝑥𝑖+1 𝑓′′(𝜉𝑥 )
2!
For some 𝜉𝑥 ∈ 𝑥𝑖 , 𝑥𝑖+1 . To simplify the notation, call it 𝜉(𝑥) since 𝜉𝑥 depends on
x.
𝑥𝑖 +1 𝑝𝑖 𝑥𝑖 +𝑝𝑖 𝑥𝑖+1
Subtracting 𝐼𝑖 = ‫𝑥׬‬ 𝑓 𝑥 𝑑𝑥 and 𝑇𝑖 = ‫𝑖𝑥 ⇔= 𝑖𝑥 𝑖𝑝 ׬‬+1 − 𝑥𝑖 ⇕ =
𝑖 2

𝑓 𝑥𝑖 + 𝑓 𝑥𝑖+1 gives
2
1
𝐼𝑖 − 𝑇𝑖 = න ⇔ 𝑓 𝑥 − 𝑝 𝑥 ⇕ 𝑑𝑥 = න 𝑥𝑖 − 𝑥𝑖+1 𝑓 ′′ 𝜉 𝑥 𝑑𝑥
2
6.4 THE ERROR ANALYSIS
• Suppose (x-xi)(x-xi+1) is negative on the interval [xi,xi+1] and we assume the
continuity of f’’(x), which implies that 𝑓 ′′ 𝜉 𝑥 is also continuous. Applying the Mean
Value Theorem for Integrals, we have
1
𝐼𝑖 − 𝑇𝑖 = න 𝑥 − 𝑥𝑖 𝑥 − 𝑥𝑖+1 𝑓 ′′ 𝜉 𝑥 𝑑𝑥
2
For some 𝜉𝑖 ∈ 𝑥𝑖 , 𝑥𝑖+1 . Simplifying, the result is
ℎ3
න 𝑥 − 𝑥𝑖 𝑥 − 𝑥𝑖+1 𝑑𝑥 = −
6
That implies that
ℎ3 ′′
𝐼𝑖 − 𝑇𝑖 = − 𝑓 𝜉𝑖
2
For some 𝜉𝑖 ∈ 𝑥𝑖 , 𝑥𝑖+1 .
6.4 THE ERROR ANALYSIS
• Summing up all the errors in each subinterval, we get the total error E of the
composite trapezoidal rule. That is,
𝑛−1 𝑛−1 𝑛−1
3 2
ℎ ′′
(𝑏 − 𝑎)ℎ 1
𝐸 = ෍ (𝐼𝑖 − 𝑇𝑖 ) = − ෍ 𝑓 𝜉𝑖 = − ෍ 𝑓 ′′ 𝜉𝑖
12 12 𝑛
𝑖=0 𝑖=0 𝑖=0
And
(𝑏 − 𝑎)ℎ2 ′′
𝐸=− 𝑓 𝜉𝑖
12
or
(𝑏 − 𝑎)3 ′′
𝐸=− 2 𝑓 𝜉𝑖
12𝑛
Which results in another theorem.
6.4 THE ERROR ANALYSIS
• Error of Composite Trapezoidal Rule
Let f’’(x) be continuous on [a,b] and T be the value of the trapezoidal 𝑏
rule applied to
f(x) on this interval with partition of uniform spacing, h, and let 𝐼 = ‫𝑥𝑑 𝑥 𝑓 𝑎׬‬. Then there
is some 𝜉 ∈ 𝑎, 𝑏 such that
(𝑏 − 𝑎)ℎ2 ′′
𝐼−𝑇=− 𝑓 𝜉
12
And
(𝑏 − 𝑎)ℎ2 ′′
𝐸=− 𝑓 𝜉𝑖
12
or
(𝑏 − 𝑎)3 ′′
𝐸=− 2 𝑓 𝜉𝑖
12𝑛
Which results in another theorem.
6.4 THE ERROR ANALYSIS
• Example: Determine the approximate error of the integral of 𝑓 𝑥 = cos 3 (2𝑥 − 1) on the
interval [0, /2] using the composite trapezoidal rule for n=5.
• Solution: If 𝑓 𝑥 = cos 3 (2𝑥 − 1), then
𝑓 ′ (𝑥) = −6 cos 2 (2𝑥 − 1) sin(2𝑥 − 1)
𝑓 ′′ 𝑥 = −12 cos 3 2𝑥 − 1 + 24 sin2 (2𝑥 − 1) cos(2𝑥 − 1)
Finding the maximum bound of the function on [0, /2] we have
𝑓 ′′ 𝑥 = 12 cos(2𝑥 − 1) cos 2 (2𝑥 − 1) − 2 sin2 (2𝑥 − 1)
≤ 12 cos(2𝑥 − 1) cos 2 2𝑥 − 1 + 2 sin2 (2𝑥 − 1)
𝜋 𝜋
By observation, the cos(2𝑥 − 1) have a maximum value when 𝑥 = 6, that is, cos ቀ2 6 −
1ቁ = 1.0000. Then we have
𝑓 ′′ 𝑥 ≤ 12 1.0 1.0 = 11.998 = 12
Thus, the error of integration is
𝜋 3
𝑏−𝑎 3 −0
𝐸=− ′′
𝑓 𝜉𝑖 ≤ − 2 12 = −0.0459
12𝑛2 12 5 2
If the error is 0.2422, then the integral of 𝑓 𝑥 = cos 3 (2𝑥 − 1) from [0, /2] is 1.5702±0.0459 which is
(1.523,1.6161) and the exact value is 1.5700.
6.4 THE ERROR ANALYSIS
• Example: How much n must be needed to ensure that the error in approximating the
integral of 𝑓 𝑥 = cos 3 (2𝑥 − 1) on the interval [0, /2] is less than 0.0001?
• Solution:
𝜋 3
𝑏 − 𝑎 3 ′′ −0 𝜋3
𝐸=− 𝑓 𝜉𝑖 ≤ − 2 12 = 2
12𝑛 2 12 5 2 8𝑛
𝜋3
• We need to limit that < 0.0001. Thus, the inequality holds for
8𝑛2
3
𝜋
𝑛2 >
8(0.0001)
𝑛 > 196.87
Therefore, the acceptable value of n is greater than or exactly 197 to ensure that error
of approximating the integral of 𝑓 𝑥 = cos 3 (2𝑥 − 1) on the interval [0, /2] is less than
0.0001.
6.5.1 SIMPSON’S 1/3 RULE

•Simpson’s 1/3 Rule


Simpson’s 1/3 rule is an extension of
Trapezoidal rule where the integrand is
approximated by a second order
polynomial. This can be derived by the
following methods:
6.5.1 SIMPSON’S 1/3 RULE
• Using the Algebraic method
Suppose
𝑏 𝑏
𝐼 = න 𝑓 𝑥 𝑑𝑥 ≈ න 𝑓2 𝑥 𝑑𝑥
𝑎 𝑎
Such that
𝑓2 𝑥 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2
And 𝑓2 𝑥 is a second order polynomial.
𝑎+𝑏
Consider 𝑥 = 𝑎, , 𝑏. Now the corresponding values of f(x) are
2
𝑓 𝑎 = 𝑓2 𝑎 = 𝑎0 + 𝑎1 𝑎 + 𝑎2 𝑎2
2
𝑎+𝑏 𝑎+𝑏 𝑎+𝑏 𝑎+𝑏
𝑓 = 𝑓2 = 𝑎0 + 𝑎1 + 𝑎2
2 2 2 2
𝑓 𝑏 = 𝑓2 𝑏 = 𝑎0 + 𝑎1 𝑏 + 𝑎2 𝑏 2
6.5.1 SIMPSON’S 1/3 RULE
• Using the Algebraic method
Solving the previous three equations for unknowns, 𝑎 +𝑎0𝑏, 𝑎1 , 𝑎𝑛𝑑 𝑎2 we 2have
2
𝑎 𝑓 𝑏 + 𝑎𝑏𝑓 𝑏 − 4𝑎𝑏𝑓 + 𝑎𝑏𝑓 𝑎 + 𝑏 𝑓(𝑎)
2
𝑎0 =
𝑎2 − 2𝑎𝑏 + 𝑏2
𝑎+𝑏 𝑎+𝑏
𝑎𝑓 𝑎 − 4𝑎𝑓 + 3𝑎𝑓 𝑏 + 3𝑏𝑓 𝑎 − 4𝑏𝑓 + 𝑏𝑓(𝑏)
2 2
𝑎1 =
𝑎2 − 2𝑎𝑏 + 𝑏2
𝑎+𝑏
2 𝑓 𝑎 − 2𝑓 + 𝑓(𝑏)
2
𝑎2 =
𝑎2 − 2𝑎𝑏 + 𝑏2
Thus
𝑏 𝑏
2
𝑥2 𝑥3 𝑏
𝐼 ≈ න 𝑓2 𝑥 𝑑𝑥 = න 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 𝑑𝑥 = 𝑎0 𝑥 + 𝑎1 + 𝑎2
𝑎 𝑎 2 3 𝑎
2 2 3 3
𝑏 −𝑎 𝑏 −𝑎
= 𝑎0 (𝑏 − 𝑎) + 𝑎1 + 𝑎2
2 3
6.5.1 SIMPSON’S 1/3 RULE
• Using the Algebraic method
Substituting values of 𝑎0 , 𝑎1 , 𝑎𝑛𝑑 𝑎2 gives
𝑏
𝑏−𝑎 𝑎+𝑏
න 𝑓2 𝑥 𝑑𝑥 = 𝑓 𝑎 − 2𝑓 + 𝑓(𝑏)
𝑎 6 2
Since for Simpson’s 1/3 rule, the interval [a,b] is broken into 2
segments, the segment which
𝑏−𝑎
ℎ=
2
Hence the Simpson’s 1/3 rule is given by
𝑏
ℎ 𝑎+𝑏
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑓 𝑎 − 4𝑓 + 𝑓(𝑏)
𝑎 3 2
Because the above form has 1/3 in its formula, it is called Simpson’s
1/3 rule.
6.5.1 SIMPSON’S 1/3 RULE
• Using the Newton’s method
Simpson’s 1/3 rule can also be derived by approximating f(x) by a second
order polynomial using Newton’s divided difference polynomial as
𝑎+𝑏
𝑓2 𝑥 = 𝑏0 + 𝑏1 (𝑥 − 𝑎) + 𝑏2 (𝑥 − 𝑎) 𝑥 −
2
Where 𝑏 = 𝑓(𝑎)
0
𝑎+𝑏
𝑓 −𝑓 𝑎
2
𝑏1 =
𝑎+𝑏
−𝑎
2
𝑎+𝑏 𝑎+𝑏
𝑓 𝑏 −𝑓 𝑓 −𝑓 𝑎
2 2

𝑎+𝑏 𝑎+𝑏
𝑏− −𝑎
𝑏2 = 2 2
𝑏−𝑎
6.5.1 SIMPSON’S 1/3 RULE
• Using the Newton’s method
Integrating Newton’s divided difference polynomial gives
𝑏 𝑏 𝑏
𝑎+𝑏
න 𝑓 𝑥 𝑑𝑥 ≈ න 𝑓2 𝑥 𝑑𝑥 = න 𝑏0 + 𝑏1 𝑥 − 𝑎 + 𝑏2 𝑥 − 𝑎 𝑥 − 𝑑𝑥
𝑎 𝑎2 𝑎 3 2
2
𝑥 𝑥 3𝑎 + 𝑏 𝑥 𝑎 𝑎+𝑏 𝑥 𝑏
= 𝑏0 𝑥 + 𝑏1 − 𝑎𝑥 + 𝑏2 − +
2 3 4 2 𝑎
𝑏 2 − 𝑎2
= 𝑏0 (𝑏 − 𝑎) + 𝑏1 − 𝑎(𝑏 − 𝑎)
2
3 3
𝑏 −𝑎 3𝑎 + 𝑏 (𝑏 2 − 𝑎2 ) 𝑎 𝑎 + 𝑏 (𝑏 − 𝑎)
+ 𝑏2 − +
3 4 2
Substituting values of 𝑏0 , 𝑏1 , and 𝑏2 yields
𝑏
𝑏−𝑎 𝑎+𝑏 ℎ 𝑎+𝑏
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑓 𝑎 − 4𝑓 + 𝑓 𝑏 = 𝑓 𝑎 + 4𝑓 + 𝑓(𝑏)
𝑎 6 2 3 2
6.5.1 SIMPSON’S 1/3 RULE
• Using the Lagrange’s Polynomial Method
We can also derive Simpson’s formula using the Lagrange polynomial by using the three-point
quadratic interpolation. Here, the interpolating function becomes
𝑎+𝑏 𝑎+𝑏
𝑥− 𝑥−𝑏 𝑥−𝑎 𝑥−𝑏 𝑎+𝑏 𝑥 − 𝑎 𝑥 −
2 2
𝑓2 𝑥 = 𝑓 𝑎 + 𝑓 + 𝑓 𝑏
𝑎+𝑏 𝑎+𝑏 𝑎+𝑏 2 𝑎+𝑏
𝑎− 2 𝑎−𝑏 2 −𝑎 2 −𝑏 𝑏−𝑎 𝑏− 2
Integrating gives
𝑏
න 𝑓2 𝑥 𝑑𝑥
𝑎
𝑥3 𝑎 + 3𝑏 𝑥 2 𝑏 𝑎 + 𝑏 𝑥 𝑥3 𝑎 + 𝑏 𝑥2
− + − + 𝑎𝑏𝑥 𝑎+𝑏
=൦ 3 4 2 𝑓 𝑎 + 3 2 𝑓
𝑎+𝑏 𝑎+𝑏 𝑎+𝑏 2
𝑎− 2 𝑎−𝑏 2 − 𝑎 2 − 𝑏
3 2
𝑥 3𝑎 + 𝑏 𝑥 𝑎 𝑎+𝑏 𝑥
− + 𝑏
+ 3 4 2 𝑓 𝑏 ൪
𝑎+𝑏 𝑎
𝑏−𝑎 𝑏−
2
6.5.1 SIMPSON’S 1/3 RULE
• Using the Lagrange’s Polynomial Method
𝑏
න 𝑓 𝑥 𝑑𝑥
𝑎 3
𝑏 − 𝑎3 𝑎 + 3𝑏 (𝑏2 − 𝑎2 ) 𝑏 𝑎 + 𝑏 (𝑏 − 𝑎) 𝑏3 − 𝑎3 𝑎 + 𝑏 (𝑏2 − 𝑎2 )
− + − + 𝑎𝑏(𝑏 − 𝑎) 𝑎 + 𝑏
= 3 4 2 𝑓 𝑎 + 3 2 𝑓
𝑎+𝑏 𝑎+𝑏 𝑎+𝑏 2
𝑎− 𝑎−𝑏 −𝑎 −𝑏
2 2 2
𝑏3 − 𝑎3 3𝑎 + 𝑏 (𝑏2 − 𝑎2 ) 𝑎 𝑎 + 𝑏 (𝑏 − 𝑎)
− +
+ 3 4 2 𝑓 𝑏
𝑎+𝑏
𝑏−𝑎 𝑏−
2
Simplifying and factoring the expression gives
𝑏
𝑏−𝑎 𝑎+𝑏 ℎ 𝑎+𝑏
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑓 𝑎 − 4𝑓 + 𝑓 𝑏 = 𝑓 𝑎 + 4𝑓 +𝑓 𝑏
𝑎 6 2 3 2
6.5.1 SIMPSON’S 1/3 RULE
• Using the Method of Coefficients
Suppose
𝑏
𝑎+𝑏
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑐1 𝑓 𝑎 + 𝑐2 𝑓 + 𝑐3 𝑓 𝑏
𝑎 2
If we consider the right-hand side be an exact expression for the
𝑏 𝑏 𝑏 2
integrals ‫ 𝑎׬‬1𝑑𝑥, ‫𝑥𝑑𝑥 𝑎׬‬, and ‫𝑥𝑑 𝑥 𝑎׬‬, then it implies that the right-
hand side will be exact expressions for integrals of any linear
combination of the three integrals for a general second order
polynomial.
6.5.1 SIMPSON’S 1/3 RULE
• Using the Method of Coefficients
Now 𝑏
න 1𝑑𝑥 = 𝑏 − 𝑎 = 𝑐1 + 𝑐2 + 𝑐3
𝑎
𝑏
𝑏2 − 𝑎2 𝑎+𝑏
න 𝑥𝑑𝑥 = = 𝑐1 𝑎 + 𝑐2 + 𝑐3 𝑏
𝑎 2 2
𝑏 3 − 𝑎3 2
2
𝑏 2
𝑎+𝑏
න 𝑥 𝑑𝑥 = = 𝑐1 𝑎 + 𝑐2 + 𝑐3 𝑏2
𝑎 3 2
Solving the three equations for 𝑐1 , 𝑐2 , 𝑎𝑛𝑑 𝑐3 results
𝑏−𝑎
𝑐1 =
6
2(𝑏 − a)
𝑐2 =
3
𝑏−𝑎
𝑐3 =
6
6.5.1 SIMPSON’S 1/3 RULE
• Using the Method of Coefficients
Substituting the values gives
𝑏
𝑏−𝑎 2 𝑏−𝑎 𝑎+𝑏 𝑏−𝑎
න 𝑓(𝑥)𝑑𝑥 ≈ 𝑓 𝑎 + 𝑓 + 𝑓 𝑏
𝑎 6 3 2 6
𝑏−𝑎 𝑎+𝑏 ℎ 𝑎+𝑏
= 𝑓 𝑎 + 4𝑓 + 𝑓 𝑏 = 𝑓 𝑎 + 4𝑓 +𝑓 𝑏
6 2 3 2
6.5.1 SIMPSON’S 1/3 RULE
• Example: Find the approximate integral of the curve between 𝑦 =
2 𝑥 and the x-axis on the interval [1,4] using Simpson’s 1/3 rule.
• Solution:
𝑏
ℎ 𝑎+𝑏
න 𝑓(𝑥)𝑑𝑥 ≈ 𝑓 𝑎 + 4𝑓 +𝑓 𝑏
𝑎 3 2
4−1 4+1
≈ 2 1+4 2 +2 4
3 2
4
න 2 𝑥𝑑𝑥 ≈ 3 + 2 10 ≈ 9.3246
1
Thus, the approximate error from the exact integral is approximately
0.0087.
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Suppose we subdivide the closed interval [a,b] into n segments such that n is
always an element of positive even integers. We need to apply Simpson’s
1/3 rule repeatedly over every two segments. If we divide interval [a,b] into n
equal segments, the segment width is given by
𝑏−𝑎
ℎ=
𝑛
Now
𝑏 𝑥𝑛
න 𝑓 𝑥 𝑑𝑥 = න 𝑓 𝑥 𝑑𝑥
𝑎 𝑥0
Where 𝑥0 = 𝑎, 𝑎𝑛𝑑 𝑥𝑛 = 𝑏
Expanding gives
𝑏 𝑥2 𝑥4 𝑥𝑛−2 𝑥𝑛
න 𝑓 𝑥 𝑑𝑥 = න 𝑓 𝑥 𝑑𝑥 + න 𝑓 𝑥 𝑑𝑥 + ⋯ + න 𝑓 𝑥 𝑑𝑥 + න 𝑓 𝑥 𝑑𝑥
𝑎 𝑥0 𝑥3 𝑥𝑛−4 𝑥𝑛−2
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Relating Simpson’s 1/3 in each interval results
𝑏
න 𝑓 𝑥 𝑑𝑥
𝑎
𝑓 𝑥0 + 4𝑓 𝑥1 + 𝑓 𝑥2 𝑓 𝑥2 + 4𝑓 𝑥3 + 𝑓 𝑥4
≅ 𝑥2 − 𝑥0 + 𝑥4 − 𝑥2 +⋯
6 6
𝑓 𝑥𝑛−4 + 4𝑓 𝑥𝑛−3 + 𝑓 𝑥𝑛−2 𝑓 𝑥𝑛−2 + 4𝑓 𝑥𝑛−1 + 𝑓 𝑥𝑛
+ 𝑥𝑛−2 − 𝑥𝑛−4 + 𝑥𝑛 − 𝑥𝑛−2
6 6
Since
𝑥𝑖 − 𝑥𝑖−2 = 2ℎ 𝑓𝑜𝑟 𝐼 = 2,4, … , 𝑛
Then
𝑏
න 𝑓 𝑥 𝑑𝑥
𝑎
𝑓 𝑥0 + 4𝑓 𝑥1 + 𝑓 𝑥2 𝑓 𝑥2 + 4𝑓 𝑥3 + 𝑓 𝑥4 𝑓 𝑥𝑛−4 + 4𝑓 𝑥𝑛−3 + 𝑓 𝑥𝑛−2
≅ 2ℎ + 2ℎ + ⋯ + 2ℎ
6 6 6
𝑓 𝑥𝑛−2 + 4𝑓 𝑥𝑛−1 + 𝑓 𝑥𝑛
+ 2ℎ
6
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
𝑏
න 𝑓 𝑥 𝑑𝑥
𝑎

= ሾ𝑓 𝑥0 + 4 𝑓 𝑥1 + 𝑓 𝑥2 + ⋯ + 𝑓 𝑥𝑛−1 + 2 𝑓 𝑥2 + 𝑓 𝑥4 + ⋯ + 𝑓 𝑥𝑛−2
3
+ 𝑓 𝑥𝑛 ሿ
Therefore
𝑏 𝑛−1 𝑛−2
𝑏−𝑎
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑓 𝑥0 + 4 ෍ 𝑓 𝑥𝑖 + 2 ෍ 𝑓 𝑥𝑖 + 𝑓 𝑥𝑖
𝑎 3𝑛
𝑖=1 𝑖=2
𝑖∈𝑍𝑜𝑑𝑑 𝑖∈𝑍𝑒𝑣𝑒𝑛
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Example: Find the approximate integral of 𝑓 𝑥 = cos3 (2𝑥 − 1) on the interval [0, /2] using the
composite Simpson’s 1/3 rule for n=6.
• Solution: 𝑛−1 𝑛−2
𝑏
𝑏−𝑎
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑓 𝑥0 + 4 ෍ 𝑓 𝑥𝑖 + 2 ෍ 𝑓 𝑥𝑖 + 𝑓 𝑥 𝑖
𝑎 3𝑛
𝑖=1 𝑖=2
𝜋 𝑖∈𝑍𝑜𝑑𝑑 𝑖∈𝑍𝑒𝑣𝑒𝑛
2
න cos3 (2𝑥 − 1) 𝑑𝑥
0
𝜋 𝜋 𝜋 𝜋 2𝜋
≈ ൥cos3 −1 + 4 cos3 − 1 + 2 cos3 − 1 + 4 cos3 − 1 + 2 cos3 −1
36 6 3 2 3
5𝜋
+ 4 cos3 − 1 + cos3 𝜋 − 1 ൩
6
𝜋
≈ 0.99954 + 4 × 0.99990 + 2 × 0.99985 + 4 × 0.99985 + 2 × 0.99945 + 4 × 0.99880 + 0.99791 ≈ 1.5699
36
Comparing to the exact integral which is 1.5700, it implies that there is an approximately 0.0001 true
error.
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Example: Find the approximate integral of 𝑓 𝑥 = cos3 (2𝑥 − 1) on the interval [0, /2] using the
composite Simpson’s 1/3 rule for n=6.
• Solution: 𝑛−1 𝑛−2
𝑏
𝑏−𝑎
න 𝑓 𝑥 𝑑𝑥 ≈ 𝑓 𝑥0 + 4 ෍ 𝑓 𝑥𝑖 + 2 ෍ 𝑓 𝑥𝑖 + 𝑓 𝑥 𝑖
𝑎 3𝑛
𝑖=1 𝑖=2
𝜋 𝑖∈𝑍𝑜𝑑𝑑 𝑖∈𝑍𝑒𝑣𝑒𝑛
2
න cos3 (2𝑥 − 1) 𝑑𝑥
0
𝜋 𝜋 𝜋 𝜋 2𝜋
≈ ൥cos3 −1 + 4 cos3 − 1 + 2 cos3 − 1 + 4 cos3 − 1 + 2 cos3 −1
36 6 3 2 3
5𝜋
+ 4 cos3 − 1 + cos3 𝜋 − 1 ൩
6
𝜋
≈ 0.99954 + 4 × 0.99990 + 2 × 0.99985 + 4 × 0.99985 + 2 × 0.99945 + 4 × 0.99880 + 0.99791 ≈ 1.5699
36
Comparing to the exact integral which is 1.5700, it implies that there is an approximately 0.0001 true
error.
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Error Analysis
Let Et be the true error in a f Simpson’s 1/3 Rule which is given by
𝑏−𝑎 5 4
𝐸𝑡 = − 𝑓 𝜁 ,𝑎 < 𝜁 < 𝑏
2880
It follows that the error in multiple-segment Simpson’s 1/3 rule is the sum of the
errors in each application of Simpson’s 1/3 rule. This shows that for t=1,2,…,n/2
we have
𝑥2 − 𝑥0 5 4 ℎ5 4
𝐸1 = − 𝑓 𝜁1 , 𝑥0 < 𝜁1 < 𝑥2 𝐸1 = − 𝑓 𝜁1
2880 90
𝑥4 − 𝑥2 5 4 ℎ5 4
𝐸2 = − 𝑓 𝜁2 , 𝑥2 < 𝜁2 < 𝑥4 ⇒ 𝐸2 = − 𝑓 𝜁2
2880 90
𝑥𝑛−2 − 𝑥𝑛−4 5 4 ℎ5 4
𝐸𝑛−1 = − 𝑓 𝜁𝑛−1 , 𝑥𝑛−4 < 𝜁𝑛−1 < 𝑥𝑛−2 𝐸𝑛−1 = − 𝑓 𝜁𝑛−1
2 2880 2 2 2 90 2
⋮ ⋮
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Error Analysis
𝑥𝑛 − 𝑥𝑛−2 5 5
𝐸𝑛 = − 𝑓 4 𝜁𝑛 , 𝑥𝑛−2 ℎ
< 𝜁𝑛 < 𝑥𝑛 ⇒ 𝐸𝑛 = − 𝑓 4
2 2880 2 2
𝜁𝑛
2 90 2

Therefore, the total error in the multiple-segment Simpson’s 1/3 Rule is
ℎ5 4
𝐸𝑛 = − 𝑓 𝜁𝑛
2 90 2
Now, if 𝑛 𝑛 𝑛 𝑛
2 2 2 5 σ2 𝑓 4
ℎ5 4
𝑏−𝑎 5 4
𝑏−𝑎 𝑖=1
𝜁𝑖
𝐸𝑡 = ෍ 𝐸𝑖 = − ෍ 𝑓 𝜁𝑖 = − 5 ෍𝑓 𝜁𝑖 = −
90 90𝑛 90𝑛4 𝑛
𝑖=1 𝑖=1 𝑖=1
6.5.2 COMPOSITES SIMPSON’S 1/3 RULE
• Error Analysis
𝑛
2 𝑓 4
σ𝑖=1 𝜁𝑖
The term is approximately the average of 𝑓 4 𝑥 , 𝑎 < 𝑥 < 𝑏. Thus,
𝑛
𝑏−𝑎 5 4
𝐸𝑡 = − 4 𝑓ҧ
90𝑛
Such that 𝑛
2
σ𝑖=1 𝑓4 𝜁𝑖
𝑓ҧ 4
=
𝑛
6.5.3 SIMPSON’S 3/8 RULE
• Simpson’s 3/8 rule for integration can be derived by approximating the given
function f(x) with the 3rd order polynomial 𝑓3 𝑥 = 𝑎0 + 𝑎1 𝑥 + 𝑎2 𝑥 2 + 𝑎3 𝑥 3 .
• Using Lagrange interpolation, the cubic polynomial function 𝑓3 𝑥 that passes
through 4 data points can be explicitly given as
𝑓3 𝑥
𝑥 − 𝑥1 𝑥 − 𝑥2 𝑥 − 𝑥3 𝑥 − 𝑥0 𝑥 − 𝑥2 𝑥 − 𝑥3
= × 𝑓 𝑥0 + × 𝑓 𝑥1
𝑥0 − 𝑥1 𝑥0 − 𝑥2 𝑥0 − 𝑥3 𝑥1 − 𝑥0 𝑥1 − 𝑥2 𝑥1 − 𝑥3
𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥3 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑥 − 𝑥2
+ × 𝑓 𝑥2 + × 𝑓 𝑥3
𝑥2 − 𝑥0 𝑥2 − 𝑥1 𝑥2 − 𝑥3 𝑥3 − 𝑥0 𝑥3 − 𝑥1 𝑥3 − 𝑥2
Substituting the form of 𝑓3 𝑥
𝑏 𝑏
𝑓 𝑥0 + 3𝑓 𝑥1 + 3𝑓 𝑥2 + 𝑓 𝑥3
𝐼 = න 𝑓 𝑥 𝑑𝑥 ≈ න 𝑓3 𝑥 𝑑𝑥 = (𝑏 − 𝑎) ×
𝑎 𝑎 8
6.5.3 SIMPSON’S 3/8 RULE
• Such that 𝑥0 = 𝑎
𝑏 − 𝑎 2𝑎 + 𝑏
𝑥1 = 𝑎 + ℎ = 𝑎 + =
3 3
2𝑏 − 2𝑎 𝑎 + 2𝑏
𝑥2 = 𝑎 + 2ℎ = 𝑎 + =
3 3
3𝑏 − 3𝑎
𝑥3 = 𝑎 + 3ℎ = 𝑎 + =𝑏
3
Since
𝑏−𝑎
ℎ= , 𝑏 − 𝑎 = 3ℎ
3
Then becomes
3ℎ
𝐼≈ × 𝑓 𝑥0 + 3𝑓 𝑥1 + 3𝑓 𝑥2 + 𝑓 𝑥3
8
The true error in Simpson’s 3/8 rule can be derived as
𝑏−𝑎 5
𝐸𝑡 = − × 𝑓 ′′′′ 𝜁 , 𝑤ℎ𝑒𝑟𝑒 𝑎 ≤ 𝜁 ≤ 𝑏
6480
6.5.3 SIMPSON’S 3/8 RULE
• Example: Find the approximate integral of 𝑓 𝑥 = cos 3 (2𝑥 − 1) on the interval
[0, /2] using the Simpson’s 3/8 rule for n=6.
• Solution:
𝑏
3ℎ
න 𝑓 𝑥 𝑑𝑥 ≈ × 𝑓 𝑥0 + 3𝑓 𝑥1 + 3𝑓 𝑥2 + 𝑓 𝑥3
𝜋 𝑎 8
2
න cos 3 (2𝑥 − 1) 𝑑𝑥
0 𝜋
3 3
𝜋 3
𝜋 3
𝜋
≈ cos 2 0 − 1 + 3 cos 2 − 1 + 3 cos 2 − 1 + cos 2 −1
16
𝜋 6 3 2
≈ 0.99954 + 3 × 0.99985 + 5 × 0.99945 + 0.99791 ≈ 1.3734
16

You might also like