Numerical Integration
© McGraw Hill 1
Numerical Integration
• Calculus is the mathematics of change. Because engineers must
continuously deal with systems and processes that change,
calculus is an essential tool of engineering.
• Standing in the heart of calculus are the mathematical concepts
of differentiation and integration:
y f ( xi x) f ( xi )
x x b
dy
lim
dx x 0
f ( xi x) f ( xi )
x
I f ( x)dx
a
Differentiation Integration
© McGraw Hill 2
Graphical representation of the integral
of f(x) between the limits x = a to b.
Figure PT6.2 The integral is equivalent to the area under the curve
Access the text alternative for slide images
© McGraw Hill 3
Types of Functions to be Integrated
The function to be differentiated or integrated will
typically be in one of the following three forms:
• A simple continuous function such as polynomial, an
exponential, or a trigonometric function.
• A complicated continuous function that is difficult or
impossible to differentiate or integrate directly.
• A tabulated function where values of x and f(x) are
given at a number of discrete points, as is often the case
with experimental or field data.
© McGraw Hill 4
Integrating a Function
A complicated, continuous function.
Table of discrete values of f(x)
generated from the function.
Use of a numerical method (the strip
method here) to estimate the integral on
the basis of the discrete points.
Figure PT6.7
Access the text alternative for slide images
© McGraw Hill 5
Newton-Cotes Integration Formulas
Chapter 21
• The Newton-Cotes formulas are the most common
numerical integration schemes.
• They are based on the strategy of replacing a
complicated function or tabulated data with an
approximating function that is easy to integrate: a
polynomial:
b b
I f ( x)dx f n ( x)dx
a a
f n ( x) a0 a1 x an 1 x n 1 an x n
© McGraw Hill 6
The approximation of an integral
by the area under simple polynomials
straight line (1st order) parabola (2nd order)
Figure 21.1
Access the text alternative for slide images
© McGraw Hill 7
The approximation of an integral by the
area under three straight-line segments.
Higher-order polynomials can
be utilized for the same purpose
Figure 21.2
Access the text alternative for slide images
© McGraw Hill 8
The Trapezoidal Rule
• The Trapezoidal rule is the first of the Newton-Cotes
closed integration formulas, corresponding to the case
where the polynomial is first order:
b b
I f ( x)dx f1 ( x)dx
a a
• The area under this first order polynomial is an estimate
of the integral of f(x) between the limits of a and b:
f (a) f (b)
I (b a)
2
The trapezoidal rule
© McGraw Hill 9
Graphical depiction of the trapezoidal
rule.
Figure 21.4
Access the text alternative for slide images
© McGraw Hill 10
Error of a Single Application of the
Trapezoidal Rule
• When we employ the integral under a straight line
segment to approximate the integral under a curve,
error may be substantial:
1
Et f b a
3
12
where lies somewhere in the interval from a to b.
© McGraw Hill 11
Sometimes the Trapezoidal Rule Can
Yield a Large Error
Figure 21.6
Access the text alternative for slide images
© McGraw Hill 12
Multiple Application Trapezoidal Rule 1
• One way to improve the accuracy of the trapezoidal rule is to
divide the integration interval from a to b into a number of
segments and apply the method to each segment.
• The areas of individual segments can then be added to yield the
integral for the entire interval.
ba
h a x0 b xn
n
x1 x2 xn
I f ( x)dx f ( x)dx
x0 x1
xn1
f ( x)dx
Substituting the trapezoidal rule for each integral yields:
f x0 f x1 f x1 f x2 f xn 1 f xn
I h h h
2 2 2
© McGraw Hill 13
Multiple Application Trapezoidal Rule 2
Figure 21.8
Access the text alternative for slide images
© McGraw Hill 14
Error of Multiple Application Trapezoidal
Rule
• An error for multiple-application trapezoidal rule can
be obtained by summing the individual errors for each
segment:
f (i ) nf
(b a )3
Ea 2
f
12n
Thus, if the number of segments is doubled, the
truncation error will be quartered.
© McGraw Hill 15
Simpson’s Rules 1
• More accurate estimate of an integral is obtained if a
high-order polynomial is used to connect the points.
The formulas that result from taking the integrals under
2nd & 3rd-order polynomials are called Simpson’s rules.
Simpson’s 1/3 Rule:
• Results when a second-order interpolating polynomial
is used.
© McGraw Hill 16
Simpson’s Rules 2
(a) Simpson’s 1/3 Rule (a) Simpson’s 3/8 Rule
a) Graphical depiction of Simpson’s 1/3 rule: It consists of taking the area under a
Figure 21.10 parabola connecting three points. (b) Graphical depiction of Simpson’s 3/8 rule: It
consists of taking the area under a cubic equation connecting four points.
© McGraw Hill 17
Simpson’s 1/3 Rule
b b
I f ( x)dx f2 ( x)dx
a a
where a x0 & b x2
x2
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 )
I
( x x1 )( x0 x2 )
f ( x0 )
( x1 x0 )( x1 x2 )
f ( x1 )
( x2 x0 )( x2 x1 )
f ( x2 dx
)
x0 0
h ba
I f ( x0 ) 4 f ( x1 ) f ( x2 ) h
3 2
Simpson’s 1/3 Rule
Single segment application of Simpson’s 1/3 rule has a truncation error of:
(b a)5 ( 4)
Et f ( ) a b
2880
Simpson’s 1/3 rule is more accurate than trapezoidal rule.
© McGraw Hill 18
The Multiple-Application Simpson’s 1/3
Rule 1
• Just as the trapezoidal rule, Simpson’s rules can be
improved by dividing the integration interval into a
number of segments of equal width.
• Yields accurate results and considered superior to
trapezoidal rule for most applications.
• However, it is limited to cases where values are
equispaced.
• Further, it is limited to situations where there are an
even number of segments and odd number of points.
© McGraw Hill 19
The Multiple-Application Simpson’s 1/3
Rule 2
Can only be
used for even
number of
segments
Figure 21.11 f ( x0 ) 4 f ( x1 ) f ( x2 ) f ( x2 ) 4 f ( x3 ) f ( x4 )
I 2h 2h
6 6
f ( xn 2 ) 4 f ( xn 1 ) f ( xn )
2h
6
Access the text alternative for slide images
© McGraw Hill 20
WEIGHTS
Figure 21.11
Access the text alternative for slide images
© McGraw Hill 21
The Multiple-Application Simpson’s 1/3
Rule 3
combining terms and using Eq. (21.17)
(b a ) 5
(4)
Ea 4
f
180n
Access the text alternative for slide images
© McGraw Hill 22
Simpson’s 3/8 Rule
• An odd-segment-even-point formula used in
conjunction with the 1/3 rule to permit evaluation of
both even and odd numbers of segments.
b b
I f ( x)dx f3 ( x)dx
a a
3h
I f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) f ( x3 )
8
(b a )
h
3
(b a )5 (4)
Et f ( )
6480
More accurate
© McGraw Hill 23
Simpson’s 1∕3 and 3∕8 rules
Figure 21.12
Illustration of how
Simpson’s 1∕3 and 3∕8
rules can be applied in
tandem to handle
multiple applications
with odd numbers of
intervals.
Access the text alternative for slide images
© McGraw Hill 24