40
PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

  • View
    225

  • Download
    9

Embed Size (px)

Citation preview

Page 1: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

PROBABILITY AND STATISTICS

ENGR 351 Numerical Methods for Engineers

Southern Illinois University Carbondale

College of EngineeringDr. L.R. Chevalier

Page 2: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Copyright© 1999 by Lizette R. Chevalier

Permission is granted to students at Southern Illinois University at Carbondaleto make one copy of this material for use in the class ENGR 351, NumericalMethods for Engineers. No other permission is granted.

All other rights are reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means,electronic, mechanical, photocopying, recording, or otherwise, withoutthe prior written permission of the copyright owner.

Page 3: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Why statistics in a course on numerical methods?

• Inputs on models are typically variable and uncertain– media specific

• hydraulic conductivity

• organic carbon content

• wind speed

– receptor specific

• body weight

• ingestion rate

– chemical specific

• Henry’s law constant

• decay rate

• toxicity values

– landuse specific

• industrial

• commercial

Page 4: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Why statistics in a course on numerical methods?

• Inputs on models are typically variable and uncertain

• Best represented by probability distributions• Tools for estimating values • Quantifying uncertainty• Tool for risk assessment

Page 5: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Random Variables

• Discrete – variable can only attain a finite number of

values.

• Continuous – variable can be from zero to infinity.

Page 6: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Probability

Probability of Occurrencenumber of successestotal number of trials

mn

nmn

lim

Page 7: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

The following properties are associated with probability.

1. Probability is a nonnegative number.

2. If an event is certain, then m and n are equal and p(x) = 1

3. Mutually exclusive

p(A+B) = p(A) + p(B)

In other words, the probability of A or B is the sum of the probability of either event. For example, the probability of 2 or 4 on the throw of a dice is:

p(2) + p(4) = 1/6 + 1/6 = 1/3

Page 8: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

4. If events are independent

p(AB) = p(A) . p(B)

The occurrence of one does not affect the occurrence of the other. For example, the probability that 2 and 4 will occur in two dice simultaneously thrown is:

p(2,4) = p(2) . p(4) . 2

= (1/6) . (1/6) . (2)

= 1/18

Page 9: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Density FunctionThe density function is defined as the function which yields the probability that the random variable takes on any one of its values.

Density function for a continuous random variable

Prob

abil

ity

of O

ccur

renc

ep(

x) =

f(x

)

x

Page 10: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

# on dice

f(x)

1/6

Density function for a discrete random variable

Page 11: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Cumulative Distribution Function, F(x)

F(x

)

x

Continuousfunction

Allows us to determinethe probabilitythat x is less thanor equal to a

Page 12: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

For a continuous variable

F x a F a p x dx f x dx P x aa a

( ) ( ) ( ) ( ) ( )

For a discrete variableF x a p x p x p a( ) ( ) ( ) ( ) 1 2

Page 13: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

F(x)

1

5/6

2/3

1/2

1/3

1/6

0 1 2 3 4 5 6

# on dice

Cumulative distance: Discrete function

Page 14: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

f x dxa

( )0F x a can be as( ) : expressed

F x a p x

where x a

i

a

i

( ) ( )

which is the area underthe densityfunction

Prob

abil

ity

of O

ccur

renc

ep(

x) =

f(x

)

xa

Page 15: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Samples and Populations

• Sample- a random selection of items from a lot or population in order to evaluate the characteristics of the lot or population– mean– expected value– variance

Page 16: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Mean or Expected Value

E x xf x dx( ) ( ) .

E x x p xii

n

i( ) ( )1

continuous

discrete

In the case of a discrete sample, is thisthe mean?

Page 17: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Example:Expected value on dice

E x x p xii

( ) ( )

.

1

6

116

216

316

416

516

616

35

...end of problem

Page 18: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Example: Let x = # of hours of a light bulb. Find the expected life.

E x xx

dx( ) (,

)20 000

3100

f x xx

elsewhere( )

,

20 000100

0

3

E x xf x dx( ) ( ) .

Page 19: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Example (cont.)

E x xx

dx( ) (,

)20 000

200

3100

...end of problem

f x xx

elsewhere( )

,

20 000100

0

3

Page 20: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

VarianceDescribes the “spread” or shape of thedistribution

0 1 2 3 41 2 3

Page 21: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

2 2 2 E x x f xx

[( ) ] ( ) ( ) discrete

( ) ( )x f x dx 2continuous

The following equations describe the discrete and continuous cases for variance.

Page 22: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Example: Let x = number of orders received per day

Probability density function: Company A

x 1 2 3

f(x) 0.3 0.4 0.3

Probability density function: Company B

x 0 1 2 3 4

f(x) 0.2 0.1 0.3 0.3 0.1

Page 23: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Probability density function: Company A

E x( ) ( . ) ( . ) ( . )

.

1 0 3 2 0 4 3 0 3

2 0

x 1 2 3

f(x) 0.3 0.4 0.3

Probability density function: Company B

x 0 1 2 3 4

f(x) 0.2 0.1 0.3 0.3 0.1

E x( ) ( . ) ( . ) ( . ) ( . ) ( . )

.

0 0 2 1 01 2 0 3 3 0 3 4 01

2 0

Page 24: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

VarianceCompany A

Company B

2 2 2 21 2 0 3 2 2 0 4 3 2 0 3

0 6

( ) ( . ) ( ) ( . ) ( ) ( . )

.

2 2 2 2

2 2

0 2 0 2 1 2 01 2 2 0 3

3 2 0 3 4 2 01

16

( ) ( . ) ( ) ( . ) ( ) ( . )

( ) ( . ) ( ) ( . )

.

0 1 2 3 41 2 3

...end of problem

2 2

( ) ( )x f x dx

Page 25: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Third momentmeasure of asymmetry

+ -

If symmetricS= 0

Often referred to as skewness, s

( ) ( )x f x dx

3

Page 26: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Fourth moment, measure of flatness

small kurtosis

large kurtosis

( ) ( )x f x dx

4

Page 27: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Monte Carlo Technique A technique for modeling processes that involve random variables.

You need:

• a random variable and its probability distribution• a sequence of random numbers

Page 28: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Suppose x is a random number that describes the demand per day of a commodity where:

f x

x

x

x

x

( )

.

.

.

.

01 0

0 2 1

0 4 2

0 3 3

Page 29: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Cumulative distribution function

F x

x

x

x

x

x

( )

.

.

.

.

0 0

0 1 0 1

0 3 1 2

0 7 2 3

10 3

Page 30: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

The task is to generate values of x (demand) such that the relative frequency of each value of k will be equal to its probability.

Need a sequence of random numbers

Will use the “MIDSQUARE” technique

Page 31: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Monte Carlo Method

1. Take a 4 digit number (preferably selected at random)

2. Square the number

3. Take 4 digits starting at the third from the left.

4. Record

5. Square -------- etc

Page 32: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

ie. Select 1653

(1653)2 = 53640976

Select 6409

1653, 6409, 0752, ......... 0 9999 x

Page 33: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

ENGR 351 Numerical Methods for EngineersRandom numbers

Monte Carlo ExcelUsing the random number function =rand()

6922 47914084 0.6922 0.351035 0.506976 0.0623719140 83539600 0.914 0.61144 0.223697 0.7550615396 29116816 0.5396 0.492761 0.143406 0.6614361168 1364224 0.1168 0.964795 0.597764 0.1696093642 13264164 0.3642 0.269986 0.851376 0.9441912641 6974881 0.2641 0.718226 0.571283 0.1097749748 95023504 0.9748 0.401943 0.77973 0.305236

235 55225 0.0235 0.953922 0.934942 0.937367552 304704 0.0552 0.301322 0.279323 0.095127

3047 9284209 0.3047 0.543647 0.44348 0.4534432842 8076964 0.2842 0.365798 0.632637 0.476239

769 591361 0.0769 0.909206 0.338302 0.3541585913 34963569 0.5913 0.851988 0.67051 0.3984659635 92833225 0.9635 0.238579 0.286329 0.5363368332 69422224 0.8332 0.585925 0.248756 0.5658834222 17825284 0.4222 0.454564 0.244167 0.7452738252 68095504 0.8252 0.375883 0.179672 0.540868

955 912025 0.0955 0.749491 0.766341 0.0751059120 83174400 0.912 0.25066 0.450009 0.8184041744 3041536 0.1744 0.172349 0.745362 0.753676

415 172225 0.0415 0.111162 0.407399 0.0645571722 2965284 0.1722 0.461135 0.274751 0.2277849652 93161104 0.9652 0.361817 0.543096 0.2820721611 2595321 0.1611 0.06993 0.956483 0.4380415953 35438209 0.5953 0.282377 0.829095 0.211325

average 0.454512 0.473998 0.516195 0.439272standard deviation 0.343788 0.260592 0.251293 0.280533

Page 34: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Recall that we are studying the following system:Suppose x is a random number that describes the demand per day of a commodity where:

f x

x

x

x

x

( )

.

.

.

.

0 1 0

0 2 1

0 4 2

0 3 3

Page 35: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

The “middle” digits are considered random. Since the study of demand requires 4 subsets.Using:

x Random0 0 - 999 (10%)1 1000 - 2999 (20%)2 3000 - 6999 (40%)3 7000 - 9999 (30%)

Number 7324 x = 3 6409 x = 2

Page 36: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

x Random0 0 - 9991 1000 - 29992 3000 - 69993 7000 - 9999 Random Ct.

#9140 35396 21168 13642 2

Total: 8

Page 37: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Example: Generate numbers with class

Probability of hydraulic conductivity

v Kdhdx

Soil samples at site:

K(cm/s) f(x)

10-5(silty sand)0.410-4 0.3510-3(sand) 0.1510-2 0.0710-1(gravel) 0.03

dept

h

Ground surface

Page 38: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Soil samples at site:

K(cm/s) f(x) Random #

10-5(silty sand)0.4 0-399910-4 0.35 4000 - 749910-3(sand) 0.15 7500 - 899910-2 0.07 9000 - 969910-1(gravel) 0.03 9700 - 9999

Page 39: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

Soil samples at site:

K(cm/s) f(x) Random #

10-5(silty sand) 0.4 0-399910-4 0.35 4000 - 749910-3(sand) 0.15 7500 - 899910-2 0.07 9000 - 969910-1(gravel) 0.03 9700 - 9999

Node Random # K (cm/s)(1,1)(2,1)(3,1)(4,1)(5,1)

Page 40: PROBABILITY AND STATISTICS ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier

end of lecture