Tag Archives: pi_estimation

pi estimation

This project was put together quickly while waiting for a physics job to finish. It was an exercise to see how quickly I could make a useful page with my current setup on my website. Including time to research, write, upload, and test the page it took around 20 minutes.


Live page
GitHub repository


This page uses a Monte Carlo method to estimate π. This is a pure method in that it does not rely on knowledge of π to make the estimate, as some methods do. It throws random numbers in a two dimensional area and counts how many lie within the circle of radius \(1\) compared to a square of side \(2\).


Challenge: This was all about speed.
Solution: I already knew everything I needed to put this page together, so it was simply a matter of how quickly I did it. I’m quite happy with the end result of 1020 seconds. (Resolved)

Sample output

Sample Monte Carlo output
Sample Monte Carlo output