Numerical Integration
Numerical Computational Laboratory| CE19004 Lecture:09
Learning Objectives
• To apply the different numerical integration methods in
real-life engineering problems
Introduction
x y = f(x)
0 0.2
0.1 1.289
0.2 1.288
0.3 1.607
0.4 2.456
0.5 3.325
0.6 3.464
0.7 2.363
0.8 0.232
f(x) = 0.2 + 25x - 200x2 + 675x3 - 900x4 +400x5
The functional form of f(x) is known
Simple continuous functions (polynomial, exponential, trigonometric)
Complicated continuous function difficult to integrate
Tabulated function, x and f(x) values are provided at discrete points, e.g.
field data
Application - area under the curve, estimate parameters
Introduction
x y = f(x)
3.2 0.04076
3.5 0.0302
3.8 0.02237
4.1 0.01657
4.4 0.01228
5 0.00674
5.3 0.00499
5.6 0.0037
5.9 0.00274
0.8
න f(x) = 0.2 + 25x − 200x2 + 675x3 − 900x4 +400x5
To find area under the curve 0
= 1.640533 Determined analytically
In case the exact form of function f(x) is known
Newton-Cotes Integration Formulas
- closed and open forms (data points and integration limits)
- Tabulated data or complicated function
Trapezoidal rule – First of Newton-Cotes closed Integration Formulas
Geometrically, the trapezoidal rule is equivalent to approximating the area of the
trapezoid under the straight-line connecting f(a) and f(b); i.e., I ≅ width × average height
Source: Chapra, S. C., & Canale, R. P. (2011). Numerical methods for engineers (Vol. 1221). New York: Mcgraw-hill.
Trapezoidal rule
f(x) = 0.2 + 25x - 200x2 + 675x3 - 900x4 +400x5
f(0) = 0.2, f(0.8) = 0.232
I =0.1728
Et = 1.640533 - 0.1728 = 1.467733
εt = 89%
x8 = b
x0 = a
Trapezoidal rule
f(x) = 0.2 + 25x - 200x2 + 675x3 - 900x4
+400x5
Multiple application of Trapezoidal
rule
x0 = a
x1 x2 x3 x4 x5 x6 x7 x8 = b
n=8
For n = 2
f(0) = 0.2, f(0.4) = 2.456 f(0.8) = 0.232
I =1.0688, Et = 0.57173 εt = 34.9%
Good for nicely behaved functions
Accuracy – acceptable
Huge computational effort
Simpson’s rule
• Uses higher order polynomial
• Additional point/points at the
midway between f(a) and f(b)
Simpson’s 1/3rd rule
– second of Newton-
Cotes closed Integration
Formulas
h = (b - a)∕2
Multiple application of Simpson’s
1/3rd rule
For n = 4
I =1.623467, Et = 0.017067
εt = 1.04%
f(x) = 0.2 + 25x - 200x2 + 675x3 - 900x4 +400x5
Simpson’s rule
Simpson’s 3/8th rule
h = (b - a)∕3
Multiple application of Simpson’s 3/8th rule
• Similar degree of accuracy, difference in number of points
• 1/3rd rule – no of intervals are even, no of points are odd
• 3/8th rule – no of intervals are odd, no of points are even
• Multiple application of two rules - better accuracy than trapezoidal
• Higher order accuracy –rarely used – Boole’s rule
Integration with unequal segments
- use multiple application of Trapezoidal rule for each consecutive points with the
respective interval width
Open Integration formulas
Limits extend beyond the range of available data
- Introduction of weighing factors
- Not often used for definite integration
Multiple integrals
Source: Chapra, S. C., & Canale, R. P. (2011). Numerical methods for engineers (Vol. 1221). New York: Mcgraw-hill.
Integration of Equations
The exact for of the function is given in place of the tabulated data
- Romberg integration
- Adaptive integration
- Gauss quadrature
- Monte Carlo Integration
• Not constrained to take the weighted average of f(x) at the ends of the interval
• Employ x values positioned between a and b in such a manner that gives more
accurate integral estimate
• Balance the positive and negative errors
Source: Chapra, S. C., & Canale, R. P. (2011). Numerical methods for engineers (Vol. 1221). New York: Mcgraw-hill.
Gauss Quadrature
Gauss-Legendre formulas
- Method of Undetermined Coefficients
Source: Chapra, S. C., & Canale, R. P. (2011). Numerical methods for engineers (Vol. 1221). New York: Mcgraw-hill.
Gauss Quadrature
Two-point Gauss-Legendre formulas
4 unknowns
Assumption:
Integration equation fits constant,
linear, quadratic and cubic functions
only
Third order accurate
Source: Chapra, S. C., & Canale, R. P. (2011). Numerical
methods for engineers (Vol. 1221). New York: Mcgraw-hill.
Gauss Quadrature
f(x) = 0.2 + 25x - 200x2 + 675x3 - 900x4 +400x5
Convert in a variable that
varies from -1 to +1
x = 0.4 + 0.4xd
dx = 0.4dxd
I ≅ 0.516741 + 1.305837 = 1.822578
εt = -11.1%
Thank you