Saved searches
Use saved searches to filter your results more quickly
Cancel Create saved search
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Simulation of Buffon’s Needle Problem as a Monte Carlo method for approximating pi
samuelyhunter/Buffon
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch branches/tags
Branches Tags
Could not load branches
Nothing to show
Could not load tags
Nothing to show
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Cancel Create
- Local
- Codespaces
HTTPS GitHub CLI
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
Latest commit message
Commit time
README.md
My second side project as I get a better handle on Python:
Buffon’s Needle Problem
A needle is randomly dropped on a floor made up of evenly spaced floorboards. Determine the probability that the needle lands on a line separating floorboards.
Either through clever integration or a combination of geometry and expectation, it can be shown that this probability is directly related to pi. In the special case of the floorboards being twice as wide as the length of the needles, the probability is simply 1/pi.
Thus, a simulation of Buffon’s Needle Problem can be used (although quite inefficiently) as a Monte Carlo method for approximating pi.
To adjust the parameters of the simulation, simply modify the global constants at the top of the python file.
I’ve only run the program up to 10,000 needles, although after a certain point the approximated value of pi doesn’t converge much at all; the error falls into a cycle of growth and reduction.
I first came across this problem in How Not to Be Wrong: The Power of Mathematical Thinking, by Jordan Ellenberg.
A more challenging variant to simulate is Buffon’s Noodle, but the results are similar.
About
Simulation of Buffon’s Needle Problem as a Monte Carlo method for approximating pi
Saved searches
Use saved searches to filter your results more quickly
Cancel Create saved search
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.
bukalapak / buffon Public archive
License
bukalapak/buffon
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch branches/tags
Branches Tags
Could not load branches
Nothing to show
Could not load tags
Nothing to show
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Cancel Create
- Local
- Codespaces
HTTPS GitHub CLI
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
При подготовке материала использовались источники:
https://github.com/samuelyhunter/Buffon
https://github.com/bukalapak/buffon