Skip to content

Latest commit

 

History

History
6 lines (4 loc) · 810 Bytes

README.md

File metadata and controls

6 lines (4 loc) · 810 Bytes

RhubarbPie

Rhubarb pie is great, but you know what's better? That's right, calculating Pi probabilistically! Enter Probab Pi...

Imagine a square board (square) on the wall. Hang a circular dart board (circle) on top of it, such that the centers of the square and of the circle coinside. The diameter of the circle is the same as the side of the square.

Start throwing darts at the board so that you cover the square in a uniform fashion. Count the number of darts that are inside of the circle and divide that number by the total number of darts. That ratio approaches the ratio of the corresponding areas. Since the radius of the circle is half the side of the square, the areas of the circle and the square are A_c = pi * side * side / 4 and A_s = side * side respectively and pi = 4 * A_c / A_s.