Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drvinceknight/geometryprobabilityandintegration
A repository for an outreach activity involving dice and integration
https://github.com/drvinceknight/geometryprobabilityandintegration
Last synced: about 1 month ago
JSON representation
A repository for an outreach activity involving dice and integration
- Host: GitHub
- URL: https://github.com/drvinceknight/geometryprobabilityandintegration
- Owner: drvinceknight
- Created: 2014-08-20T10:32:31.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-08-20T10:33:50.000Z (over 10 years ago)
- Last Synced: 2024-06-20T00:45:36.789Z (6 months ago)
- Language: TeX
- Size: 148 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Repo containing resources for an outreach activity aiming to use dice to get an estimate for an integral.
You can see a fully rendered version of this [here](http://www.vincent-knight.com/outreach/geometry_probability_and_pi/).
### Requirements:
Sufficient copies of the grid.pdf file and ten sided dice (depending on numbers students can be paired up).
### Instructions
The activity starts with a rather cryptic set of instructions:
1. Roll dice so as to obtain random coordinates for 10 points;
2. Place these points on the grid (don't worry where they go in the boxes);
3. Count the points that sit under the curve.Once this is done, ask the students what values they have obtained and if they know what this might be about?
Keep track of the numbers of the board and finally carry out a calculation over the total number of points.
### Explanations
As a group explain that probability of any given point landing under the curve is given by:
$$P(\text{point under curve})=\frac{\text{Area under curve}}{\text{Area of square}}$$
As the square is taken to have length 1 this gives:
$$P(\text{point under curve})=\text{Area under curve}$$
Our data however gives us an **estimate** of \\(P(\text{point under curve})\\):
$$P(\text{point under curve})\approx \frac{n}{N}$$
Thus we have:
$$\int_{0}^{1}1-x^2\approx \frac{n}{N}$$
At this point ask if what would make the experiment everyone did better? (Answer: more data).
### Code
Ideally some students might realise that another approach to doing this would be to get a computer to calculate this for us.
The following is some [Sage](http://sagemath.org/) code that will simulate the points and plot them as well:def simpoints(N=1000):
"""
Defines a function that will simulate N points
"""
points = [[random() , random()] for k in range(N)] # Create all our points
pointsundercurve = [k for k in points if 1 - k[0] ^ 2 >= k[1]] # Count the ones that are in the circle
p = list_plot(pointsundercurve, color='blue') # Plot the ones in the circle in blue
p += list_plot([k for k in points if k not in pointsundercurve], color='black') # Plot the others in black
p.show() # Show the plot
return len(pointsundercurve) / N # Return the approximated value of pisimpoints(1000) # Run the above for 1000 points