Chapter 7Numerical
Integration
Lecture 8
Integration
Indefinite Integrals
Indefinite Integrals of a function are functions that differ from each other by a constant.
cx
dxx2
2
Definite Integrals
Definite Integrals are numbers.
2
1
2
1
0
1
0
2
x
xdx
for solution form closedNo
for tiveantideriva no is There2
2
b
a
x
x
dxe
e
Why Numerical Integration?
• Very often, the function f(x) to differentiate or the integrand to integrate is too complex to derive exact analytical solutions.
• In most cases in engineering, the function f(x) is only available in a tabulated form with values known only at discrete points.
Numerical Solution
The general form of numerical integration of a function f (x) over some interval [a, b] is a weighted sum of the function values at a finite number (n) of sample points (nodes), referred to as ‘quadrature’:
Numerical Integration
b
af(x)dxArea
One interpretation of the definite integral is
Integral = area under the curve
a b
f(x)
Newton-Cotes IntegrationCommon numerical integration schemeBased on the strategy of replacing a
complicated function or tabulated data with some approximating function that is easy to integrate
nnn
b
a
n
b
a
xaxaaxPxf
dxxPdxxfI
....)( 10
Pn(x) is an nth orderpolynomial
Trapezoidal RuleCorresponds to the case where the
polynomial is a first order
b
a
b
a
dxxPdxxfI 1
0
1
2
3
4
5
0 5 10
x
f(x)
h
F(a)
F(b)
From the trapezoidal rule we can obtain for the total area of (n-1) intervals
0
1
2
3
4
5
0 1 2 3 4 5 6 7 8 9 10
x
f(x)
222
13221 nn xfxfh
xfxfh
xfxfhI
where there are n equally spaced base points.
n
n
x
x
x
x
x
x
dxxfdxxfdxxfI1
3
2
2
)()()(1
Error Estimate in the trapezoidal rule
It can be obtained by integrating the interpolation error we defined in previous chapter for Lagrange polynomial as
0
1
2
3
4
5
0 5 10
x
f(x)
Error
Example
)(''max12 ],[
2 xfhab
Errorbax
5
010
2
1 error ,)sin( thatsohfinddxx
52 102
1
121)('' hErrorxf
)sin()('');cos()(';0; xxfxxfab
52 106
h
0 1
0 11/2
1 12
0 11/21/4 3/4
1 12 2 2
Remark 1: in this example instead of re-computation of some function values when h is changed to h/2 we observe that
Simpson’s Rules
0
1
2
3
4
5
0 5 10
x
f(x)
Simpson’s 1/3 rule can be obtained by passing a parabolic interpolant through three adjacent nodes.
The area under the parabola is
To obtain the total area of (n-1) even intervals we apply the following general Simpson’s 1/3 rule
f(x1), f(xn)Note:
1
f(x2), f(x4), f(x6),..
4f(x3), f(x5), f(x7),..
2
Remark 2: Simpson’s 1/3 rule requires the number of intervals to be even. If this condition is not satisfied, we can integrate over the first (or last) three intervals with Simpson’s 3/8 rule which can be obtained by passing a cubic interpolant through four adjacent nodes, and defined by
The error in the Simpson’s rule is
Because the number of panels is odd, we compute the integral over the first three intervals by Simpson’s 3/8 rule, and use the 1/3 rule for the last two intervals:
Simpson’s 3/8 rule Simpson’s 1/3 rule
Summary
Newton Cotes formulae for Numerical
integration.
Trapezoidal Rule
Simpson’s Rules.
Romberg Integration
Double Integrals
To be continued in
Lecture 9