Department of Electrical- and Information Technology. ETS061 Lecture 3, Verification, Validation and Input

Similar documents
Uniform random numbers generators

Random Number Generators

How does the computer generate observations from various distributions specified after input analysis?

z = log loglog

Generating Random Variables

CPSC 531: Random Numbers. Jonathan Hudson Department of Computer Science University of Calgary

Simulation. Where real stuff starts

4.5 Applications of Congruences

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring

Simulation. Where real stuff starts

B. Maddah ENMG 622 Simulation 11/11/08

Workshop on Heterogeneous Computing, 16-20, July No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo

5.6 Logarithmic and Exponential Equations

Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico

How does the computer generate observations from various distributions specified after input analysis?

Sources of randomness

Random processes and probability distributions. Phys 420/580 Lecture 20

Higher order derivatives of the inverse function

Number Systems III MA1S1. Tristan McLoughlin. December 4, 2013

Math 1b Sequences and series summary

Outline. Simulation of a Single-Server Queueing System. EEC 686/785 Modeling & Performance Evaluation of Computer Systems.

Algorithms and Networking for Computer Games

Monte Carlo Simulation

Review of Statistical Terminology

Exponential and. Logarithmic Functions. Exponential Functions. Logarithmic Functions

Notes on Continuous Random Variables

EEC 686/785 Modeling & Performance Evaluation of Computer Systems. Lecture 19

Note: Final Exam is at 10:45 on Tuesday, 5/3/11 (This is the Final Exam time reserved for our labs). From Practice Test I

Lecture 8: Conditional probability I: definition, independence, the tree method, sampling, chain rule for independent events

X 1 ((, a]) = {ω Ω : X(ω) a} F, which leads us to the following definition:

14 Random Variables and Simulation

Take the measurement of a person's height as an example. Assuming that her height has been determined to be 5' 8", how accurate is our result?

Monte Carlo Techniques

Lecture 2 : CS6205 Advanced Modeling and Simulation

JUST THE MATHS UNIT NUMBER 1.4. ALGEBRA 4 (Logarithms) A.J.Hobson

2008 Winton. Review of Statistical Terminology

Homework 3. (33-40) The graph of an exponential function is given. Match each graph to one of the following functions.

Computer Applications for Engineers ET 601

cse 311: foundations of computing Fall 2015 Lecture 12: Primes, GCD, applications

Lecture 1: Probability Fundamentals

Simulation. Version 1.1 c 2010, 2009, 2001 José Fernando Oliveira Maria Antónia Carravilla FEUP

cse 311: foundations of computing Spring 2015 Lecture 12: Primes, GCD, applications

Where do pseudo-random generators come from?

Topic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number

UNIT 5:Random number generation And Variation Generation

AP Calculus Chapter 9: Infinite Series

2 Random Variable Generation

Chapter 11 - Sequences and Series

Statistics and data analyses

Random numbers and generators

EM Waves in Media. What happens when an EM wave travels through our model material?

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds

functions Poisson distribution Normal distribution Arbitrary functions

Topics in Computer Mathematics

Stochastic Simulation of Communication Networks

Assume that you have made n different measurements of a quantity x. Usually the results of these measurements will vary; call them x 1

Measurement and Uncertainty. To determine the uncertainty associated with various measuring devices.

You separate binary numbers into columns in a similar fashion. 2 5 = 32

Errors: What they are, and how to deal with them

ECE 302: Probabilistic Methods in Electrical Engineering

Random number generation

Uncertainty and Bias UIUC, 403 Advanced Physics Laboratory, Fall 2014

Infinite series, improper integrals, and Taylor series

Objectives. Use the number e to write and graph exponential functions representing realworld

2905 Queueing Theory and Simulation PART IV: SIMULATION

Numerical Analysis and Computing

Chapter 1 Mathematical Preliminaries and Error Analysis

2DI90 Probability & Statistics. 2DI90 Chapter 4 of MR

Logarithmic, Exponential, and Other Transcendental Functions. Copyright Cengage Learning. All rights reserved.

3 Multiple Discrete Random Variables

Math 131, Lecture 20: The Chain Rule, continued

Poisson distribution and χ 2 (Chap 11-12)

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers

CSE 502 Class 11 Part 2

Population Changes at a Constant Percentage Rate r Each Time Period

Numerical Methods. Exponential and Logarithmic functions. Jaesung Lee

Slides 3: Random Numbers

Part I: Multiple Choice Questions

(Refer Slide Time: 01:17)

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

MATH 115, SUMMER 2012 LECTURE 12

Hand Simulations. Christos Alexopoulos and Dave Goldsman 9/2/14. Georgia Institute of Technology, Atlanta, GA, USA 1 / 26

Lecture 11 - Basic Number Theory.

Generating pseudo- random numbers

Introduction to Finite Di erence Methods

1 Maintaining a Dictionary

Numerical Methods Lecture 2 Simultaneous Equations

Chapter 7: Exponents

MATH 1A - FINAL EXAM DELUXE - SOLUTIONS. x x x x x 2. = lim = 1 =0. 2) Then ln(y) = x 2 ln(x) 3) ln(x)

MAS1302 Computational Probability and Statistics

CLASS-IX MATHEMATICS. For. Pre-Foundation Course CAREER POINT

Chapter 4. Continuous Random Variables

Math 5a Reading Assignments for Sections

Lecture 8: Decision-making under total uncertainty: the multiplicative weight algorithm. Lecturer: Sanjeev Arora

0.1 Motivating example: weighted majority algorithm

What is a random variable

YORK UNIVERSITY. Faculty of Science Department of Mathematics and Statistics. MATH C Test #1. October 23, 2013.

MAT 1320 Study Sheet for the final exam. Format. Topics

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

Pseudo-Random Generators

Transcription:

ETS061 Lecture 3, Verification, Validation and Input

Verification and Validation Real system Validation Model Verification Measurements

Verification Break model down into smaller bits and test each bit individually Examine the sanity of output, reasonable? Print parameters at end of program Have someone check the code Animate Compare with analytical results Little s theorem (for the queue example)

Little s theorem λ System N T N=λT A very general result!

Validation Often much more difficult than verification Talk to experts in the field Measure systems and compare results Can one find extremes, bounds? Should the system tend to 0 or infinity when the input changes?

Generating Random Variables

Very different ways have been used Manual methods (rolling a die etc.) Using tables of random numbers Irrational numbers, decimals of π etc. Physical systems, radioactive decay, vacuum tubes Computer real-time clock All methods have drawbacks

Properties of a good method The routine should be fast The routine should be portable to different computers The routine should have a long cycle The random number should be replicable The random number should have the right distribution The random numbers should be uncorrelated

von Neuman, ca 1950 Midsquare method Take a number with 4 digits Square the number Take the 4 digits in the middle as new number goto 1 Very bad method, short sequences before repetition

Pseudo-Random Numbers Definition: A sequence of pseudo-random numbers is a deterministic sequence of numbers having the same relevant statistical properties as a sequence of random numbers. The most widely used method of generating pseudorandom numbers are the congruential generators: for a multiplier a, shift c, and modulus M, all integers

Pseudo-Random Numbers The sequence is periodic, with maximum period M. The values of a and c must be carefully chosen to maximise the period of the generator, and to ensure that the generator has good statistical properties, e.g. M a c 2 59 13 13 0 2 32 69069 1 2 31-1 630360016 0 2 32 2147001325 715136305

Generating Arbitrarily Distributed rvs There is a theorem which says that, if F(x) is continuous, then F(X) is uniformly distributed on the interval (0,1). This can be used to generate random variables with other specified distributions.

Inverse Method 1,0000 Y~Uniform(0,1) 0,7500 0,5000 0,2500 0,0000 0 0.1 0.20.3 0.4 0.50.6 0.7 0.80.9 1 1.1 1.21.3 1.4 1.51.6 1.7 1.81.9 2 2.1 2.22.3 2.4 2.52.6 2.7 2.82.9 3 3.1 3.23.3 3.4 3.53.6 3.7 3.83.9 X~F(X)

Inverse Method Example Exponential Distribution (1 - e -λx ):

Gaussian Distribution No explicit inverse Approximate the inverse Sum of Uniforms is approximately Gaussian...

General Discrete Distribution Assume that we want to generate discrete random variables from a specified distribution, e.g. The inversion method reduces to searching for an appropriate index in a table of probabilities:

Example Inverse Method for Discrete RV s Assume that the required distribution is p0=0.5 p1=0.3 p2=0.2 Then if 0.0 U < 0.5 return X=0 if 0.5 U < 0.8 return X=1 if 0.8 U 1.0 return X=2 X=0 X=1 X=2 0 1

Table Method Generate a large array of size M, with elements 1 to Mp0 having the value 0, elements Mp0 +1 to Mp0 + Mp1 having the value 1, elements Mp0 + Mp1 +1 to Mp0 + Mp1 + Mp2 having the value 2, etc. Then generate a uniform integer rv X from 1 to M. The Xth element of the array is a rv with the required distribution. This algorithm is very fast to run, but this is achieved at the expense of often requiring the allocation of large amounts of storage for the arrays.

Example: Table Method Assume that the required distribution is p0=0.5, p1=0.3, p2=0.2 Then construct an array of size 10 where 5 elements are zero, 3 are 1, and 2 are 2, i.e. [0,0,0,0,0,1,1,1,2,2] Now sample uniformly from this array. To do this, generate a uniform integer rv distributed from 1 to 10. If the generated rv is X, choose the X th element of the array.

Example: Generating Truncated Poisson Distribution 0,2000 0,1500 0,1000 A=5 N=8 0,0500 0,0000 0 1 2 3 4 5 6 7 8

Example: Table Method Truncated Poisson distribution with A=5 and N=8 {p k }={0.0072, 0.0362, 0.0904, 0.1506, 0.1883, 0.1883, 0.1569, 0.1121, 0.0700} Construct an array of size (say) 10,000 where elements 1 to 72 have the value 0, elements 73 to 434 have the value 1, elements 435 to 1338 have the value 2, elements 1339 to 2844 have the value 3, elements 2845 to 4727 have the value 4, elements 4728 to 6610 have the value 5, elements 6611 to 8179 have the value 6, elements 8180 to 9300 have the value 7, elements 9301 to 10000 have the value 8. Now sample randomly from this array. The resulting rv will be approximately the required truncated Poisson.

Error analysis Almost all simulation models are approximations to some degree Major question: How does this affect the validity of my results? If I can t answer this question, what can I say about the results I get?

Boundary cases General strategy Identify worst and best cases Perhaps for sub-components of the large simulation get results for these cases and compare Especially, test parts where you know you have approximated

Error propagation Before statistical analysis (which captures stochastic nature) Have I got errors in input data? Have I rounded, approximated if so how much? Can I estimate the uncertainty in my model?

Example, estimate volume Use logarithmic transformation Old result derived from Taylor series yield: f(x) = f(x) dx x x<<x from this we can derive rules for estimating error propagation

Some examples x = a+b-c x = p a 2 + b 2 + c 2 x = a x b/c x = s 2 a + a 2 b + b 2 c c x = ln a x = x x

Estimating volume of a cylinder Measure radius and length, say: r =1cm, l =8cm, r =0.1cm l =0.05cm V = r 2 l = 25.13 q r 2 V = r + r r q 0.1 1 2 + 0.1 1 2 + 0.05 8 2 + l l 2 = 2 = =0.02

Generalisation A simulation collects results from a specific scenario What conclusions can we draw from this in the general case? Word of caution - don t generalize in general Think first, am I sure nothing will pop up I have not foreseen?

Next lecture Look at the statistical nature of measuring a stochastic process How can we estimate the error from this process How certain can we be that our result is an accurate reflection of reality?