From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that

Similar documents
Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky

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

CNH3C3 Persamaan Diferensial Parsial (The art of Modeling PDEs) DR. PUTU HARRY GUNAWAN

Math 345 Intro to Math Biology Lecture 21: Diffusion

16. Working with the Langevin and Fokker-Planck equations

Today: Fundamentals of Monte Carlo

Preliminary statistics

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

Random Number Generators

19 : Slice Sampling and HMC

Review of Statistical Terminology

DUBLIN CITY UNIVERSITY

A simple algorithm that will generate a sequence of integers between 0 and m is:

2008 Winton. Review of Statistical Terminology

Topics covered so far:

Statistical Methods for Astronomy

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

Brownian Motion and The Atomic Theory

REVIEW: Waves on a String

Basics on Probability. Jingrui He 09/11/2007

Monte Carlo Methods. PHY 688: Numerical Methods for (Astro)Physics

Systems Simulation Chapter 7: Random-Number Generation

Lecture 3: From Random Walks to Continuum Diffusion

Sampling Distributions Allen & Tildesley pgs and Numerical Recipes on random numbers

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006

Lecture 2 : CS6205 Advanced Modeling and Simulation

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

Chapter 3. Random Process & Partial Differential Equations

Lecture 15 Random variables

Slides 3: Random Numbers

Random Walks A&T and F&S 3.1.2

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

Lecture notes on Regression: Markov Chain Monte Carlo (MCMC)

Today: Fundamentals of Monte Carlo

Methods of Data Analysis Random numbers, Monte Carlo integration, and Stochastic Simulation Algorithm (SSA / Gillespie)

AMath 483/583 Lecture 26. Notes: Notes: Announcements. Notes: AMath 483/583 Lecture 26. Outline:

Monte Carlo and cold gases. Lode Pollet.

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

functions Poisson distribution Normal distribution Arbitrary functions

Potentials of Unbalanced Complex Kinetics Observed in Market Time Series

2 Random Variable Generation

Copyright 2001 University of Cambridge. Not to be quoted or copied without permission.

Statistical Methods in Particle Physics

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

Monte Carlo Simulations

Monte Carlo methods for kinetic equations

Monte Carlo Methods. Part I: Introduction

Random Variate Generation

UNIT 5:Random number generation And Variation Generation

Advanced Monte Carlo Methods Problems

Sampling Distributions Allen & Tildesley pgs and Numerical Recipes on random numbers

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

EXPERIMENT 17. To Determine Avogadro s Number by Observations on Brownian Motion. Introduction

The dynamics of small particles whose size is roughly 1 µmt or. smaller, in a fluid at room temperature, is extremely erratic, and is

2 Functions of random variables

Scientific Computing: Monte Carlo

1 Brownian motion and the Langevin equation

B.N.Bandodkar College of Science, Thane. Random-Number Generation. Mrs M.J.Gholba

Reduction of Variance. Importance Sampling

Monte Carlo integration (naive Monte Carlo)

t = no of steps of length s

In this approach, the ground state of the system is found by modeling a diffusion process.

2. Molecules in Motion

16 : Markov Chain Monte Carlo (MCMC)

Random Number Generation. CS1538: Introduction to simulations

Today: Fundamentals of Monte Carlo

Fractals. Mandelbrot defines a fractal set as one in which the fractal dimension is strictly greater than the topological dimension.

Monte Carlo (MC) Simulation Methods. Elisa Fadda

Enrico Fermi and the FERMIAC. Mechanical device that plots 2D random walks of slow and fast neutrons in fissile material

Cheng Soon Ong & Christian Walder. Canberra February June 2018

Math Stochastic Processes & Simulation. Davar Khoshnevisan University of Utah

7.1 Coupling from the Past

Markov Chain Monte Carlo Lecture 1

Quiz 1. Name: Instructions: Closed book, notes, and no electronic devices.

Class 12. Random Numbers

Hands-on Generating Random

Grade: The remainder of this page has been left blank for your workings. VERSION D. Midterm D: Page 1 of 12

Lecture 11: Non-Equilibrium Statistical Physics

The Monte Carlo Algorithm

3.320 Lecture 18 (4/12/05)

Numerical integration and importance sampling

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

University of Washington Department of Chemistry Chemistry 453 Winter Quarter 2005

2905 Queueing Theory and Simulation PART IV: SIMULATION

Statistical Methods in Particle Physics

STA 256: Statistics and Probability I

Monte Carlo Integration. Computer Graphics CMU /15-662, Fall 2016

ISyE 3044 Fall 2017 Test #1a Solutions

Markov Processes. Stochastic process. Markov process

Multiple Random Variables

ECONOMICS 207 SPRING 2006 LABORATORY EXERCISE 5 KEY. 8 = 10(5x 2) = 9(3x + 8), x 50x 20 = 27x x = 92 x = 4. 8x 2 22x + 15 = 0 (2x 3)(4x 5) = 0

Math RE - Calculus II Antiderivatives and the Indefinite Integral Page 1 of 5

1 INFO Sep 05

Brownian motion and the Central Limit Theorem

Uniform Random Number Generators

IEOR 3106: Introduction to Operations Research: Stochastic Models. Professor Whitt. SOLUTIONS to Homework Assignment 2

Chapter 2. Some Basic Probability Concepts. 2.1 Experiments, Outcomes and Random Variables

Math 1270 Honors ODE I Fall, 2008 Class notes # 14. x 0 = F (x; y) y 0 = G (x; y) u 0 = au + bv = cu + dv

Random Number Generation. Stephen Booth David Henty

Statistical Thermodynamics and Monte-Carlo Evgenii B. Rudnyi and Jan G. Korvink IMTEK Albert Ludwig University Freiburg, Germany

Transcription:

From Random Numbers to Monte Carlo Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that

Random Walk Through Life Random Walk Through Life If you flip the coin 5 times you will probably be about five steps away from where you started. This is because five times five equals 5. A random walk is not a very fast way to get anywhere! When you try this, you will notice that sometimes you go much farther than you expect and sometimes you end up very close to where you started. But if you repeat it many times or get several of your friends to do it with you with coins of their own, the average distance should come out as expected. In science we can often predict what will happen on the average even when the process is random.

Random Walk: From Physics to Wall Street A random process consisting of a sequence of discrete steps of fixed length: vary greatly depending on the dimension in which the walk occurs and whether it is confined to a lattice. The random thermal perturbations in a liquid are responsible for a random walk phenomenon known as Brownian motion. The collisions of molecules in a gas are a random walk responsible for diffusion.

For over half a century financial experts have regarded the movements of markets as a random walk - unpredictable meanderings akin to a drunkard's unsteady gait - and this hypothesis has become a cornerstone of modern financial economics and many investment strategies: markets were "weakform efficient", implying that past prices could not be used to forecast future prices changes. Lo and MacKinlay find that markets are not completely random after all, and that predictable components do exist in recent stock and bond returns.

Einstein (1905): Kinetic Theory of Brownian Motion Brownian motion -> The random walk motion of small particles suspended in a fluid due to bombardment by molecules obeying a Maxwellian velocity distribution (J. Ingenhousz 1785; Brown 188). Brownian trajectories are continuous, but of infinite length between any two points. dv m = αv + F t α = πηa m xx x xx xf t dt ɺ ɺ = α ɺ + d d m ( xxɺ ) = m xxɺ = m xɺ α xxɺ + xf( t) d dt ( ), 6 ( ) ( ) 1 1 kt 1 γt α xf( t) = x F( t) = 0, xɺ = kt, x = t (1 e ), γ α = γ m 1 kt t 1 ktt t γ x =, t γ x = m 3πη a kt t πη a r = 3 x r = = D t

Monte Carlo Methods: Not one, but many Any method that solves a problem by generating suitable random numbers and observing that fraction of the numbers obeying some property or properties. The method is useful for obtaining numerical solutions to problems which are too complicated to solve analytically. It was named by S. Ulam, who in 1946 became the first mathematician to dignify this approach with a name, in honor of a relative having a propensity to gamble. Nicholas Metropolis: Metropolis algorithm in Statistical Physics among the top 10 algorithms having the "greatest influence on the development and practice of science and engineering in the 0th century."

Random Numbers in Computers? Uniform distribution of pseudo-random numbers x ( ax b) mod m n+ 1 = n + can be generated by this linear congruential generator. Here a, b and m are carefully chosen fixed integers, a is the multiplier, b is the increment and m is the modulus. The starting value x 0 is called the seed. The random number in the interval [0, 1] is x / m n. Hence there are at most m random uniformly distributed numbers: P ( x ) = 1 if x [0,1] P ( x ) = 0 if x [0,1]

Is the distribution really uniform? Knut s ran3.c or ran3.for portable generator (it does not employ linear congruential method!):

Non-uniform distributions Transformation method: y = f ( x) dx Px ( x) dx = Py ( y) dy Py ( y) = Px ( x) = C dy y 1 ( ) ( ) ( ) ( ) x = F y = P y dy y x = F x 0 dx dy

Example: Exponential Deviates Transformation method: y = ln( x) P ( y) = e y, 0 y y

Non-uniform Distributions: Transformation Method Transformation method does not always work: 1 y Py ( y) = exp π y dx 1 y 1 t = exp x = exp dt dy π π y( x) No analytical expression for in the case of Normal Distribution!

Non-uniform Distributions: Rejection Method Suppose we have a comparison function f ( x) with the properties: P( x) < f ( x) x, f ( x) dx < Now suppose we can choose a random point in two dimensions that is uniformly distributed in the area under the comparison function f ( x). If the point lies outside the area under P( x) then reject it and choose again. Otherwise, accept the point. The accepted points are uniformly distributed in the accepted area.

Rejection Method Summarized

x 0 Rejection Method in Practice Choose a comparison function whose indefinite integral is known analytically and is analytically invertible, i.e., you can find x such that : f ( x ') dx ' = z Let A be the total area under f(x). Pick a uniform random number 0 < α < A. Then find x so that: x 0 f ( x ') dx ' = α Now pick a random number y between 0 and f(x). Accept x if y<p(x), reject otherwise.

P x x x x Rejection Method: Example ( ) = 30 (1 ), 0 1 40 1 x, 0 x 9 f ( x) = 40 1 (1 x), x 1 9

Monte Carlo Integration The most common application of the Monte Carlo method is Monte Carlo integration (extension of the rejection method). b a Y NIN f ( x) dx ( b a) Y N [ a, b] TRIALS > max f ( x) In order to integrate a function over a complicated domain D, Monte Carlo integration picks random points over some simple domain D which is a superset of D, checks whether each point is within D, and estimates the area of D (volume, n-dimensional content, etc.) as the area of D multiplied by the fraction of points falling within D.

Ultra Classic Example: A circle A standard example is to use the Monte Carlo method to find the area of a circle and hence determine a value for. π b a N b a f ( x) dx f ( xi ) N 1 1 1 1 i= 1 N 4 π = p( x, y) dxdy p( xi, yi ) N p( x, y) + = 0, otherwise 1, x y 1 i= 1

Monte Carlo Integration: Error Estimate Suppose we pick N random points uniformly distributed in a multidimensional volume V: x, x,, x. Then the 1 n basic theorem of Monte Carlo integration estimates the integral of a function as: f ( x) f ( x) dv f V ± V 1 1 f = f x f = f x N N N ( ), i ( i ) i = 1 N i = 1 f N f σ General Theory of Statistical Errors: 1 N trials = ( Ii I ) ( Ntrials 1) i= 1 S S I I = N σ N 1/ trials

Monte Carlo Integration: A Sphere The same basic method can be used to find the volume of a sphere: 1 / N The accuracy of this Monte Carlo method is proportional to. tria ls Hence a large number of random points is needed to get high accuracy. However, Monte Carlo integration is faster than Simpson s rule in 4 or more dimensions. It is also easy to program and is useful for evaluating and 3 dimensional integrals with complex boundaries.

Random Walk in 1D In a one-dimensional random walk, the walker can move along a straight line in either the positive direction or the negative direction. Here we will assume that steps are of unit length and that the walker can move in either direction with equal probability. x x n n = 0 t In this case the most likely distance from the starting point after n steps is 0. The plot shows the distribution of positions (both positive and negative) for 100,000 walkers after 100 steps. The distribution is normal (Gaussian) with standard deviation 10.

Random Walk in 1D Explained To see why the variance behaves this way, let during i-th step:. s = ± 1 s i be the change in position This property is characteristic of random walks and diffusion processes in any number of dimensions. i x n = n i= 1 s i n n n n n n n = i j = i j = i j i= 1 j= 1 i= 1 j= 1 i= 1 j= 1 x s s ss ss i = j s = s ss = 1 i j i j i j ss = 0 i j n n n n i j i i i= 1 j= 1 i= 1 x = ss = ss = n

From Random Walk to Diffusion To see the connection between random walks and diffusion processes, consider the probability p(m,n) that a walker is at position m after n steps. To get to position m, the walker must be at position m-1 or position m+1 at the previous step. In either case, the probability that it moves to position m is 0.5. 1 p( m, n) = [ p( m+ 1, n 1) + p( m 1, n 1) ] 1 p( m, n) p( m, n 1) = p( m+ 1, n 1) p( m, n 1) + p( m 1, n 1) [ ] p p = D t x Letting the time step and the spatial step become infinitesimally small leads to a diffusion equation.

Self-Avoiding Random Walk A self-avoiding walk is a path from one point to another which never intersects itself. Such paths are usually considered to occur on lattices, so that steps are only allowed in a discrete number of directions and of certain lengths. α α r 1.4, d = = 1.5, d = 3 1.15, d = 4 t 1 < < SAW can model coiling up of links in a polymer chain. α