Quantcast
Channel: Minitab | Minitab
Viewing all articles
Browse latest Browse all 828

A Simple Guide to Using Monte Carlo Simulation to Estimate Pi

$
0
0

Monte Carlo simulation has all kinds of useful manufacturing applications. And - in celebration of Pi Day - I thought it would be apropos to show how you can even use Monte Carlo simulation to estimate pi, which of course is the mathematical constant that represents the ratio of a circle’s circumference to its diameter. For our example, let’s start with a circle of radius 1 inscribed within a square with sides of length 2.

We can then use Monte Carlo simulation to randomly sample points from within the square. More specifically, we can randomly sample points using a uniform distribution where the minimum is -1 and the maximum is +1:

Since:

Then the ratio of the two areas - we'll call it r - can be represented as:

Using Devize software to run Monte Carlo simulation with 1,000,000 iterations, we arrive at 0.785069. (Since Monte Carlo simulation uses random sampling, this number will not be exactly the same every time you run a simulation.)

Therefore, if we use the r value generated using Monte Carlo simulation, we have:

Solving for pi, we multiply 0.785069 * 4 which gives us an approximation for pi of 3.140276. And that is how we can use Monte Carlo simulation to estimate pi.


Viewing all articles
Browse latest Browse all 828


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>