You are on page 1of 8

07.06.

1





Chapter 07.06

Integrating Discrete Functions





After reading this chapter, you should be able to:

1. integrate discrete functions by several methods,
2. derive the formula for trapezoidal rule with unequal segments, and
3. solve examples of finding integrals of discrete functions.


What is integration?
Integration is the process of measuring the area under a function plotted on a graph. Why
would we want to integrate a function? Among the most common examples are finding the
velocity of a body from an acceleration function, and displacement of a body from a velocity
function. Throughout many engineering fields, there are (what sometimes seems like)
countless applications for integral calculus. You can read about a few of these applications
in different engineering majors in Chapters 07.00A-07.00G.
Sometimes, the function to be integrated is given at discrete data points, and the area under
the curve is needed to be approximated. Here, we will discuss the integration of such discrete
functions,
( )

=
b
a
dx x f I
where
) (x f is called the integrand and is given at discrete value of x ,
= a lower limit of integration
= b upper limit of integration


07.06.2 Chapter 07.06


Figure 1 Integration of a function

Integrating discrete functions
Multiple methods of integrating discrete functions are shown below using an example.
Example 1
The upward velocity of a rocket is given as a function of time in Table 1.

Table 1 Velocity as a function of time.
(s) t ) m/s ( ) (t v
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67


Determine the distance, , s covered by the rocket from 11 = t to 16 = t using the velocity
data provided and use any applicable numerical technique.

Solution
Method 1: Average Velocity Method
The velocity of the rocket is not provided at 11 = t and , 16 = t so we will have to use an
interval that includes | | 16 , 11 to find the average velocity of the rocket within that range. In
this case, the interval | | 20 , 10 will suffice.
04 . 227 ) 10 ( = v
78 . 362 ) 15 ( = v
35 . 517 ) 20 ( = v
Integrating Discrete Functions 07.06.3

3
) 20 ( ) 15 ( ) 10 ( v v v
Velocity Average
+ +
=

3
35 . 517 78 . 362 04 . 227 + +
=
m/s 06 . 369 =
















Figure 1 Velocity vs. time data for the rocket example


Using
, t v s A =
we get
m 3 . 1845 ) 11 16 )( 06 . 369 ( = = s

Method 2: Trapezoidal Rule
If we were finding the distance traveled between times in the data table, we would simply
find the area of the trapezoids with the corner points given as the velocity and time data
points. For example
=

20
10
) ( dt t v

+
20
15
15
10
) ( ) ( dt t v dt t v
and applying the trapezoidal rule over each of the above integrals gives

20
10
) ( dt t v )] 20 ( ) 15 ( [
2
15 20
)] 15 ( ) 10 ( [
2
10 15
v v v v +

+ +

~
The values of ) 10 ( v , ) 15 ( v and ) 20 ( v are given in Table 1.
However, we are interested in finding

16
11
) ( dt t v

+ =
16
15
15
11
) ( ) ( dt t v dt t v
07.06.4 Chapter 07.06

and applying the trapezoidal rule over each of the above integrals gives

16
11
) ( dt t v )] 16 ( ) 15 ( [
2
15 16
)] 15 ( ) 11 ( [
2
11 15
v v v v +

+ +

~
)) 16 ( 78 . 362 (
2
15 16
) 78 . 362 ) 11 ( (
2
11 15
v v +

+ +

=
How do we find ) 11 ( v and ) 16 ( v ? We use linear interpolation. To find ) 11 ( v ,
( ), 10 148 . 27 04 . 227 ) ( + = t t v 15 10 s s t
( ) 10 11 148 . 27 04 . 227 ) 11 ( + = v
m/s 19 . 254 =
and to find ) 16 ( v
( ), 15 913 . 30 78 . 362 ) ( + = t t v 20 15 s s t
( ) 15 16 913 . 30 78 . 362 ) 16 ( + = v
m/s 69 . 393 =
Then

16
11
) ( dt t v )) 16 ( 78 . 362 (
2
15 16
) 78 . 362 ) 11 ( (
2
11 15
v v +

+ +

~
) 69 . 393 78 . 362 (
2
15 16
) 78 . 362 19 . 254 (
2
11 15
+

+ +

=
m 2 . 1612 =
Method 3: Polynomial interpolation to find the velocity profile
Because we are finding the area under the curve from | |, 20 , 10 we must use three points,
, 10 = t , 15 = t and , 20 = t to fit a quadratic polynomial through the data. Using polynomial
interpolation, our resulting velocity function is (refer to notes on direct method of
interpolation)
( ) . 20 10 , 3766 . 0 733 . 17 05 . 12
2
s s + + = t t t t v
Now, we simply take the integral of the quadratic within our limits, giving us
( )

+ + ~
16
11
2
3766 . 0 733 . 17 05 . 12 dt t t s

16
11
3 2
3
3766 . 0
2
733 . 17
05 . 12

+ + =
t t
t
( ) ( ) ( )
3 3 2 2
11 16
3
3766 . 0
11 16
2
733 . 17
11 16 05 . 12 + + =
m 3 . 1604 =

Method 4: Spline interpolation to find the velocity profile
Fitting quadratic splines (refer to notes on spline method of interpolation) through the data
results in the following set of quadratics
, 704 . 22 ) ( t t v = 10 0 s s t
, 88 . 88 928 . 4 8888 . 0
2
+ + = t t 15 10 s s t
Integrating Discrete Functions 07.06.5

, 61 . 141 66 . 35 1356 . 0
2
+ = t t 20 15 s s t
, 55 . 554 956 . 33 6048 . 1
2
+ = t t 5 . 22 20 s s t
, 13 . 152 86 . 28 20889 . 0
2
+ = t t 30 5 . 22 s s t
The value of the integral would then simply be

+ =
16
15
15
11
) ( ) ( dt t v dt t v s
( ) ( )

+ + + + ~
16
15
2
15
11
2
61 . 141 66 . 35 1356 . 0 88 . 88 928 . 4 8888 . 0 dt t t dt t t

16
15
2 3
15
11
2 3
61 . 141
2
66 . 35
3
1356 . 0
88 . 88
2
928 . 4
3
8888 . 0

+ + = t
t t
t
t t


( ) ( ) ( ) 11 15 88 . 88 11 15
2
928 . 4
11 15
3
8888 . 0
2 2 3 3
+ + =


( ) ( ) ( ) 15 16 61 . 141 15 16
2
66 . 35
15 16
3
1356 . 0
2 3
2 2 3 3
+

+



m 9 . 1595 =


Example 2
What is the absolute relative true error for each of the four methods used in Example 1 if the
data in Table 1 was actually obtained from the velocity profile of
|
|
.
|

\
|

= t
t
t v 8 . 9
2100 140000
140000
ln 2000 ) ( ,
where v is given in m/s and t in s.
Solution
The distance covered between 11 = t and 16 = t is
|
|
.
|

\
|

=
16
11
8 . 9
2100 140000
140000
ln 2000 dt t
t
s
m 9 . 1604 =
Method 1
The approximate value obtained using average velocity method was m 3 . 1845 . Hence, the
absolute relative true error,
t
e , is
% 100
9 . 1604
3 . 1845 9 . 1604

= e
t

% 976 . 14 =
Method 2:
The approximate value obtained using the trapezoidal rule was m 2 . 1612 . Hence, the
absolute relative true error,
t
e , is
07.06.6 Chapter 07.06

% 100
9 . 1604
2 . 1612 9 . 1604

= e
t

% 451 . 0 =
Method 3:
The approximate value obtained using the direct polynomial was 1604.3 m. Hence, the
absolute relative true error,
t
e , is
% 100
9 . 1604
3 . 1604 9 . 1604

= e
t

% 037 . 0 =
Method 4:
The approximate value obtained using the spline interpolation was 1595.9 m, hence, the
absolute relative true error,
t
e , is
% 100
9 . 1604
9 . 1595 9 . 1604

= e
t

% 564 . 0 =

Table 2 Comparison of discrete function methods of numerical integration
Method
Approximate
Value
t
e

Average Velocity 1845.3 14.976%
Trapezoidal Rule 1612.2 0.451%
Polynomial Interpolation 1604.3 0.037%
Spline Interpolation 1595.9 0.564%


Trapezoidal Rule for Discrete Functions with Unequal Segments
For a general case of a function given at n data points ( ) ( )
1 1
, x f x , ( ) ( )
2 2
, x f x , ( ) ( )
3 3
, x f x ,
.., ( ) ( )
n n
x f x , , where,
n
x x x ,...., ,.
2 1
are in an ascending order, the approximate value of the
integral ( )dx x f
n
x
x

1
is given by
( ) ( ) ( ) ( )dx x f dx x f dx x f dx x f
n
n
n
x
x
x
x
x
x
x
x


+ + + =
1
3
2
2
1 1
......
( )
( ) ( )
( )
( ) ( )
......
2 2
3 2
2 3
2 1
1 2
+
+
+
+
~
x f x f
x x
x f x f
x x
( )
( ) ( )
2
.......
1
1
n n
n n
x f x f
x x
+
+


This approach uses the trapezoidal rule in the intervals | |
2 1
, x x , | |
3 2
, x x , .., | |
n n
x x ,
1
and
then adds the obtained values.

Integrating Discrete Functions 07.06.7

Example 3
The upward velocity of a rocket is given as a function of time in Table 3.

Table 3. Velocity as a function of time.
t v(t)
s m/s
0 0
10 227.04
15 362.78
20 517.35
22.5 602.97
30 901.67

















Figure 2 Velocity vs. time data for the rocket example

Determine the distance, , s covered by the rocket from 0 = t to 30 = t using the velocity data
provided and the trapezoidal rule for discrete data with unequal segments.

Solution
( ) ( ) ( ) ( ) ( ) ( )dt t v dt t v dt t v dt t v dt t v dt t v

+ + + + =
30
5 . 22
5 . 22
20
20
15
15
10
10
0
30
0


( )
( ) ( )
( )
( ) ( )
2
15 10
10 15
2
10 0
0 10
v v v v +
+
+
=


( )
( ) ( )
( )
( ) ( )
2
5 . 22 20
20 5 . 22
2
20 15
15 20
v v v v +
+
+
+
07.06.8 Chapter 07.06

( )
( ) ( )
2
30 5 . 22
5 . 22 30
v v +
+
( ) ( )
2
78 . 362 04 . 227
5
2
04 . 227 0
10
+
+
+
=
( ) ( )
2
97 . 602 35 . 517
5 . 2
2
35 . 517 78 . 362
5
+
+
+
+
( )
2
67 . 901 97 . 602
5 . 7
+
+
4 . 5642 9 . 1399 325 . 2200 55 . 1474 2 . 1135 + + + + =
m 11852 =
Can you find the value of ( )

20
10
dt t v ?

INTEGRATION
Topic Integrating discrete functions
Summary Textbook notes on integrating discrete functions
Major All Majors of Engineering
Authors Autar Kaw
Last Revised December 23, 2009
Web Site http://numericalmethods.eng.usf.edu

You might also like