Monte Carlo simulation
A four-part guide to the method behind option pricing, A/B tests and clinical trial design - built from first principles, with playgrounds and a notebook you can run in the browser. Every part pairs a chapter to read with a section to run.
The beginner's guide
Part 1Monte Carlo simulation, explained from first principles
The engine · estimating pi · the law of large numbers · the square-root law · seeds
What Monte Carlo actually is, in one sentence - and how it differs from the bootstrap and MCMC. Throw darts at a quarter circle to estimate pi, watch the law of large numbers make randomness eat itself, then meet the square-root law that prices every simulation you will ever run. Two playgrounds, no install.
Part 2The recipe, and two real projects
Sampling any distribution · the five-step recipe · a valuation DCF · power by simulation
Turning uniform random numbers into any distribution you want, then the five-step recipe every simulation follows. Two complete projects: a valuation DCF rebuilt as a distribution of value rather than a single number, and statistical power derived by simulation instead of a formula. Plus the seven deadly sins.
The notebook for parts 1 and 2
Every piece of code from the beginner's guide, ready to run in your browser - no install, nothing to configure. Sections 2 to 5 match part 1: the dartboard, the law of large numbers watched live, standard errors and confidence intervals, and the seed experiments including the parallel trap. Sections 6 to 9 match part 2: building distributions from uniforms by hand, the valuation DCF, and the power study. Read a section here, run the matching one there.
The pro guide
Part 3Paths and options
Random walks · geometric Brownian motion · option pricing · Cholesky · copulas
What changes when time enters: random walks, geometric Brownian motion, and the option-pricing workflow certified against Black-Scholes. Then correlated inputs via Cholesky, and the dependence-modelling error that helped detonate 2008.
Part 4Beating the square-root law
Antithetic & control variates · importance sampling · quasi-Monte Carlo · MCMC
Every halving of the error bar quadruples the bill - unless you stop buying runs and start shrinking the variance. Antithetic and control variates, importance sampling for rare events, quasi-Monte Carlo, simulation studies run as real experiments, and the bridge to MCMC.
The notebook for parts 3 and 4
A second notebook, because the pro guide leans on all of the first one. Sections 1 to 3 match part 3: the path simulator and its three certification tests, the Black-Scholes benchmark, common random numbers, Cholesky and copulas. Sections 4 to 8 match part 4: the variance-reduction scorecard, importance sampling and its effective-sample-size collapse, Sobol sequences, the cluster trial, and the ten-line Metropolis. Every number quoted in parts 3 and 4 is this notebook's actual output - seeds fixed, so you reproduce them to the digit.
This guide is free and always will be. The app is how it stays that way - exam-style questions on the traps behind all of this, with worked answers, in English and French.
Get it on iPhone


