Stochastic processes
Random walks, Markov chains, birth-death processes, and stochastic differential equations as models of noisy systems.
A bacterium divides once an hour on average and dies once every two hours. The rate equation for the colony says it grows exponentially from the first cell. Simulate the individual divisions and deaths instead, and 50.4 % of 20,000 colonies started from one cell die out, close to the ratio of death rate to birth rate that theory predicts. When numbers are small or the noise is the point, the state has to evolve at random. Chemists bring reactions inside a cell where some species number only a few dozen molecules, physicists Brownian particles and the Langevin equation, geologists earthquake catalogs as Poisson processes, engineers structures shaken by turbulent wind or a rough road.
Python has no single standard library for this, and needs none. A random walk is a cumulative sum of draws from numpy.random.default_rng. The Gillespie algorithm draws the waiting time to the next reaction from an exponential distribution and picks which reaction fires in proportion to its rate. The Euler-Maruyama scheme for a stochastic differential equation adds a Gaussian kick to each step. Each fits in a dozen lines, and scipy.linalg.expm turns the rate matrix of a continuous-time Markov chain into transition probabilities. Scale the kick with the square root of the step, never the step itself, or the noise vanishes as you refine. Julia has the libraries: DifferentialEquations.jl solves an SDEProblem with higher-order methods, JumpProcesses.jl runs Gillespie simulations, and Catalyst.jl turns a list of reactions into either.
Start with the random walk and check that its mean squared displacement grows linearly in time, the signature of diffusion. Then a Markov chain on a few states, then Gillespie on a single reaction, then a stochastic differential equation. Drawing the random numbers themselves belongs to Monte Carlo.
What belongs here
Models whose state evolves at random: random walks and diffusion, Markov chains, Poisson and birth-death processes, the Gillespie algorithm for chemical kinetics, stochastic differential equations and their integrators. Generating random numbers and plain sampling belong to monte-carlo; estimating parameters from data to bayesian-inference or statistics.
0 tutorials by type and language
| Python | Julia | |
|---|---|---|
| Concept | – | – |
| Tool | – | – |
| Recipe | – | – |
| Visualization | – | – |
| Project | – | – |