MATHEMATICS FOR ENGINEERING
INTEGRATION
TUTORIAL 3 - NUMERICAL INTEGRATION METHODS
This tutorial is essential pre-requisite material for anyone studying mechanical
engineering. This tutorial uses the principle of learning by example. The approach is
practical rather than purely mathematical.
On completion of this tutorial you should be able to do the following.
Revise basic integration.
Find the areas under graphs of known functions.
Define ordinates and mid-ordinates.
Use the mid-ordinate rule.
Use the trapezoidal rule.
Use Simpson's Rule
NUMERICAL METHODS FOR INTEGRATION
1. REVISION OF INTEGRATION
Lets consider how to find the area under the graph of y = f(x) =3 + x2. A graph of this function looks like this.
Figure 1
If we solve the area by use of calculus (see tutorial 1) the area would be precisely solved as follows. Over the range x = 0 to x = 10 the area is expressed as follows.
4 x 0 x 2 )dx x (3 ACarrying out the integration gives the following.
4 0 3 4 x 0 x 2 3 x 3x )dx x (3 A
Evaluating between limits we get the following.
12 21.33 0
33.33units A 3 0 0 x 3 3 4 4 x 3 3 x 3x )dx x (3 A 3 3 4 0 3 4 x 0 x 2
2. GRAPHICAL METHODS
Consider the same function again and this time more grid lines are shown.
Figure 2 2.1 COUNTING RECTANGLES
A simple but crude way to find the area under the graph is to count the rectangles. Each rectangle on the graph above has an area of 1 unit. Count them up judging the divided ones to the nearest half. You should get an answer of about 34 units depending on hw good you are at ding it.
2.2 MID-ORDINATE RULE
The values of y corresponding to x = 0, x = 1, x = 2 and so on are called the ordinates. The values of y corresponding to x = 0.5, x = 1.5, x = 2.5 and so on are called the mid-ordinates.
Each column is approximately a rectangle w wide and h high. The area is approximately w h.
The area under the whole graph is approximately A = w h1 + w h2 + w h3 +w h4
A = w(h1 + h2 + h3 + h4)
Usually, as in this case, w =1
2.3 TRAPEZOIDAL RULE
Consider that each strip has a straight line joining the top corners as shown. The height at the middle is not quite the same as the mid-ordinate and is the average of the two ordinates. If h is the average then
h1 = (A+B)/2
h2 = (B+ C)/2
h3 = (C+ D)/2
h4 = (D+E)/2
The area of each strip is wh1 = w(A+B)/2
wh2 = w(B+ C)/2
wh3 = w(C+ D)/2
wh4 = w(D+E)/2
The total area is
A = (w/2)[(A+B) + (B+C) + (C+D) + (D+E)] A = (w/2)[(A+B + B+C + C+D + D+E] A = (w/2)[(A + E) + 2(B+C+D)] Figure 4
Hence in our example A = (1/2)[(3+19) +2(4+7+12)] = (1/2)(22+46) = 34
This is slightly larger than the correct figure but again, if smaller strips are used, the answer will be accurate. The above rule may be written as follows.
First Last 2 x sumof therest
2 w
A
2.4 SIMPSON'S RULE
The area is divided into an even number of strips. The ordinates are h1, h2 .... The area is calculated on the assumption that the curve joining neighbouring ordinates are a quadratic that passes through the mid ordinate. It follows that if the curve is a parabola, the area will be exact. The derivation is not given here as it is quite complicated but the result is as follows.
first last 4sumof theeven ordinates 2sumof theremainingoddordinates
3
w
WORKED EXAMPLE No.1
Find the area under the graph of the function y = sin between the limits 0 and radians using integration and the trapezoidal rule.
SOLUTION
Evaluating the ordinates and mid-ordinates at intervals of /8 produces the table and graph shown.
Figure 5
Integration
-cosθ
cos π cos0 1 1 2 dθ sinθ A 0π π 0
Mid-ordinates w = /4 2.068 0.393) 0.924 0.924 (0.393 4 π ) h h h w(h A 1 2 3 4 Trapezoidal Rule w = /4
0 0 20.707 1.0 0.707
1.896units 2 π/4 A rest the of sum x 2 Last First 2 w A WORKED EXAMPLE No.2
Find the area under the curve f(x) = 2x2 + 4x + 8 between x = 0 and x = 4 using Simpson's Rule with eight strips and determine the error.
SOLUTION
4 0 2 8)dx 4x (2x A
0 106.67 ) 4 ( 8 ) 4 ( 2 3 ) 4 ( 2 8 2 3 2 A 2 3 4 0 2 3 x x x SIMPSON'S RULE Fig.6
first last 4sumof theeven ordinates 2sumof theremainingoddordinates
3 w I
640 106.67 3 0.5 152 424 64 3 0.5 I 76 2 106 4 64 3 0.5 I 38 24 14 2 46.5 30.5 18.5 10.5 4 56 8 3 0.5 I The error is zero and it always is when the function is a quadratic. It follows that for a quadratic you only need two strips.
SELF ASSESSMENT EXERCISE No.1
1. Find the area under the graph of the following functions using integration, the mid-ordinate rule and the trapezoidal rule.
y = 2x3 between the limits x = 0 and x = 5 y = ex between the limits of x = 1 and x = 5. y = sin x between the limits x = 0 and x = 180o.
2. Estimate the value of the definite integral
5
1 4
dx x
In Engineering the area under the graph represents real things. For example the area under a force – distance graph represents the work done or energy used and the area under a pressure – volume graph also represents work done during the compression or expansion of a gas.
WORKED EXAMPLE No.3
The pressure (p) and volume (V) during a gas expansion is related by the law
p = 0.2V-1.2. Determine the work done when the volume is expanded from 10 x 10-6 m3 to 100 x 10-6 m3.
Use calculus and the trapezoidal rule to find the answer.
SOLUTION Figure 7 INTEGRATION
6.309-10
3.69Joules -1 W 10x10 10 x 100 -1 V 1 W 0.2 -V 0.2 1 1.2 -V 0.2 dV 0.2V W 0.2V p but pdV Work Area 0.2 6 0.2 6 -10x10 1x10 0.2 V V 0.2 -V V 1 1.2 -V V 1.2 1.2 V V 6 6 2 1 2 1 2 1 2 1
SELF ASSESSMENT EXERCISE No.2
1. The electric current charging a capacitor is related to time by the following law. I = 10(1 – e-t/2) Amps
Calculate the charge Q (the area under the graph) between the limits t = 0 and t = 6 s. Use calculus and the trapezoidal rule. (Graph and ordinates are calculated for you)
(Answer around 41 Coulombs)
Figure 8
2. Find the area (with units) under the following function between the limits x = 0 and x = 10 m using integration, the mid-ordinate rule and the trapezoidal rule.
y = 4 + 20x – x2 m
(Answers around 706.7 m2)
3. Find the area under the following function between the limits t = 0 and t = 1 s using integration, the mid-ordinate rule and the trapezoidal rule with steps of 0.2s.
v = 2t + e2t m/s
(Answers around 4.2 m)
4. Find the area (with units) under the following function between the limits = 0 and = 1.4
radian using integration, the mid-ordinate rule and the trapezoidal rule with steps of 0.2 radian
T = 3 cos (Nm)
(Answers around 2.96 Joules)
5. Find the area (with units) under the following function between the limits V = 1 and V = 5 m3 using integration, the mid-ordinate rule and the trapezoidal rule with steps of 1.
p = 2 ln V N/m2