◄ WORLD V · SONNY 5DART 588 · a helldive into the living

THE GILLESPIE ALGORITHM chemistry, molecule by molecule

When molecule counts are small — a few copies of a gene, a handful of signaling proteins — averages lie and randomness rules. Gillespie’s stochastic simulation gets it exactly right: from each reaction’s propensity (rate × how many ways it can happen), draw when the next reaction fires (τ = ln(1/r)/atotal) and which one (weighted by propensity). No time-steps, no approximation — the true trajectory of a noisy chemical world.

THE TECHNIQUE τ = ln(1/r) / atotal ; pick by propensity

The demo computes reaction propensities and the next-reaction time from the total propensity: live demo


HISTORY & CREDIT Daniel Gillespie · 1976

“Gillespie is just a faster ODE solver.” — it is exact for the discrete stochastic system, capturing noise that deterministic rate equations erase. cited

propensity · each reaction’s ai = rate × reactant combinations.
when & which · time to next τ = ln(1/r)/atotal; the reaction chosen in proportion to its propensity.
1976 · Daniel Gillespie — exact stochastic kinetics.

The exact trajectory of a random chemistry. algorithm

RECOMMEND FOR I-13 the propensities, on the compiler

On i-13 (ln via series), propensities a₁=60, a₂=20 give atotal=80 and a short next-reaction time:

$ i13 run lf_gillespie-algorithm.i13 RUN OK · 988 step(s) · call depth 42 a1=60 a2=20 a_total=80 tau = 0.0173 -- ln(1/r)/a_total, faster when busier reaction1_more_likely = 1
Recommend as a NULL — propensities pinned (B39) + the draw is entropy (B47). The propensities and τ-formula are pinned; the actual reaction chosen needs a random number (non-reproducible, B47). NULL — chemistry, molecule by molecule.