07.06 - integrating discrete function

7
INTEGRATING DISCRETE FUNCTIONS 07.06.1 Chapter 07.06 Integrating 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 do so? Among the most common examples are finding the velocity of a body from acceleration functions, and displacement of a body from velocity data. Throughout the engineering fields, there are (what sometimes seems like) countless applications for integral calculus. Sometimes, the evaluation of expressions involving these integrals can become daunting, if not indeterminate. For this reason, a wide variety of numerical methods have been developed to simplify the integral. Here, we will discuss the use of numerical integration with discrete data points, which can involve unequal segments. Figure 1: Integration of a function INTEGRATING DISCRETE FUNCTIONS The method of integrating discrete functions is 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 t v(t) s m/s

Upload: enos-lolang

Post on 11-Apr-2015

1.433 views

Category:

Documents


1 download

DESCRIPTION

Among the most common examples are finding the velocity of a body from acceleration functions, and displacement of a body from velocity data

TRANSCRIPT

Page 1: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.1

Chapter 07.06 Integrating 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 do so? Among the most common examples are finding the velocity of a body

from acceleration functions, and displacement of a body from velocity data. Throughout the

engineering fields, there are (what sometimes seems like) countless applications for integral

calculus. Sometimes, the evaluation of expressions involving these integrals can become

daunting, if not indeterminate. For this reason, a wide variety of numerical methods have been

developed to simplify the integral. Here, we will discuss the use of numerical integration with

discrete data points, which can involve unequal segments.

Figure 1: Integration of a function

INTEGRATING DISCRETE FUNCTIONS

The method of integrating discrete functions is 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

t v(t)

s m/s

Page 2: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.2

0 0

10 227.04

15 362.78

20 517.35

22.5 602.97

30 901.67

Figure 1: Velocity vs. time data for the rocket example

Determine the distance, ,s covered by the rocket from 11=t to 16=t using the velocity data

provided and 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 the 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

3

)20()15()10( vvvVelocityAverage ++=

3

35.51778.36204.227 ++=

sm /06.369=

Since ,tvs Δ= we get

ms 3.1845)1116)(06.369( =−=

Method 2: Trapezoidal Rule

If we were finding the distance traveled between times on 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

)( dttv ∫∫ +20

15

15

10

)()( dttvdttv

Page 3: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.3

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

∫20

10

)( dttv )]20()15([2

1520)]15()10([2

1015 vvvv +−

++−

The values of v(10), v(15) and v(20) are given in Table 1.

However, we are interested in finding

∫16

11

)( dttv ∫∫ +=16

15

15

11

)()( dttvdttv

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

∫16

11

)( dttv )]16()15([2

1516)]15()11([2

1115 vvvv +−

++−

))16(78.362(2

1516)78.362)11((2

1115 vv +−

++−

=

How do we find v(11) and v(16)? We use linear interpolation. To find v(11), ( ),10148.2704.227)( −+= ttv 1510 ≤≤ t

( )1011148.2704.227)11( −+=v

sm /19.254=

and to find v(16)

( ),15913.3078.362)( −+= ttv 2015 ≤≤ t

( )1516913.3078.362)16( −+=v

sm /69.393=

Then

∫16

11

)( dttv = ))16(78.362(2

1516)78.362)11((2

1115 vv +−

++−

=

)69.39378.362(2

1516)78.36219.254(2

1115+

−++

−=

m2.1612=

Method 3: Polynomial Interpolation to find 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 through the data. Using polynomial interpolation, our

resulting velocity function is (refer to notes on direct method of interpolation) ( ) .2010,37637.0740.17001.12 2 ≤≤++= ttttv

Page 4: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.4

Now, we simply take the integral of the quadratic within our limits, giving us

( )∫ ++≈16

11

237637.0740.17001.12 dttts

16

11

32

337637.0

2740.17001.12 ⎥

⎤⎢⎣

⎡++=

ttt

( ) ( ) ( )3322 11163

37637.011162740.171116001.12 −+−+−=

m3.1604= Method 4: Spline Interpolation to find the velocity profile

Fitting quadratic splines (refer to notes on spline method of interpolation) through the data

obtains the following set of quadratics ,704.22)( ttv = 100 ≤≤ t

,88.88928.48888.0 2 ++= tt 1510 ≤≤ t

,61.14166.351356.0 2 −+−= tt 2015 ≤≤ t

,55.554956.336048.1 2 +−= tt 5.2220 ≤≤ t

,13.15286.2820889.0 2 −+= tt 305.22 ≤≤ t

The value of the integral would then simply be

∫∫ +=16

15

15

11

)()( dttvdttvs

( ) ( )∫∫ −+−+++≈16

15

215

11

2 61.14166.351356.088.88928.48888.0 dtttdttt

16

15

2315

11

23

61.141266.35

31356.088.88

2928.4

38888.0

⎥⎦

⎤⎢⎣

⎡−+

−+⎥

⎤⎢⎣

⎡++= tttttt

( ) ( ) ( )

( ) ( ) ( )151661.1411516266.351516

31356.0

111588.8811152928.41115

38888.0

2233

2233

−−−+−−

+

−+−+−=

m9.1595=

Example 2

Page 5: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.5

What is the absolute relative true error for each of the above four methods if the above data in

Table 1 was actually obtained from the velocity profile of

⎟⎠

⎞⎜⎝

⎛−⎥⎦

⎤⎢⎣⎡

−= t

ttv 8.9

2100140000140000ln2000)( , where v is given in m/s and t in s.

Solution

The distance covered between t=11 and t=16 is

∫ ⎟⎟⎠

⎞⎜⎜⎝

⎛−⎥⎦

⎤⎢⎣⎡

−=

16

11

8.92100140000

140000ln2000 dttt

s

m9.1604=

Method 1:

The approximate value obtained using average velocity method was 1845.3 m, hence, the absolute relative true error, t∈ , is

%1009.1604

3.18459.1604×

−=∈t

%979.14=

Method 2:

The approximate value obtained using the trapezoidal rule was 1604.9 m, hence, the absolute relative true error, t∈ , is

%1009.1604

2.16129.1604×

−=∈t

%455.0=

Method 3:

The approximate value obtained using the direct polynomial was 1604.3 m, hence, the absolute relative true error, t∈ , is

%1009.1604

3.16049.1604×

−=∈t

%037.0=

Method 4:

The approximate value obtained using the spline interpolation was 1595.9m, hence, the absolute relative true error, t∈ , is

%1009.1604

9.15959.1604×

−=∈t

%561.0=

Page 6: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.6

Table 2: Comparison of Discrete Function Methods of Numerical Integration

Method Value t∈

Average Velocity 1845.3 14.979%

Trapezoidal Rule 1612.2 0.455%

Polynomial Interpolation 1604.3 0.037%

Spline Interpolation 1595.9 0.561% Appendix Trapezoidal Rule for Discrete Functions with Unequal Segments For a general case of a function given at n data points ( )( )11 , xfx , ( )( )22 , xfx , ( )( )33 , xfx , ….., ( )( )nn xfx , , where, nxxx ,.....,, 10 are in an ascending order,

the approximate value of the integral ( )dxxfnx

x∫

1

is given by

( ) ( ) ( ) ( )

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )2

.......22

......

11

3223

2112

1

3

2

1

11

nnnn

x

x

x

x

x

x

x

x

xfxfxxxfxfxxxfxfxx

dxxfdxxfdxxfdxxfn

n

n

+−++

+−+

+−≅

+++=

−−

∫∫∫∫−

This approach uses the trapezoidal rule in the intervals [ ]21 , xx , [ ]32 , xx , ….., [ ]nn xx ,1− and then

adds the obtained values.

Page 7: 07.06 - Integrating Discrete Function

INTEGRATING DISCRETE FUNCTIONS 07.06.7

Example

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

Table 1: 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

( ) ( ) ( ) ( ) ( ) ( )dttvdttvdttvdttvdttvdttv ∫∫∫∫∫∫ ++++=− 30

5.22

522

20

20

15

15

10

10

0

30

0

( ) ( ) ( ) ( ) ( ) ( )2

151010152

100010 vvvv +−+

+−=

( ) ( ) ( ) ( ) ( ) ( )2

5.2220205.222

20151520 vvvv +−+

+−+ ( ) ( ) ( )

2305.225.2230 vv +

−+

( ) ( )2

78.36204.22752

04.227010 ++

+= ( ) ( )

297.60235.5175.2

235.51778.3625 +

++

+

( )2

67.90197.6025.7 ++

4.56429.1399325.220055.14742.1135 ++++= m375.11852=

Can you find the value of ( )∫20

10

dttv ? Can you find the value of ?)(20

10∫ dttv