 # Calculation of Pi using Simulation and Other Approximations

Mar. 6, 2019
Abigail Jacobsen Published: Mar. 6, 2019 Just for fun, here we talk about using Monte Carlo simulation to estimate the value of π (3.14159…).

A circle of radius one will have area equal to π, and a square drawn around that circle will have area 4. When centered at the origin the circle has the equation x^2+y^2=1. Therefore if one were to conduct a simulation in which:

• Random samples of x and y are drawn from a uniform continuous distribution between minus one and one
• At each draw it is tested whether the sum of the squares of the two variables is less than one, and a record kept as to whether this is the case
• At the end of the simulation the frequency with which this is the case will approximate π/4.

(When using @RISK software for decision making under uncertainty to do the above, the easiest way is to simply using the RiskMean Statistics function to calculate the mean of the result of the 1/0 logical check as to whether the draw is inside or outside the circle).

Some other trivia about π are:

• In 1896, the Indiana state legislature was in the process of passing a bill to decree that π should be equal to 3.2. Following a presentation to the lawmakers by a mathematics professor, it was decided to defer the final voting to a later date (which is still outstanding).
• The true figure is of course one that is infinite and without repetition or other known patterns.
• Some approximations include the ratios 377/120 (3.14166…developed in 2 B.C. and accurate to 4 decimal places), and 355/113 (3.1415929…, developed in 5 A.D. good to 6 places)
• The Excel Pi() function lists the value as 3.14159 26535 89790 which is inaccurate in the last listed decimal place (the true value being 3.14159 26535 89793 ….) i.e. to 15 places.
• The problem of calculating π to an arbitrarily large number of decimal places is essentially solved and only restricted by time and money. Already billions of places have been calculated and there seems little practical purpose in pursuing this further.
• Perhaps one of the most simple yet bizarre formula involving π and other fundamental quantities in mathematics is exp(iπ)+1=0, where i is the imaginary number corresponding to the square root of minus 1. Just for fun, here we talk about using Monte Carlo simulation to estimate the value of π (3.14159…).

A circle of radius one will have area equal to π, and a square drawn around that circle will have area 4. When centered at the origin the circle has the equation x^2+y^2=1. Therefore if one were to conduct a simulation in which:

• Random samples of x and y are drawn from a uniform continuous distribution between minus one and one
• At each draw it is tested whether the sum of the squares of the two variables is less than one, and a record kept as to whether this is the case
• At the end of the simulation the frequency with which this is the case will approximate π/4.

(When using @RISK software for decision making under uncertainty to do the above, the easiest way is to simply using the RiskMean Statistics function to calculate the mean of the result of the 1/0 logical check as to whether the draw is inside or outside the circle).

Some other trivia about π are:

• In 1896, the Indiana state legislature was in the process of passing a bill to decree that π should be equal to 3.2. Following a presentation to the lawmakers by a mathematics professor, it was decided to defer the final voting to a later date (which is still outstanding).
• The true figure is of course one that is infinite and without repetition or other known patterns.
• Some approximations include the ratios 377/120 (3.14166…developed in 2 B.C. and accurate to 4 decimal places), and 355/113 (3.1415929…, developed in 5 A.D. good to 6 places)
• The Excel Pi() function lists the value as 3.14159 26535 89790 which is inaccurate in the last listed decimal place (the true value being 3.14159 26535 89793 ….) i.e. to 15 places.
• The problem of calculating π to an arbitrarily large number of decimal places is essentially solved and only restricted by time and money. Already billions of places have been calculated and there seems little practical purpose in pursuing this further.
• Perhaps one of the most simple yet bizarre formula involving π and other fundamental quantities in mathematics is exp(iπ)+1=0, where i is the imaginary number corresponding to the square root of minus 1.