Enrichment · STEM Explorations · How many random trials is enough
A Monte Carlo run estimates a probability by repeating a random experiment many times and counting successes. The estimate wobbles around the truth by about the square root of p times one minus p over the number of trials. Type the probability you expect, the trials, a z-score for your confidence and a scale (4 turns a quarter-circle hit rate into an estimate of pi). The page works out the error and the trials you need for a margin you choose.
The worked example is Darts in a quarter circle (78.54% hit) estimating pi with 10,000 trials at 95%, wanting plus or minus 0.01. Nothing you type leaves this browser.
Loading the calculator. If nothing appears, turn on JavaScript.
Each trial is a success or a failure, independent of the others. The example is made up.
Enrichment · STEM ExplorationsOpen to everyone · no sign-in
Error falls with the square root.
Each trial succeeds with probability p, independently. The count of successes is binomial, and the share of successes in n trials has standard error √(p(1 − p) ÷ n). For enough trials the estimate is close to normal, which is where the z-score comes from.
Throw points at random in a unit square. The share that land inside the quarter circle of radius 1 approaches pi ÷ 4. Multiply by 4 and the same error formula gives a margin on pi. About 100,000 trials are needed to pin pi to ±0.01 with 95% confidence, a slow way to find a number, which is the point.
Figures worked from your own numbers. Nothing you type is sent to Caveat. The worked example is made up. Your entries stay in this browser. Support: team@caveatacademic.com.