Editing
Monte Carlo Methods
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Modeling 'The Pi Estimator' (Calculating Pi by throwing 'Random Darts'):''' <syntaxhighlight lang="python"> import random def estimate_pi(num_darts): """ Throws darts at a 1x1 square. A circle fits inside. The ratio of hits in the circle / total darts = Pi / 4 """ hits = 0 for _ in range(num_darts): x = random.random() y = random.random() # Distance from center (0.5, 0.5) if (x-0.5)**2 + (y-0.5)**2 <= 0.25: hits += 1 pi_est = 4 * (hits / num_darts) return pi_est # 100 darts (Low accuracy) print(f"Pi with 100: {estimate_pi(100)}") # 1,000,000 darts (High accuracy) print(f"Pi with 1,000,000: {estimate_pi(1000000)}") </syntaxhighlight> ; Monte Carlo Landmarks : '''The Manhattan Project''' β The first real use of Monte Carlo to "Simulate Neutron Diffusion" inside the first Atomic Bomb, because "Human math" couldn't handle the complexity. : '''Value-at-Risk (VaR)''' β The standard risk measure in Banks: "What is the maximum amount we can lose in 1 day with 99% certainty?" (Calculated using 10,000 Monte Carlo simulations). : '''Ray Tracing''' β How modern "Video Games" and "Movies" create realistic light. They "Shoot random rays of light" (Monte Carlo) into a scene and see what they hit. : '''AlphaGo''' β The AI that beat the Go champion. During the game, it would "Play 10,000 random games to the end" from every possible move to see which one "Usually" wins. </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information