Professional Documents
Culture Documents
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
න 𝑓 𝑥 𝑑𝑥
𝑎
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
Where the supremum and infimum are over all partitions of [a,b]. In addition, if f is
integrable then
𝑏
න 𝑓 𝑥 𝑑𝑥 = inf 𝑈 𝑓, 𝑃
𝑃
𝑎
• 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
𝑎
න 𝑓 𝑥 𝑑𝑥 = න 𝑎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
න (𝑎0 + 𝑎1 𝑥) 𝑑𝑥 = 𝑐1 𝑓 𝑎 + 𝑐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,
𝑏−𝑎
ℎ=
𝑛