Numerical Methods for Eng [ENGR 391] [Lyes KADEM 2007]
CHAPTER VI
Numerical Integration
Topics
- Riemann sums
- Trapezoidal rule
- Simpson’s rule
- Richardson’s extrapolation
- Gauss quadrature rule
Mathematically, integration is just finding the area under a curve from one point to another. It is represented by, where the symbol is an integral sign, the numbers a and b are the lower and upper limits of integration, respectively, the function f is the integrand of the integral, and x is the variable of integration. Figure 1 represents a graphical demonstration of the concept.
Why are we interested in integration: because most equations in physics are differential equations that must be integrated to find the solution(s). Furthermore, some physical quantities can be obtained by integration (example: displacement from velocity).
The problem is that sometimes integrating analytically some functions can easily become laborious. For this reason, a wide variety of numerical methods have been developed to find the integral.
Figure.6.1- Integration.
I. Riemann Sums
Let f be defined on the closed interval [a, b], and let ∆ be an arbitrary partition of [a, b] such as: a = x0 < x1 < x2 < … < xn-1 <xn = b, where ∆xi is the length of the ith subinterval.
If ci is any point in the ith subinterval, then the sum
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 ∆). The following limit is used to define the definite integral:
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
for any choice of the numbers 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 that the Riemann Sums of f on [a, b] approach the number I.
,
Where
2. TRAPEZOIDAL RULE
Trapezoidal rule is based on the Newton-Cotes formula that if we approximate the integrand by an nth order polynomial, then the integral of the function is approximated by the integral of that nth order polynomial.
So if we want to approximate the integral
to find the value of the above integral, we write our function under polynomial form:
where
where is an order polynomial. Trapezoidal rule assumes , that is, the area under the linear polynomial (straight line),
2.1. DERIVATION OF THE TRAPEZOIDAL RULE
We have:
.
But what is a0 and a1? Now if we choose, and as the two points to approximate by a straight line from to ,
Solving the above two equations for and ,
Hence we get,
3.1. Multiple-segment Trapezoidal Rule:
One way to increase the accuracy of the trapezoidal rule is to increase the number of segments between a and b. So in this procedure, we will divide into equal segments and apply the Trapezoidal rule over each segment, the sum of the results obtained for each segment is the approximate value of the integral.
Divide into equal segments as shown in the figure below. Then the width of each segment is
The integral I can be broken into h integrals as
Figure.6.2- Multiple-segment Trapezoidal rule.
Applying Trapezoidal rule on each segment gives:
………………
3.1.1. Why increasing the number of segments
To illustrate the importance of increasing the number of segments in the Trapezoidal rule, let us consider the following integral:
The following table represents the variation in the absolute and relative error with the number of segments used. Note that with a small number of segments, the error is very high.
n / Approximate Value / /1 / 0.681 / 245.91 / 99.724%
2 / 50.535 / 196.05 / 79.505%
4 / 170.61 / 75.978 / 30.812%
8 / 227.04 / 19.546 / 7.927%
16 / 241.70 / 4.887 / 1.982%
32 / 245.37 / 1.222 / 0.495%
64 / 246.28 / 0.305 / 0.124%
3.1.2. Error in Multiple-segment Trapezoidal Rule
The true error for a single segment Trapezoidal rule is given by
where is some point in .
What is the error, then, in the multiple-segment Trapezoidal rule? It will be simply the sum of the errors from each segment, where the error in each segment is that of the single segment Trapezoidal rule. The error in each segment is
.
.
Hence the total error in multiple-segment Trapezoidal rule is
The term is an approximate average value of the second derivative.
Hence
4. SIMPSON’S 1/3RD RULE
Trapezoidal rule was based on approximating the integrand by a first order polynomial, and then integrating the polynomial in the interval of integration. Simpson’s 1/3rd rule is an extension of Trapezoidal rule where the integrand is approximated by a second order polynomial.
We have,
where is a second order polynomial.
Choose and as the three points of the function to evaluate and .
Solving the above three equations for unknowns, and gives
Then
Substituting values of and gives
Since for Simpson’s 1/3rd Rule, the interval is broken into 2 segments, the segment width is
Hence the Simpson’s 1/3rd rule is given by
Since the above form has 1/3 in its formula, it is called Simpson’s 1/3rd Rule.
4.1. Multiple Segment Simpson’s 1/3rd Rule
Just like in multiple-segment Trapezoidal Rule, we can subdivide the interval into segments and apply Simpson’s 1/3rd Rule over every two segments. Note that needs to be even. Divide interval into equal segments, hence the segment width.
where
Apply Simpson’s 1/3rd Rule over each interval,
Since
then
4.2. Error in Multiple Segment Simpson’s 1/3rd Rule
The true error in a single application of Simpson’s 1/3rd Rule is given by
In Multiple Segment Simpson’s 1/3rd Rule, the error is the sum of the errors in each application of Simpson’s 1/3rd Rule. The error in segment Simpson’s 1/3rd Rule is given by
:
Hence, the total error in Multiple Segment Simpson’s 1/3rd Rule is
The term is an approximate average value of. Hence
where
5. Richardson’s Extrapolation Formula for Trapezoidal Rule
The true error in a multiple segment Trapezoidal Rule with n segments for an integral
is given by
where for each i, is a point somewhere in the domain , and
the term can be viewed as an approximate average value of in . This leads us to say that the true error, Et can be written under the form:
Or
where
C is an approximate constant of proportionality.
Since, we have
where
= true value
= approximate value using n-segments.
Then, we can write,
If the number of segments is doubled from n to 2n in the Trapezoidal rule,
The above equations can be combined to get:
6. GAUSS QUADRATURE RULE
6.1. Derivation of two-point Gaussian Quadrature Rule
The two-point Gauss Quadrature Rule is an extension of the Trapezoidal Rule approximation where the arguments of the function are not predetermined as and , but as unknowns and . So in the two-point Gauss Quadrature Rule, the integral is approximated as
There are four unknowns , , and . These are found by assuming that the formula gives exact results for integrating a general third order polynomial, . Hence
The formula gives
Equating the above equations gives
Since in this equation, the constants and are arbitrary, the coefficients of and are equal. This gives us the four following equations:
and
Hence
6.2. Higher point Gaussian Quadrature Formulas
If we write the integral of the function f(x) under the following form:
This is called the three-point Gauss Quadrature Rule. The coefficients , and , and the function arguments , and are calculated by assuming the formula gives exact expressions for integrating a fifth order polynomial
. General n-point rules would approximate the integral
6.2.1. Arguments and weighing factors for n-point Gauss Quadrature Rules
Usually coefficients and arguments for n-point Gauss Quadrature Rule are tabulated. But, they are given for integrals of the form
Table 1: Weighting factors and function arguments used in Gauss Quadrature formulas
Points / WeightingFactors / Function
Arguments
2
3
4
5
6 /
/
Note: if the table is given for integrals, how can we solve ?
Any integral with limits of can be converted into an integral with limits . Let
If then
If then
such that
Solving these two simultaneous linear Equations (21) gives
Hence
Substituting our values of and into the integral gives us
81
Numerical Integration