estimate_pi
This is an old revision of the document!
Darts can be thrown at random points onto the square with corners (1,1) and (−1,−1). If the dart lands inside the unit circle (that is, the circle with center (0,0) and radius 1), it is a hit. Otherwise it is a miss. The proportion of hits to tries is one quarter of π.
Below is graphical representation.
It takes a while to run this simulation to determine an approximate value for π. Wright a program using a for
loop or a while
loop that can run 100,000 dart throws more quickly.
estimate_pi.1538533869.txt.gz · Last modified: 2018/10/02 22:31 by cthiel