
27 Apr
2008
27 Apr
'08
8:31 p.m.
By picking points randomly from a square one can calculate pi. Keep track of how many points from the square you pick lay in the inscribed circle. Supposing the square's edges are length 2, then the inscribed circle has radius 1. Thus the area of the circle is pi*r^2 = pi. The area of the square is 4. The ratio of points picked from the circle to the total number of picked points will converge to pi / 4. What is the best way to express this algorithm in Haskell? ry