Week 10 Notes: Random Processes

We study models that use random numbers to generate statistically predictable outcomes.  Examples include Monte Carlo methods and random walks on a lattice.  Many of the random walk models are described in Chapter 7 of An Introduction to Computer Simulation Methods.

Monte Carlo Estimation of PI

Imagine a square of width two and area four such that a circle of radius one is within its boundaries. Compute pairs of random coordinates (random points) that lie within the square. The fraction of points within the circle is an estimate of the ratio of the area of the circle to that of the square.  As the number of trials becomes large, four times this ratio should approach pi.  Why?

 

This simulation is an example of a Monte Carlo  method.  Monte Carlo methods can be used to estimate the area (volume) of an irregular object in any dimension.  Although this method is inefficient for low dimensions, it is very efficient for high-dimensional integrals and is often used in statistical mechanics models.

Problems

Modify the model so that multiple Monte Carlo steps are computed during each evolution step.

  1. Determine the error (the magnitude of the deviation from the exact answer) for Monte Carlo runs of n = 104 and 105, 106, and 107. Plot the log of the error versus log n. Does the error decrease with increasing n on the average?
  2. Estimate the value of pi using n = 100 points. Repeat for a total of 10 trials. Is the magnitude of the variation of your values of the same order as the error between the average value and the exact value? For a large number of trials, the error is estimated from the standard error of the mean, which approximately equals the standard deviation divided by the square root of the number of trials.

Related Models

The following EJS models use random numbers to generate statistically predictable outcomes.

Reference:

An Introduction to Computer Simulation Methods 3-ed by Harvey Gould, Jan Tobochnik, and Wolfgang Christian Addison-Wesley (2007) pages 421-424, ISBN: 0-8053-7758-1.

Credits:

The Monte Carlo Pi Model was created by Wolfgang Christian using the Easy Java Simulations (Ejs) modeling tool.  It is based on a Java program from An Introduction to Computer Simulation Methods.

 

You can examine and modify a compiled EJS model if you run the model (double click on the model's jar file), right-click within a plot, and select "Open Ejs Model" from the pop-up menu.  You must, of course, have EJS installed on your computer.  Information about Ejs is available at: <http://www.um.es/fem/Ejs/> and in the OSP comPADRE collection <http://www.compadre.org/OSP/>.