Handy Pi Day Code Code
Brought to you by:
davidhandy
File | Date | Author | Commit |
---|---|---|---|
.hgignore | 2015-03-15 | David Handy | [d1b370] Pi Day celebration programs |
LICENSE.txt | 2015-03-15 | David Handy | [6291a1] Add license file |
README.txt | 2015-03-15 | David Handy | [d1b370] Pi Day celebration programs |
piday-2015-grid.png | 2015-03-15 | David Handy | [9653f2] Sample output from Pi Day programs |
piday-2015-random.png | 2015-03-15 | David Handy | [9653f2] Sample output from Pi Day programs |
piday_2015_grid.py | 2015-03-15 | David Handy | [d1b370] Pi Day celebration programs |
piday_2015_random.py | 2015-03-15 | David Handy | [d1b370] Pi Day celebration programs |
Pi Day Celebration Programs =========================== piday_2015_random.py This program approximates PI graphically by plotting 2500 random points in a square and calculating the proportion of points that fall inside a circle inscribed inside the square to the total number of points. As the number of points increases, theoretically that proportion approaches PI / 4. piday-2015-random.png Sample output from piday_2015_random.py piday_2015_grid.py This program approximates PI graphically by plotting 2500 evenly-spaced points in a square and calculating the proportion of points that fall inside a circle inscribed inside the square to the total number of points. As the number of points increases, that proportion approaches PI / 4. piday-2015-grid.png Sample output from piday_2015_grid.py