Random Number Generators.  Based upon specific mathematical algorithms  Which are repeatable and sequential.

Slides:



Advertisements
Similar presentations
Generating Random Numbers
Advertisements

Sensitivity Analysis In deterministic analysis, single fixed values (typically, mean values) of representative samples or strength parameters or slope.
Modeling and Simulation Monte carlo simulation 1 Arwa Ibrahim Ahmed Princess Nora University.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Planning under Uncertainty
Analyzing the Results of a Simulation and Estimating Errors Jason Cooper.
Random Number Generators. Why do we need random variables? random components in simulation → need for a method which generates numbers that are random.
Marakas: Decision Support Systems, 2nd Edition © 2003, Prentice-Hall Chapter Chapter 4: Modeling Decision Processes Decision Support Systems in the.
Introduction to experimental errors
Pseudorandom Number Generators
Chapter 14 Simulation. Monte Carlo Process Statistical Analysis of Simulation Results Verification of the Simulation Model Computer Simulation with Excel.
Lecture 10 Comparison and Evaluation of Alternative System Designs.
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Properties of Random Numbers
Determining the Size of
Inferential Statistics
Elec471 Embedded Computer Systems Chapter 4, Probability and Statistics By Prof. Tim Johnson, PE Wentworth Institute of Technology Boston, MA Theory and.
Fall 2011 CSC 446/546 Part 6: Random Number Generation.
1. Homework #2 2. Inferential Statistics 3. Review for Exam.
ETM 607 – Random Number and Random Variates
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
Determining Sample Size
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
Random Number Generators CISC/QCSE 810. What is random? Flip 10 coins: how many do you expect will be heads? Measure 100 people: how are their heights.
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Sullivan – Fundamentals of Statistics – 2 nd Edition – Chapter 5 Section 1 – Slide 1 of 33 Chapter 5 Section 1 Probability Rules.
Chapter © 2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or.
Monte Carlo Simulation and Personal Finance Jacob Foley.
General Principle of Monte Carlo Fall 2013 By Yaohang Li, Ph.D.
Monte Carlo and Statistical Methods in HEP Kajari Mazumdar Course on Particle Physics, TIFR, August, 2009.
1 Lesson 3: Choosing from distributions Theory: LLN and Central Limit Theorem Theory: LLN and Central Limit Theorem Choosing from distributions Choosing.
Random-Number Generation Andy Wang CIS Computer Systems Performance Analysis.
CPSC 531: RN Generation1 CPSC 531:Random-Number Generation Instructor: Anirban Mahanti Office: ICT Class Location:
Chapter 7 Random-Number Generation
Module 1: Statistical Issues in Micro simulation Paul Sousa.
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
Modeling and Simulation Random Number Generators
1 Lesson 8: Basic Monte Carlo integration We begin the 2 nd phase of our course: Study of general mathematics of MC We begin the 2 nd phase of our course:
P T A typical experiment in a real (not virtual) space 1.Some material is put in a container at fixed T & P. 2.The material is in a thermal fluctuation,
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Various topics Petter Mostad Overview Epidemiology Study types / data types Econometrics Time series data More about sampling –Estimation.
1 SMU EMIS 7364 NTU TO-570-N Inferences About Process Quality Updated: 2/3/04 Statistical Quality Control Dr. Jerrell T. Stracener, SAE Fellow.
Monte Carlo Methods in Statistical Mechanics Aziz Abdellahi CEDER group Materials Basics Lecture : 08/18/
Experimental Method and Data Process: “Monte Carlo Method” Presentation # 1 Nafisa Tasneem CHEP,KNU
Monte Carlo Methods Versatile methods for analyzing the behavior of some activity, plan or process that involves uncertainty.
Monte Carlo Methods So far we have discussed Monte Carlo methods based on a uniform distribution of random numbers on the interval [0,1] p(x) = 1 0  x.
Monte Carlo Process Risk Analysis for Water Resources Planning and Management Institute for Water Resources 2008.
Numerical Methods.
M ONTE C ARLO SIMULATION Modeling and Simulation CS
Lesson 4: Computer method overview
Relative Values. Statistical Terms n Mean:  the average of the data  sensitive to outlying data n Median:  the middle of the data  not sensitive to.
Simulation is the process of studying the behavior of a real system by using a model that replicates the system under different scenarios. A simulation.
Computer simulation Sep. 9, QUIZ 2 Determine whether the following experiments have discrete or continuous out comes A fair die is tossed and the.
Sampling and estimation Petter Mostad
CHAPTER 5 Simulation Modeling. Introduction In many situations a modeler is unable to construct an analytic (symbolic) model adequately explaining the.
Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering National Taiwan University 1/45 GEOSTATISTICS INTRODUCTION.
+ Chapter 5 Overview 5.1 Introducing Probability 5.2 Combining Events 5.3 Conditional Probability 5.4 Counting Methods 1.
R ANDOM N UMBER G ENERATORS Modeling and Simulation CS
Chapter 8: Probability: The Mathematics of Chance Probability Models and Rules 1 Probability Theory  The mathematical description of randomness.  Companies.
EMIS 7300 SYSTEMS ANALYSIS METHODS FALL 2005 Dr. John Lipp Copyright © 2005 Dr. John Lipp.
STROUD Worked examples and exercises are in the text Programme 10: Sequences PROGRAMME 10 SEQUENCES.
G. Cowan Lectures on Statistical Data Analysis Lecture 5 page 1 Statistical Data Analysis: Lecture 5 1Probability, Bayes’ theorem 2Random variables and.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
Chapter 3 Generating Uniform Random Variables. In any kind of simulation, we need data, or we have to produce them. Especially in Monte Marco simulation.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
Introduction to Instrumentation Engineering
Random-Number Generation
Lecture 2 – Monte Carlo method in finance
Quantitative Reasoning
Computer Simulation Techniques Generating Pseudo-Random Numbers
Presentation transcript:

Random Number Generators

 Based upon specific mathematical algorithms  Which are repeatable and sequential

Random  Truly Random –Exhibiting true randomness  Pseudorandom –Appearance of randomness but having a specific repeatable pattern  Quasi-random –Having a set of non-random numbers in a randomized order

Problems  Difficult to isolate –Often need to replace current generator –Require  Knowledge of current generator  Sometimes in-depth understanding of random number generators themselves  Large scale tests cause most problems –Needing sometimes millions or billions of random numbers

Desirable Properties  When performing Monte Carlo Simulations –Attributes of each particle should be independent of those attributes of any other particle –Fill the entire attribute space in a manner which is consistent with the physics

Random Number Cycle  Basis –sequence of pseudorandom integers  Some exceptions  Integers (“Fixed”) –Manipulated arithmetically to yield floating point (“real”)  Can be presented in either Integer or Real numbers

Cycle

What Does This Show Us?  Properties of pseudorandom sequences of integers –The sequence has a finite number of integers –The sequence gets traversed in a particular order –The sequence repeats if the period of the generator is exceeded

LCG  Most commonly used RNG –Linear Congruential Generator  Requires initial “seed” denoted as X0  Appears random because of Modulo function  Next “random” number depends heavily on previous X –Typical of linear, congruential generators –Restricts period

Equations - LCG

Using LCG  Choosing Correct Input is Key  LCG (a,c,m,X0) –LCG (5, 1, 16, 1)  Yields –  1,6,15,12,13,2,11,8,9,14,7,4,5,10,3,0,  1,6,15,12,13,2,11,8,9,14,…  When the next result depends upon only the previous integer, the longest period possible is P=M  Odd/Even pattern  lack of randomness results from using a power of two for M

Cycle LCG(5,1,16,1)

Table

Example #2  LCG(5,0,16,1) –Yields - 1,5,9,13,1,5,9,13,… – M is a power of 2 (here: 2^4)  C=0  Maximum period is going to be 2^(m-2) –Correlation (each differ by 4)

Cycle (5,0,16,1)

Prime Numbers  Using a prime as the divisor for the modulus can result in a period of m- 1 as maximum period  There are cases of prime moduli that fail bitwise testing  Case-by-case basis

Seed  Using the date and time –Enter the date and time into an equations and return an integer then make sure it is odd –Standard seed for these equations

Overflow & Negative Numbers  Using large values of a and large values of M are needed –Often 31 bits long  On 32 bit machines –A*M results in 62 bit number –Overflow  Can result in 32 nd bit being a negative

N-Tuple Generalization  Choose R1 and R2 –Choose Rn and R(n+1) –Then plot this point of interest in a surrounding area.  Plot these points in succession  The area will be uniformly covered by the LCG in a “random” order –Covering of only part of the unit or certain areas of the unit would prove to be not useful for Monte Carlo Methods

Embarrassingly Parallel'  Little or no interprocessor communication  Easy to code

N Streams  N Streams –N independent random numbers –N independent processes  Need to find N seeds far away from each other on the cycle

Find Seeds  Find Seeds –LCG rule successively applied:

Lagged Fibonacci Generators  Increasingly popular –Lags are k and l –M is power of 2  With proper choice of k and L  Period of Generator can be –[(2^L)-1] * [2^(m-1)]

LFG  Computationally simple –Integer add –Logical AND –Decrement of 2 array pointers –Must keep L words current in memory –LCG needs only one

LFG (cont)  LFG are an attempt to improve LCG  Similar to Combined LCG –Take 2 previous numbers in the sequence to produce a new number –Where p and q are the “lags” –Some arithmetic computation is performed –Then mod that answer for the next number

Monte Carlo Methods

Overview  Introduction  History  Examples  Applications  Real Life practices

Introduction  Define Monte Carlo Method –The Monte Carlo method is a numerical method for solving mathematical problems using stochastic sampling. –It performs simulation of any process whose development is influenced by random factors, but also if the given problem involves no chance, the method enables artificial construction of a probabilistic model.

Introduction cont…  Similarly, Monte Carlo methods randomly select values to create scenarios of a problem. These values are taken from within a fixed range and selected to fit a probability distribution [e.g. bell curve, linear distribution, etc.]. This is like rolling a dice. The outcome is always within the range of 1 to 6 and it follows a linear distribution - there is an equal opportunity for any number to be the outcome.

Introduction cont…  MC method is often referred to as the “method of last resort”, as it is apt to consume large computing resources;  Characteristics: –consuming vast computing resources –have historically had to be executed upon the fastest computers available at the time –and employ the most advanced algorithms – implemented with substantial programming acumen.

Introduction cont…  Major components of Monte Carlo methods: –Probability distribution functions –Random number generator –Scoring –Error estimation –Variance reduction techniques –Parallelization and vectorization

History  Where does Monte Carlo method come from? When? Who? –The name "Monte Carlo" comes from the city of Monte Carlo in the principality of Monaco, famous for its gambling house –Birth date of the Monte Carlo method is 1949, when an articale entitled "The Monte Carlo Method"( by N. Metropolis and S. Ulam ) appeared. –The American mathematicians J. Neyman and S. Ulam are considered its originators.

History cont…

 The theoretical foundation of the method had been known long before first articles were published.  Well before 1949 certain problems in statistics were sometimes solved by means of random sampling  However, simulation of random variables by hand is a laborious process  Use of the Monte Carlo method as a universal numerical technique became practical only with the advent of computers and high-quality pseudorandom number generators

History cont…  Buffon's needle problem –In 1768 Buffon, a French mathematician, experimentally determined a value of π by casting a needle on a ruled grid  Lord Rayleigh even delved into this field near the turn of the century.  Fredericks and Levy in 1928 showed how the method could be used to solve boundary value problems  Enrico Fermi in the 1930's used Monte Carlo in the calculation of neutron diffusion (involving nuclear reactors )

History cont…  In the 1940's, a formal foundation for the Monte Carlo method was developed by von Neumann (PDE)  Stanislaw Ulam realized the importance of the digital computer in the implementation of the approach from collaboration results of the work on the Manhattan project during World War II

Examples  Simple Example to Understand: computing the area of a plane figure S. –completely arbitary figure with a curvilinear boundary, given graphically or analytically, connected or consisting of several pieces –assume that it is contained completely within the unit square.

Examples cont… Figure S in the unit square, being covered with sampling points randomly

Examples cont…  Applying Randomness to the example: –Choose at random N points in the square and designate the number of points lying inside S by N'. It is geometrically obvious that the area of S is approximately equal to the ratio N'/N. The greater the N, the greater the accuracy of this estimate.

Examples cont…  Buffon's Needle: –A simple Monte Carlo method for the estimation of the value of π, –Assumptions:  Suppose you have a tabletop with a number of parallel lines drawn on it, which are equally spaced (say the spacing is 1 inch, for example).  Suppose you also have a pin or needle, which is also an inch long.

Examples cont…  Dropping needles on the tablet: –The needle crosses or touches one of the lines –The needle crosses no lines  Keep dropping this needle over and over on the table  Record the statistics. –Keep track of both the total number of times that the needle is randomly dropped on the table N, and the number of times that it crosses a line N’.

Examples cont…  Findings: –2N/N’= π –Because, the probability on any given drop of the needle that it should cross a line is given by 2/pi –After many tries, N/N’ will approach the probability number.

Applications  Monte Carlo methods can help in design and prediction of behavior of systems in nuclear applications and radiation physics  The use of MC in the area of nuclear power has undergone an important evolution. Notable are the extensions to compute burnup in reactor cores, and full core neutronic simulations.

Applications cont…  help researchers understand the probability of the occurrence of an adverse effect associated with exposures to chemicals. Monte Carlo sampling simulates the distribution of total exposures, by simulating random samples of factors associated with each exposure route and accumulating them to arrive at an individual total exposure.

Applications cont…  The use of MC methods to model physical problems allows us to examine more complex systems than we otherwise can. Solving equations which describe the interactions between two atoms is fairly simple; solving the same equations for hundreds or thousands of atoms is impossible. With MC methods, a large system can be sampled in a number of random configurations, and that data can be used to describe the system as a whole.

Applications cont…  Random numbers generated by the computer are used to simulate naturally random processes  many previously intractable thermodynamic and quantum mechanics problems have been solved using Monte Carlo techniques

Real Life Practice  Quantum Monte Carlo –The microscopic world is described by quantum mechanics. We need to use simulation techniques to “solve” many- body quantum problems. –Both the wavefunction and expectation values are determined by the simulations. –QMC gives most accurate method for general quantum many-body systems.

Real Life Practice cont… Weather Weather  Equipment Productivity  Soil Conditions Projects are often associated with a high degree of uncertainty resulting from the unpredictable nature of events

Real Life Practice cont…  Risk Analysis and Risk Management –Monte Carlo Simulation is a valuable modeling tool that generates multiple scenarios depending upon the data and the assumptions fed into the model. –Simulation calculates multiple scenarios by repeatedly inserting different sampling values from probability distribution for the uncertain variables into the computerized spread-sheet. –probability or percentage chance that a particular forecast value will fall within a certain specified range.

Why has the Monte Carlo method become so popular?  Analytic methods tend to be prohibitive (but some very difficult problems have finally been solved using MC)  Monte Carlo is somewhat intuitive (and several good books have now been written on the subject)  Computers continue to get faster and cheaper

Reference  onte.html onte.html onte.html  tml