2017-03-14

Throwing Pi

It’s a Pi day!*
It is possible to calculate \Pi using nothing more elaborate than a dart board (and a couple of darts). Throwing darts at the circular target drawn on the board, we can take note how many hits did in fact fall within the circle, and how many hit the bounding box of the circle.
Since the area of the circle inscribed inside a square is \frac{\pi}{4} of that of the square, we can easily calculate \pi based on the number of hits and misses:
\pi\,=\,\frac{hits}{hits\,+\,misses}
Of course, this is a game invented for mathematicians, who can boast -among other things - of true randomness in their dart game. Being random is surprisingly hard for regular humans.
I made a little interactive gadget to simulate calculating \Pi using the dart board: https://rawgit.com/dagothar/pi-throw/master/index.html

Fig. 1. Throwing Pi.
You can now try your hand at the game. Simply click on the board to place the dart. You can make the computer throw the dart for you by clicking on Step. You can also launch a whole series using Start/Stop.
The method does not converge very quickly, and is prone to being slightly wrong about \Pi. You can help it to get the right result by placing the darts as it goes.



* At least in the uncivilized part of the world, where they put their months in front of the days: 3/14. We can’t have the \pi day the other way around though - could it be that they are right?

No comments:

Post a Comment