Under the finance tag, the specimen is a bundle of simulated price paths. This post’s specimen carries the label specimen 0x4914 · brownian · μ=0.063 σ=0.323 n=38: an average return of 6.3% a year, a volatility of 32.3%, and 38 overlaid paths. It is the model the Black-Scholes formula rests on.
From Brownian to geometric Brownian
In 1900, Bachelier modelled the price of a government bond as Brownian motion: price changes are sums of small independent shocks, hence Gaussian. The model has an obvious flaw: the price can go negative. In 1959, Osborne proposed applying it not to the price but to its logarithm, which amounts to assuming that returns, rather than absolute changes, are stationary. This is geometric Brownian motion, the solution of the stochastic differential equation
where is a standard Brownian motion. Both parameters have a direct meaning:
- , the drift, is the mean instantaneous return: ;
- , the volatility, measures the size of the shocks: the standard deviation of the log return over a time is .
An exact solution
Itô’s lemma applied to brings out a correction:
The log price is a Brownian motion with drift, and follows a log-normal distribution. Since the increments of over disjoint intervals are independent and Gaussian with variance , the process can be simulated with no discretisation error at all:
An Euler scheme applied directly to would introduce a bias that only vanishes as ; here, the values at the grid times have exactly the right joint distribution, whatever the step. It is the textbook case of exact simulation (Glasserman, chapter 3).
The term has a visible consequence: the median of is , below the mean. A typical path grows more slowly than the average, which a few exceptional paths pull upwards. For this post’s specimen, : the core of the bundle is almost flat despite a 6.3% drift.
- path 1
- path 2
- path 3
- path 4
- median
- mean
The link with Black and Scholes
Black and Scholes assume precisely that the underlying follows this process. By building a riskless portfolio out of the option and the stock, they show that the price of a European call with strike and maturity does not depend on :
where is the normal cumulative distribution function and the risk-free rate. Everything happens as if the stock earned instead of : this is risk-neutral valuation. The log-normal distribution of is therefore the centrepiece of the formula. can also be recovered by Monte Carlo, averaging over a large number of paths like those of the specimen, with .
- simulation (20,000 draws)
- log-normal density
The model remains an idealisation. Real returns have fatter tails than the normal distribution and a volatility that changes over time; for a drawing these flaws do not matter, but they do when measuring risk.
From paths to a density field
The seed sets the specimen’s identity: uniform in , in and a horizon of 0.75 to 2.5 years. The secondary tags set the number of paths, between 12 and 40, the symmetry and the character ramp. All paths start from ; time runs along the horizontal axis and the log price up the vertical one, the usual scale for a long horizon. On the large full-screen frames, such as the home page’s, the engine first simulates 60% more time before the left edge (the burn variable below): the paths come in already spread out, and the bundle covers the whole width instead of starting from a point.
Each character column covers six simulation steps, so 720 steps for a 120-column banner. The heart of the loop is the exact discretisation above:
for (let k = 0; k < SUB; k++) {
const t = burn + c * SUB + k;
if (!mirror) z![t] = normal(rng);
s += drift + vol * (mirror ? -z![t] : z![t]);
if (s < a) a = s;
if (s > b) b = s;
}
For each path and each column, the engine keeps the lowest and highest log price reached, which gives a vertical segment, thickened by 0.35 row on each side so that a flat path stays visible. Each row it crosses gets an amount of ink equal to the share of its height that is covered. The vertical scale runs from the 1st to the 99th percentile of all values, plus a 6% margin, so that one extreme path does not flatten the others; strips under 8 rows zoom in on the central part, from the 30th to the 70th percentile. Finally, as for the attractors, the ink goes through a logarithm:
calibrated so that a lone path gives a light stroke and a third of the bundle gives the densest tone (the denominator is raised for narrow strips).
Antithetic variates
With probability 0.3, the paths come in pairs: the second gets the shocks of the first. On a log scale, the two are vertical mirror images on either side of the line : the bundle folds onto that slanted axis. This is the method of antithetic variates, a classic variance reduction technique in Monte Carlo, borrowed here for its visual effect.