Professional Documents
Culture Documents
Lesson 5. Numerical Integration
Lesson 5. Numerical Integration
Lesson 5
Rationale
• Two main reasons for why there is a need to do numerical integration:
1. Analytical integration may be impossible/infeasible
2. It may be necessary to integrate tabulated data rather than known functions
• Applications for integration:
• Ex. Maxwell’s equations – numerical solutions of Maxwell’s equations can be directly used for
many engineering applications
• Integration is involved in practically every physical theory:
• Vibration, distortion under weight, or one of many types of fluid flow − e.g. heat flow, air flow
(over a wing), or water flow (over a ship’s hull, through a pipe, groundwater flow regarding a
contaminant), etc.;
• All these things can be either directly solved by integration (for simple systems), or some type of
numerical integration (for complex systems).
• Numerical integration is essential for evaluation of integrals of functions available only at
discrete points;
• Such functions often arise in the numerical solution of differential equations or from experimental
data taken at discrete intervals
• Engineers therefore often require numerical integration.
Lesson Objectives
• appreciate the need for numerical integration
• evaluate integrals using the trapezoidal rule
• evaluate integrals using the mid-ordinate rule
• evaluate integrals using Simpson’s rule
• apply numerical integration to practical situations
Contents
1. Introduction
2. The Trapezoidal Rule
3. The Mid-ordinate Rule
4. Simpson’s Rule
1. Introduction
• Even with advanced methods of integration there are many mathematical
functions which cannot be integrated by analytical methods and thus
approximate methods have then to be used.
• Approximate methods of definite integrals may be determined by what is
termed numerical integration.
• It may be shown that determining the value of a definite integral is, in fact,
finding the area between a curve, the horizontal axis and the specified
ordinates.
• Three methods of finding approximate areas under curves:
• The trapezoidal rule
• The mid-ordinate rule
• Simpson’s rule
• These rules are used as a basis for numerical integration.
Contents
1. Introduction
2. The Trapezoidal Rule
3. The Mid-ordinate Rule
4. Simpson’s Rule
2. The Trapezoidal Rule
• Let a required definite integral be
𝑏
denoted by 𝑎 𝑦𝑑𝑥 and be
represented by the area under the
graph of 𝑦 = 𝑓(𝑥) between the limits
𝑥 = 𝑎 and 𝑥 = 𝑏 (see Fig. 48.1)
• Let the range of integration be
divided into 𝑛 equal intervals, each of
width 𝑑, such that 𝑛𝑑 = 𝑏 − 𝑎 or
𝑏−𝑎
𝑑=
𝑛
• The ordinates are labelled 𝑦1 , 𝑦2 ,
𝑦3 ,… 𝑦𝑛+1
2. The Trapezoidal Rule
• An approximation to the area under
the curve may be determined by
joining the tops of the ordinates by
straight lines.
• Each interval is thus a trapezium, the
area of which is given by:
1 sum of parallel sides ×
𝐴=
2 perpendicular distance between them
𝑏
𝑦𝑑𝑥
𝑎
1 1
≈ 𝑦1 + 𝑦2 𝑑 + 𝑦2 + 𝑦3 𝑑
2 2
1 1
+ 𝑦3 + 𝑦4 𝑑 + ⋯ + 𝑦𝑛 + 𝑦𝑛+1 𝑑
2 2
1
≈ 𝑑 𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + ⋯ + 𝑦𝑛 +
2
The Trapezoidal Rule:
𝑏
width of 1 first + last remaining
𝑦𝑑𝑥 = +
𝑎 interval 2 ordinate ordinates
3 2
Problem 1. (a) Use integration to evaluate 1 𝑥
𝑑𝑥,
correct to 3 decimal places.
• Solution:
Problem 1. (b) Use the Trapezoidal Rule with four
intervals to evaluate the integral in 1(a), correct to 3
decimal places.
• The range of integration is the difference
between the upper and lower limits, 3 − 1 = 2.
• Using the trapezoidal rule with four intervals
3−1
gives an interval width 𝑑 = = 0.5 and
4
ordinates situated at 1.0, 1.5, 2.0, 2.5, and 3.0.
2
• Corresponding values of are shown in the
𝑥
table, each correct to 4 decimal places (one more
decimal place than required in the problem).
Problem 1. (b) Use the Trapezoidal Rule with four
intervals to evaluate the integral in 1(a), correct to 3
decimal places.
• Solution:
Problem 2. Use the trapezoidal rule with eight intervals
3 2
to evaluate 1 𝑑𝑥 correct to 3 decimal places.
𝑥
3−1
• With eight intervals, width of each is 𝑑 = = 0.25
8
• Ordinates: 1.00, 1.25, 1.50, 1.75, 2.00, 2.25, 2.50, 2.75
and 3.00.
2
• Corresponding values of are shown in the table:
𝑥
Problem 2. Use the trapezoidal rule with eight intervals
3 2
to evaluate 1 𝑑𝑥 correct to 3 decimal places.
𝑥
Problem 2. Use the trapezoidal rule with eight intervals
3 2
to evaluate 1 𝑑𝑥 correct to 3 decimal places.
𝑥
• This problem demonstrates that the greater the number of intervals
chosen (i.e. the smaller the interval width) the more accurate will be
the value of the definite integral.
• The exact value is found when the number of intervals is infinite,
which is the basis for the process of integration.
𝜋/2 1
Problem 3. Use the trapezoidal rule to evaluate 0
𝑑𝑥
1+sin 𝑥
using six intervals. Give the answer correct to 4 significant
figures.
𝜋
−0 𝜋
• With six intervals, width of each is 𝑑 = 2
=
6 12
rad (15°)
1
• Ordinates occur at corresponding values of
1+sin 𝑥
(see table)
𝜋/2 1
Problem 3. Use the trapezoidal rule to evaluate 0
𝑑𝑥
1+sin 𝑥
using six intervals. Give the answer correct to 4 significant
figures.
Contents
1. Introduction
2. The Trapezoidal Rule
3. The Mid-ordinate Rule
4. Simpson’s Rule
3. The Mid-ordinate Rule
• Let a required definite integral be
𝑏
denoted by 𝑎 𝑦 𝑑𝑥 and represented
by the area under the graph of 𝑦 =
𝑓(𝑥) between the limits 𝑥 = 𝑎 and
𝑥 = 𝑏 (see Fig. 48.2)
• Each interval of width 𝑑 is assumed to
be replaced by a rectangle of height
equal to the ordinate at the middle
point of each interval, shown as 𝑦1 ,
𝑦2 , 𝑦3 ,..., 𝑦𝑛 (see Fig. 48.2)
3. The Mid-ordinate Rule
• Thus
𝑏
𝑦 𝑑𝑥
𝑎
≈ 𝑑𝑦1 + 𝑑𝑦2 + 𝑑𝑦3 + ⋯ + 𝑑𝑦𝑛
≈ 𝑑(𝑦1 + 𝑦2 + 𝑦3 + ⋯ + 𝑦𝑛 )
Solution (a):
3−1
• With four intervals, each will have a width of 𝑑 = = 0.5
4
• The ordinates will occur at 1.0, 1.5, 2.0, 2.5 and 3.0
• The mid-ordinates 𝑦1 , 𝑦2 , 𝑦3 , and 𝑦4 occur at 1.25, 1.75, 2.25
and 2.75
2
• Corresponding values of are shown in the table
𝑥
Solution (b):
3−1
• With eight intervals, each will have a width of 𝑑 = = 0.25
8
• The ordinates will occur at 1.00, 1.25, 1.50, 1.75,…
• The mid-ordinates 𝑦1 , 𝑦2 , 𝑦3 , 𝑦4 ,… occur at 1.125, 1.375,
1.625 and 1.875…
2
• Corresponding values of are shown in the table
𝑥
• From equation (2):
3
2
𝑑𝑥
1 𝑥
≈ 0.25 1.8856 + 1.7056 + 1.5689 + 1.4606 + 1.3720 + 1.2978 + 1.2344
Correct to 3 The greater the number of intervals the
decimal places nearer the result is to the true value.
−𝑥2
2.4
Problem 5. Evaluate 0
𝑒
𝑑𝑥, correct to 4 significant
3
Solution (a):
3−1
• With four intervals, each will have a width of 𝑑 = = 0.5 first
4
even
• The ordinates will occur at 1.0, 1.5, 2.0, 2.5, and 3.0
odd
2
• Corresponding values of are shown in the table even
𝑥
• From equation (5): last
3
2 1
𝑑𝑥 ≈ 0.5 2.0000 + 1.1547 + 4 1.6330 + 1.2649 + 2 1.4142
1 𝑥 3
1 Correct to 3
= 0.5 3.1547 + 11.5916 + 2.8284 = 𝟐. 𝟗𝟐𝟗 decimal places
3
Problem 6. Use Simpson’s rule with (a) four intervals, (b) eight
3 2
intervals, to evaluate 1 𝑑𝑥, correct to 3 decimal places.
𝑥
Solution (b):
3−1
• With eight intervals, each will have a width of 𝑑 = = 0.25
8
• The ordinates will occur at 1.00, 1.25, 1.50, 1.75,…, and 3.0
2
• Corresponding values of are shown in the table
𝑥
• From equation (5):
3
2
𝑑𝑥
1 𝑥
1
≈ 0.25 2.0000 + 1.1547
3
+ 4 1.7889 + 1.5119 + 1.3333 + 1.2060