Un Peu de Math... : Using Monte Carlo Simulation For The Estimation of Pi
Un Peu de Math... : Using Monte Carlo Simulation For The Estimation of Pi
Un Peu de Math... : Using Monte Carlo Simulation For The Estimation of Pi
Un peu de math...
My name is Vince Knight and I'm a lecturer in Operational Research at Cardiff University with interests in game theory
and queueing theory. I'll be using this blog to post about various things mainly including math and software...
www.vincent-knight.com
Posts
Using Monte Carlo Simulation for the Estimation of Pi
Comments
A while ago on G+, +Sara Del Valle posted a link to this article The 12 Most Controversial Facts
In Mathematics. Whether or not the title of that article is precise is a whole other question but one
of the problems in there discusses the use of probability to estimate π. Google+ Followers
Vincent Knight
At the time I wrote a small python script to randomly generate points (this approach of continuous
random sampling is called Monte Carlo simulation) that lie in a square of length 2r. If we let S be Add to circles
the total number of points and C to be the points that lie in an inscribed circle of radius r then:
2
πr
P (point in circle) =
2
4r
Google+ Badge
Vincent Knight
Follow
Blog Archive
► 2011 (3)
► 2012 (12)
▼ 2013 (51)
► January (7)
Using this if we generate a high enough number of points we can estimate P(point in circle). We ► February (2)
generate a point (x, y) and check if that point is in the circle by checking if x2 + y 2 ≤ r2 . Using
► March (3)
all this we get:
► April (6)
π ≈
4C
▼ May (6)
S
Results from
my online
This morning I've modified the script slightly so that it generates a few more plots:
version of
If the relevant option is set it will generate a new plot for every single plot; the two
thirds o...
A plot of the estimate of π as a function of the number of points.
Using Monte
Here's a plot of the estimate of π: Carlo
Simulation
for the
Estimation
of...
Counting semi
magic
squares
using
generating
funct...
Student
choices
between
SAS and R
Probability of
saying 'yes'
http://drvinceknight.blogspot.com/2013/05/using-monte-carlo-simulation-for.html 1/3
9/10/2018 Un peu de math...: Using Monte Carlo Simulation for the Estimation of Pi
to academic
responsibi...
Student
choices
between
SAS and R
in teaching
pres...
► June (4)
► August (2)
► September (7)
► October (6)
► November (4)
► December (4)
► 2014 (25)
The main point of me changing this was to put together this screencast that describes the
process:
If it's of interest the github repo with the code is available here.
On a related note, here's another video I put together a while back showing the basic process
that can be used to simulate a queueing process:
http://drvinceknight.blogspot.com/2013/05/using-monte-carlo-simulation-for.html 2/3
9/10/2018 Un peu de math...: Using Monte Carlo Simulation for the Estimation of Pi
1 comment
Top comments
+1 1 · Reply
http://drvinceknight.blogspot.com/2013/05/using-monte-carlo-simulation-for.html 3/3