Difference between revisions of "W1292 Useful Randomness"
From Coder Merlin
(Created page with "thumb|Random Bitmap == Prerequisites == == Research == * [https://en.wikipedia.org/wiki/Random_number_generation Random Number Generation] * [http:/...") |
|||
Line 9: | Line 9: | ||
== Background == | == Background == | ||
[[File:Unit circle 3.svg|300px|Unit circle 3]]</br> | [[File:Unit circle 3.svg|300px|Unit circle 3]]</br> | ||
The value of | The value of π can be calculated by: | ||
# Randomly throwing "darts" at a unit circle | # Randomly throwing "darts" at a unit circle | ||
# Counting the total number of "darts", ''N'' | # Counting the total number of "darts", ''N'' | ||
# Counting the number of "darts" that fall within the unit circle, ''C'' | # Counting the number of "darts" that fall within the unit circle, ''C'' | ||
# | # The ratio of the area inside the circle to the total area is C/N | ||
# The value of π is four times this value (because the area of the total square is 2 units x 2 units) | |||
== Exercises == | == Exercises == |
Revision as of 14:09, 25 March 2019
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Prerequisites[edit]
Research[edit]
Background[edit]
The value of π can be calculated by:
- Randomly throwing "darts" at a unit circle
- Counting the total number of "darts", N
- Counting the number of "darts" that fall within the unit circle, C
- The ratio of the area inside the circle to the total area is C/N
- The value of π is four times this value (because the area of the total square is 2 units x 2 units)
Exercises[edit]
- Estimate the value of π by performing the above experiment
- Throw 100 darts. What result do you obtain?
- Throw 1000 darts. What result do you obtain? How is this different from your previous result?
- How many digits are you able to accurately estimate π by varying N?
- How important is it that the dart be "thrown" randomly?