User Tools

Site Tools


estimate_pi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
estimate_pi [2018/10/02 22:37] cthielestimate_pi [2018/10/02 23:08] cthiel
Line 1: Line 1:
-Darts can be thrown at random points onto 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 π.  +Start with a square and draw a circle inside with the same diameter as the square.  Darts can be thrown at random points onto this square. If the dart lands inside the circle, it counts as a hit.  The proportion of hits to tries is one quarter of π.  
  
-Below is graphical representation.+Below is a program that has graphical representation.
  
 {{ ::estimatepi.java |}} {{ ::estimatepi.java |}}
  
-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.  
  
-This works since the ratio of the Area of a circle divided by the Area of the square is pi*r^2 (2r)^2 = pi/4The ratio of the darts that land in the circle of radius 1 divided by the darts in the area of the square should be the same ratio, pi/4 (if we throw enough random darts!)So 4 times this proportion is pi!+[[https://mathorama.com/pisim.mov|{{:screen_shot_2018-10-02_at_7.52.17_pm.png}}]]
  
 +It takes a while to run this simulation to determine an approximate value for π.  Write a program using a ''for'' loop or a ''while'' loop that can run 100,000 dart throws more quickly. 
 +
 +This works since the ratio of the Area of a circle divided by the Area of the square is pi*r^2 / (2r)^2 = pi/4. The ratio of the darts that land in the circle divided by the darts thrown on the square should be the same ratio, pi/4 (if we throw enough random darts!). So 4 times this proportion is pi!
estimate_pi.txt · Last modified: 2018/10/02 23:09 by cthiel

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki