estimate_pi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
estimate_pi [2018/10/02 22:37] – cthiel | estimate_pi [2018/10/02 23:09] (current) – cthiel | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Darts can be thrown at random points onto a square | + | Start with a square and draw a circle inside with the same diameter as the square. |
- | Below is graphical representation. | + | Below is a program that has graphical representation. |
{{ :: | {{ :: | ||
- | It takes a while to run this simulation to determine an approximate value for π. Wright a program using a '' | ||
- | This works since the ratio of the Area of a circle divided by the Area of the square is pi*r^2 | + | [[https://mathorama.com/pisim.mov|{{: |
+ | It takes a while to run this simulation to determine an approximate value for π. Write a simple text only program that uses a '' | ||
+ | |||
+ | 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.1538534224.txt.gz · Last modified: 2018/10/02 22:37 by cthiel