CSCE 206 1 Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.

Slides:



Advertisements
Similar presentations
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Advertisements

Generating Random Numbers
Monte Carlo Methods and Statistical Physics
Random variables 1. Note  there is no chapter in the textbook that corresponds to this topic 2.
Random Number Generation. Random Number Generators Without random numbers, we cannot do Stochastic Simulation Most computer languages have a subroutine,
Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007.
Random Numbers In today’s lesson we will look at: why we might want a random number whether they really are random how to create and scale random numbers.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Random number generation Algorithms and Transforms to Univariate Distributions.
Session 4 Asymmetric ciphers.
Random Number Generators. Why do we need random variables? random components in simulation → need for a method which generates numbers that are random.
Sampling Attila Gyulassy Image Synthesis. Overview Problem Statement Random Number Generators Quasi-Random Number Generation Uniform sampling of Disks,
CSCE Review—Fortran. CSCE Review—I/O Patterns: Read until a sentinel value is found Read n, then read n things Read until EOF encountered.
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),
1 Random Number Generation H Plan: –Introduce basics of RN generation –Define concepts and terminology –Introduce RNG methods u Linear Congruential Generator.
Random Numbers Dick Steflik. Pseudo Random Numbers In most cases we do not want truly random numbers –most applications need the idea of repeatability.
Pseudorandom Number Generators
Statistics.
Distinguishing Features of Simulation Time (CLK)  DYNAMIC focused on this aspect during the modeling section of the course Pseudorandom variables (RND)
K. Desch – Statistical methods of data analysis SS10
1 A Novel Binary Particle Swarm Optimization. 2 Binary PSO- One version In this version of PSO, each solution in the population is a binary string. –Each.
Elementary Data Types Scalar Data Types Numerical Data Types Other
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Random numbers in Python Nobody knows what’s next...
1 Simulation Modeling and Analysis Pseudo-Random Numbers.
Properties of Random Numbers
Stevenson and Ozgur First Edition Introduction to Management Science with Spreadsheets McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies,
Random Number Generation Fall 2013
ETM 607 – Random Number and Random Variates
Simulation of Random Walk How do we investigate this numerically? Choose the step length to be a=1 Use a computer to generate random numbers r i uniformly.
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.
Randomized Algorithms (Probabilistic algorithm) Flip a coin, when you do not know how to make a decision!
Monte Carlo Simulation and Personal Finance Jacob Foley.
Chapter 14 Randomized algorithms Introduction Las Vegas and Monte Carlo algorithms Randomized Quicksort Randomized selection Testing String Equality Pattern.
Section 8.1 Estimating  When  is Known In this section, we develop techniques for estimating the population mean μ using sample data. We assume that.
Random-Number Generation Andy Wang CIS Computer Systems Performance Analysis.
CS433 Modeling and Simulation Lecture 15 Random Number Generator Dr. Anis Koubâa 24 May 2009 Al-Imam Mohammad Ibn Saud Islamic University College Computer.
© 2003, Carla Ellis Simulation Techniques Overview Simulation environments emulation exec- driven sim trace- driven sim stochastic sim Workload parameters.
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.
Pseudorandom Number Generation on the GPU Myles Sussman, William Crutchfield, Matthew Papakipos.
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:
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Monte Carlo Methods.
Experimental Method and Data Process: “Monte Carlo Method” Presentation # 1 Nafisa Tasneem CHEP,KNU
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.
Outline of Chapter 9: Using Simulation to Solve Decision Problems Real world decisions are often too complex to be analyzed effectively using influence.
APPENDIX D R ANDOM N UMBER G ENERATION Organization of chapter in ISSO* – General description and linear congruential generators Criteria for “good” random.
Great Theoretical Ideas in Computer Science.
Loops Wrap Up 10/21/13. Topics *Sentinel Loops *Nested Loops *Random Numbers.
Monte Carlo Process Risk Analysis for Water Resources Planning and Management Institute for Water Resources 2008.
Validating a Random Number Generator Based on: A Test of Randomness Based on the Consecutive Distance Between Random Number Pairs By: Matthew J. Duggan,
Random numbers in C++ Nobody knows what’s next....
The man who knew 28% of mathematics. John Von Neumann ( ) Hans Bethe: Academic seminars (10.
R ANDOM N UMBER G ENERATORS Modeling and Simulation CS
G. Cowan Lectures on Statistical Data Analysis Lecture 5 page 1 Statistical Data Analysis: Lecture 5 1Probability, Bayes’ theorem 2Random variables and.
MA/CSSE 473 Day 09 Modular Division Revisited Fermat's Little Theorem Primality Testing.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
Module 9.2 Simulations. Computer simulation Having computer program imitate reality, in order to study situations and make decisions Applications?
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.
Probabilistic Algorithms
Parallel Programming in C with MPI and OpenMP
Random Number Generators
DSS & Warehousing Systems
Lecture 2 – Monte Carlo method in finance
Computing and Statistical Data Analysis Stat 3: The Monte Carlo Method
Computer Simulation Techniques Generating Pseudo-Random Numbers
Presentation transcript:

CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle physics Interactions (e.g., biological) in which the level of response is variable “Monte Carlo” as in throwing dice to determine outcomes

CSCE Random Numbers We don’t really want random numbers, we want “pseudorandom” numbers, because we want reproducible results in experiments. We want numbers that behave the way that random numbers would, but that are produced in a deterministic way. What do we mean by “behave the way that random numbers would”?

CSCE Random Numbers (2) What do we mean by “behave the way that random numbers would”? If the numbers run 0.0 to 1.0, then 1/n of them should fall into any interval of length 1/n Similarly for 2 dimensions, 3 dimensions, etc. Shouldn’t be able to predict the next from the previous, or the next from the two previous, or the next from the three previous, etc. But we don’t want to require that the numbers be exactly evenly balanced either… NIST has a set of standard statistical tests

CSCE Random Numbers (3) The RNG should generate the same numbers regardless of the machine used Different sequences of random numbers should come from different “seed” values The RNG should use minimal CPU and memory

CSCE Random Numbers (4) RNGs usually produce integers that are uniformly distributed in the range of 1 to some maximum value M We want a maximal period, i.e., M distinct integers before a repetition We convert to reals, uniformly distributed in the range 0.0 to 1.0, by dividing by M (with appropriate mode conversion) We convert to reals with some chosen probabilistic distribution by using the random numbers in the distribution function

CSCE Congruential Random Number Generators Consider powers of 2 modulo 13, say Power N = = =5 4 16= = =1 2**12 = 1 modulo 13

CSCE Congruential RNGs (2) (Fermat’s Little) Theorem: If p is a prime number, and a is any integer, then a**(p-1) = 1 modulo p So the 2**12 = 1 mod 13 is not a coincidence Observation: The sequence of values assumed as we power up is more or less random among the values from 1 through p-1 This would be called a multiplicative congruential random number generator

CSCE Congruential RNGs (3) Choose a prime p Choose a multiplier a Choose an addend b Compute x n+1 = (a*x n + b) modulo p If done correctly, then we get all the numbers 1 through p-1 before we repeat

CSCE Congruential RNGs (4) Subprogram Subprogram for your assignment For a long time it was highly useful that 2**31 – 1 was a prime The “usual” 2s complement arithmetic for 32-bit words worked out nicely, so the whole multiplicative congruential stuff required no extra effort

CSCE Lagged Fibonacci Generators Fill an array of values X j for j = 1, …, N (Note this means N seeds, not just one) Compute X j = X j-m + X j-n, for m,n < N “Fibonacci” because the series looks sort of like a Fibonacci series F n+2 = F n+1 + F n “Lagged” from looking at the subscripts

CSCE Parallel RNGs For a very large Monte Carlo computation, we might need lots of random numbers We don’t want to have to compute these sequentially (very slow) Lagged Fibonacci RNGs allow at least N at a time to be computed in parallel Parallel RNGs are still an active research topic.

CSCE The End

CSCE Difference and Differential Equations The derivative of a function is the rate of change of that function A differential equation is an equation involving a derivative If one is driving at constant velocity, then the velocity is the rate of change of position dx/dt = v Starting at position zero, and travelling at velocity v for t time units, one travels v*t distance

CSCE Euler’s Method dy/dt = f(y,t) (the differential equation) y(0) = y 0 (the initial condition) Approximate dy/dt by Δy/Δt = (y i+1 – y i )/ Δt = f(y i,t i ) so y i+1 = y i + Δt * f(y i,t i ) This is called Euler’s method. If we can compute the function f(y,t), then we can step forward a solution of the differential equation from time 0 to time whatever. In essence, approximate the function by trapezoids.

CSCE The End