hn.today

Monte-Carlo Simulations

eli.thegreenplace.net8 points0 comments
Screenshot of Monte-Carlo Simulations

Monte Carlo simulation uses randomness and the Law of Large Numbers to estimate quantities that are hard to compute analytically. A simple example is estimating π by throwing random (x,y) darts at a unit square and counting hits inside the inscribed quarter circle; the hit ratio times four approximates π, but error falls only like 1/√N so high precision requires huge sample sizes (the post notes ~10 billion samples for four-decimal reliability). Monte Carlo excels at numerical integration and high-dimensional problems. It also handles intractable combinatorics: with the 81-card game SET, there are C(81,12)=70,724,320,184,700 twelve-card hands and Knuth found 2,284,535,476,080 have no set, giving a 3.23% chance; a 10 million-run Monte Carlo reproduced 0.0323, and the same approach estimates the 15-card no-set probability at about 0.00037.

Monte Carlo is indispensable for financial projections because averages hide sequence risk and volatility. A naive deterministic model with 4% nominal return and 2% inflation gives a ~1.96% real return and would deplete $1M after ~55 years when withdrawing $30k/year, but stochastic simulations tell a different story. Running 1,000,000 trials that draw returns and inflation from realistic distributions shows wide variation: 25% of scenarios exhaust funds by ~22 years and only about 60% last 30 years, revealing substantially higher risk than the simple average implies. All code for the examples is available on GitHub.

Read on eli.thegreenplace.net0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Science

Butlerian Jihad

Butlerian Jihad

The Butlerian Jihad refers to a historical or fictional event involving the uprising against intelligent machines or AIs. It is a significant theme in science fiction, notably in the Dune universe, where humanity fights to prevent the rise of autonomous AI systems. (dune.fandom.com)

Nine-Inch Snails

Nine-Inch Snails

Giant African land snails measuring up to nine inches have been invading Florida, raising concerns about their environmental impact. These invasive snails are known for their voracious appetite and potential to carry parasites harmful to humans and native wildlife. (theatlantic.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.