1. Computing Π (Pi) probablistically
Think of a square, with sides = 2, centered at the origin with a circle inscribed within the square. If you throw N darts that land in the square, some of them, M, will land inside of the circle. Since the area of the circle is pi r2 ( which is pi since r = 1) and the area of the square is 4, the ratio of the circle's area to the square's area is pi/4. M/N should approximate pi/4, so 4M/N should approximate pi.
Simulate the throwing of the darts and printout the approximate value of pi computed for various iterations such as 1000, 10,000, 100,000, 1,000,000 and 100,000,000 (if time allows (it should)).
Students succeed in their courses by connecting and communicating with an expert until they receive help on their questions

Consult our trusted tutors.