Monte Carlo method for calculating Pi
A simulation using Excel to calculate Pi using random numbers. The idea is that the rand() function is used to define a random point in the unit square (0,0), (1,0), (1,1),(0,1). Pythagoras' rule is then used to determine the distance of the point from the origin and whether it lies within the unit circle centred on (0,0). This is done 5000 times and the numbers of points inside and outside of the circle are calculated.
The value of Pi is estimated from this using the formula (Pi/4)=(Number of points inside the circle)/(Total number of points).
The chart shows how the value of the estimate changes with the number of points - helps to emphasise the point that probability is to do with what happens in the long run. The value of the estimate should tend towards the horizontal line with the value of Pi.
The simulation can be repeated simply by pressing the Recalc (F9) key.
| Attachment | Size |
|---|---|
| Montepi.xls | 2.35 MB |
- Printer-friendly version
- Login or register to post comments








Recent comments
5 weeks 1 day ago
5 weeks 1 min ago
23 weeks 4 days ago
24 weeks 1 day ago
24 weeks 3 days ago
26 weeks 1 day ago
30 weeks 1 day ago
31 weeks 6 days ago
34 weeks 1 day ago
34 weeks 2 days ago