Title: Computers%20in%20Civil%20Engineering
1Computers in Civil Engineering53081 Spring 2003
Lecture 16
Numerical Integration
2Numerical Integration
- Important in numerous engineering applications
- Analogy between integration and summation
- Closely related to areas/volumes
- Strong coupling of integration and differentiation
3Scope
Evaluation of definite integrals, e.g.
Evaluation of indefinite integrals, where the
result is a function whose derivative is given,
is outside of the scope of the course.
4Integration in Engineering
A definite integral can be interpreted as the
area under a function
Mass transfer values
Total force
Kinetics
5Examples Integration in Engineering
rainrate (mm/h)
time (s)
a
b
w(z)
z
D
front view
side view
6Integration Summation
Analogy between Integration and Summation
7Numerical Integration
Basic Strategy
- Approximate the function with something more
easily integrable, and - Integrate the approximation
where
The integral can also be approximated using a
series of piecewise polynomials, i.e. the same
polynomial does not necessarily have to pass
through all the points.
8Example
Approximate the functions with several piecewise
first-order polynomials
approximation
function
9The Trapezoidal Rule
Truncation error
10Potential Pitfalls
11Multiple-Application of The Trapezoidal Rule
12Mathematical Formulation
width
average height
13Example
Problem Use the two-segment trapezoidal rule to
estimate the integral of from a 0, to b 0.8.
Solution
14Truncation Error
Approximate truncation error
where average 2nd derivative over the
whole interval a to b
Problem Compute for the function
Solution
15Pseudocode
- function trapez(f,n,a,b)
- dimension f(n1)
- sum0.0
- do i2,n
- sumsumf(i)
- enddo
- trapez(f(1)2Sumf(n1))(b-a)/(2n)
- return
- end
h(b-a)/n
16Do you have to use constant intervals?
- No it is not hard to develop a scheme using
irregular intervals.
But then you cant interpret the method as just
taking the average of the function values, right?
17Simpsons Rules
Concept instead of finer segmentation, use
higher-order polynomials to fit the data, and
calculate the integrals based on these
approximations. For example
The following analyses assume equal-sized
intervals.
18Simpsons 1/3 Rule
Notice even number of segments
parabola
width
average height
19Simpsons 3/8 Rule
width
average height
20Other Issues
- Extension of Simpsons 1/3 Rule to
Multiple-Application situations - Integration with unequal segments
- Integration limits extended beyond the data
points (open Newton-Coates) formulas - Adaptive selection of the number of points and/or
interval length
21Multiple Application of Simpsons 1/3 Rule
f(x)
Notice Even number of segments
a
b
width
average height
22Next Overview and Tips