How it works

Monte Carlo methods were first developed by mathematicians to describe the probabilities of successfully defeating the odds on roulette wheels (with Monte Carlo being the name of the world-renowned gambling center in the principality of Monaco).  The first scientific application was in 1899 when Lord Rayleigh (Fig. 1) showed that a one-dimensional random walk without absorbing barriers could provide an approximate solution to a parabolic differential equation. 

 Today it is used extensively by physicists and biologists to describe behavior in large numbers of interactions, such as diffusion and Brownian motion.

        In the 1930’s, Andrey Kolmogorov (Fig. 2) showed the relationship between Monte Carlo methods and Markov stochastic processes.  He also would incorporate Monte Carlo techniques in solving extremely difficult integration problems in calculus.

        A Monte Carlo simulation works by taking random samples for a situation. You need a good random number generator to run a successful Monte Carlo simulation, or you will get unsatisfactory results. To get us started thinking about Monte Carlo simulations, consider the following demo.

Figure 1: Lord Rayleigh
Figure 2: Andrey Kolmogorov

Demo "Calculating Pi"

The first Monte Carlo simulation calculates a value for pi, one of our favorite dimensionless quantities.  Pi has been calculated out to an absurd number of digits, so it is extremely well-know.  That makes it a perfect quantity to calculate to test Monte Carlo methods.  This program (Fig. 3) uses a ¼ circle inscribed in a square to generate a ratio of the area inside the circle to the area of the square to calculate a value for pi.

Figure 3: NetLogo simulation for Calculating Pi

In the pi simulation, the turtle moves on a random walk across the NetLogo world space. Each time it stops inside the quarter-circle, it adds that area to all the other areas inside the circle it has landed on. It also counts the total areas it has landed on anywhere inside the square, then compares the areas inside the circle to all the areas to calculate pi.

Activity: Finding Pi

The computer simulation uses a quarter-circle inscribed in a square to calculate pi. You can use a full circle, and you don’t even need a computer to run your own Monte Carlo calculation for pi. Try it out for yourself!

Purpose:

Use Monte Carlo methods to calculate pi.

Equipment:

  • Graph paper

  • Carbon paper

  • Compass for drawing circles

  • Marble or steel ball bearing

  • Hard flooring surface

Procedure:

1. Draw a circle on the graph paper using the compass.

2. Draw a square enclosing your circle so the circle is now inscribed in the square.

Figure 4: Find Pi

3. Practice dropping the marble on the floor and catching it on the first bounce.

4. Place the carbon paper on the floor, carbon side up.

5. Place the graph paper on the carbon paper with your circle drawing facing down so you cannot see your circle inscribed in the square. Tape to floor.

6. Drop the marble onto the paper ten times. Try to scatter your drops evenly over the entire paper. (BE SURE you or your partner catches the marble BEFORE it bounces for best results. The marble should hit the paper only once per drop.)

7. Switch with your partner for ten drops.

8. Repeat until you have finished 100 total marble drops onto the paper.

Data Analysis:

The marble will leave a small black mark where it landed on the paper. These marks provide our data.

1. Pick up your paper and write down the number of marks inside the circle.

2. Write down the total number of marks inside the square.

3. Ignore drops that landed outside the square.

4. The area of a circle is A = π r2. The area of a square is A = (2r)2, since the height of the square is 2r . The ratio of the area of the circle to the area of the square is π /4. Calculate your value for pi.

Conclusions and Error Analysis:

1. Compare your results for pi to the known value. What is the percent error for your result?

2. If the whole class does this activity, combine class results and calculate the percent error for the class average.

3. Explain why you can ignore drops that landed outside the square.

4. Cite two specific sources of error.

5. Make two suggestions how you could modify the activity to get a more accurate value for pi, and explain why these modifications would give better results.

Demo "Numeric Integration"

The second Monte Carlo simulation finds the definite integral from zero to one for four different functions. In regular language this means simply that the simulation finds the area under a curve.

Figure 5: Numerical Intergation

Activity: Finding area under a line

Simple geometry can be used to find the area under a line, but a Monte Carlo approach works as well. Give this one a try!

Purpose:

Use Monte Carlo methods to area under a line.

Equipment:

·         Graph paper

·         Carbon paper

·         Ruler for drawing a line

·         Marble or steel ball bearing

·         Hard flooring surface

Procedure:

1. Draw a line on the graph paper using the rule.

2. Draw a square enclosing your line so the line falls within the square.

Figure 6: Numeric Integration

3. Practice dropping the marble on the floor and catching it on the first bounce.

4. Place the carbon paper on the floor, carbon side up.

5. Place the graph paper on the carbon paper with your circle drawing facing down so you cannot see your line inscribed in the square. Tape to floor.

6. Drop the marble onto the paper twenty times. Try to scatter your drops evenly over the entire paper. (BE SURE you or your partner catches the marble BEFORE it bounces for best results. The marble should hit the paper only once per drop.)

7. Switch with your partner for twenty drops.

8. Repeat until you have finished 200 total marble drops onto the paper.

Data Analysis:

The marble will leave a small black mark where it landed on the paper. These marks provide our data.

1. Pick up your paper and write down the number of marks under the line.

2. Write down the total number of marks inside the square. Ignore drops that landed outside the square.

3. The area under the line can be calculated by adding the area of rectangle A and triangle B (as shown). The ratio of the area under the line to the area of the square should give you the percentage of the square that’s found under the line.  In other words, the area under the line falls within the square.

Figure 7: Numeric Integration

Conclusions and Error Analysis:

1. Compare your results to the known value. What is the percent error for your result?

2. If the whole class does this activity, combine class results and calculate the percent error for the class average.

3. Cite two specific sources of error.

4. Make two suggestions how you could modify the activity to get a more accurate value for the area under the line, and explain why these modifications would give better results.

5. Calculus can also be used to calculate areas under lines (and curves and all kinds of interesting figures); read how calculus can do this and summarize the technique.

 

Monte Carlo methods – and there are a number of variations on the basic form – are one of the most important tools is statistical applications of mathematics to problems in physics, chemistry, and biology.  You will see this approach throughout the rest of the tutorials, and its power cannot be underestimated.  If you want to study randomness in biology, you’ve got to understand Monte Carlo methods.

How it works
Running the model
Try it
Find out more
Before you leave

 

 

Nome

University of Notre Dame
Notre Dame, Indiana 46556
Phone: 574-631-5000

 

Copyright © 2006 University of Notre Dame
Last modified: July 08, 2007 12:55 PM