This applet is designed to approximate the value of pi. It accomplishes this purpose by firing random data points at a circle inscribed within a square. The probability of a data point landing within the circle is a ratio of the circle's area to the area of the square.
Where r equals the length of the radius of the circle, the area of the circle is then chr(960)*r*r. The diameter of the circle is the same as the length of each side of the square. Since the diameter of the circle, twice the radius, equals (2*r), the area of the square is equal to (2*r)*(2*r).
The probability of a point landing within the circle equals (chr(960)*r*r)/(2*r*2*r). By then performing algebra and removing (r*r) from the numerator and the denominator the simplified equation becomes P(landing in circle) = chr(960)/4.
Next, multiply both sides by 4.
Pi is now equivalent to four times the probability of a data point landing in the circle.
No related resources specified
Original Java Applet by Nick Exner (7/27/1998)
JavaScript+HTML5 Remake by Evan Ramos (2014)