Diffusion
Does a cloud of random walkers spread according to the diffusion law?

▶ Run the simulationSee the measured result
How the lab tests it
Release particles from a point, track the mean-square displacement ⟨r²⟩(t), and recover the diffusion coefficient from its slope.
What it checks
⟨r²⟩ = 4Dt and the Einstein relation D = σ²/2Δt
Diffusion coefficient & mean-square-displacement calculator
How far a blind walker gets, and how long it takes. Einstein's 1905 answer is the one relation in this lab that a chemist, a cell biologist and a semiconductor engineer all use for a living: the mean-square displacement grows LINEARLY in time, ⟨r²⟩ = 2dDt, with a single coefficient fixed entirely by the microscopic step statistics, D = σ²/(2Δt). Nothing here is typed. The simulation above takes raw Gaussian steps and never contains D, the diffusion equation or the Gaussian propagator in its recovery path; this page assembles D out of the same σ and Δt the module walks with, and the 2 that halves σ²/Δt is the SAME convention constant that puts the 2d into 2dDt — move one and the other moves with it, which is the only reason the two lines agree. The measured box holds the module's own last sample of its first cycle, t = 10.600000000000106 s at ⟨r²⟩ = 79.34645704968753 wu², so inverting a SINGLE point returns 1.871378 and the page prints the −0.19% rather than rounding onto the answer. The second direction is the one people actually came for and the one that makes diffusion a wall: time goes as the SQUARE of distance, so ten times further is a hundred times longer, and a molecule that crosses a micron in a millisecond needs about thirty years to cross a metre. The rival is one dial with memory in it, c, the correlation between one step's direction and the next: at c = 0 Tchen's persistent-walk closed form returns the shipped memoryless walk exactly and ⟨r²⟩ doubles when the step count doubles; at c = 1 it returns n²ℓ² and the same doubling QUADRUPLES it — and the lab rejects that rival on its own tracks at an exponent of 2.0 with a 'D̂' off by 2068%. Cauchy steps are rejected differently and it matters: they stay linear on average and fail the CLT instead, at an excess kurtosis of 1.5e+3. The last direction RE-EXECUTES the shipped DiffusionModule — its mulberry32(12345) stream, its Box–Muller call order, its Float32Array walkers, its sample every 12th step, its recollapse at ⟨r²⟩ = 80 and its through-origin fit — and lands on the same D̂ the screen rounds to 'D 1.854 / 1.875 · 1.1%'. Four things this page will not do: Stokes–Einstein and the viscosity chain, which belong to ?world=perrin, where this same law is run in SI units to weigh Avogadro's number; anomalous diffusion in a crowded or fractal medium, where the exponent is not 1 and no single D exists; drift, sedimentation or any bias on top of the walk; and boundaries — every number here is for a walker in an unbounded plane with nothing to bounce off.
⟨r²⟩ = 2·d·D·t · D = σ²/(2Δt) from the step statistics · D̂ = ⟨r²⟩/(2dt), σ̂ = √(2D̂Δt) · r_rms = √(2dDt), t = L²/(2dD) · Pearson: ℓ = σ√2 gives the same D · persistent walk ⟨r²⟩(n) = nℓ²(1+c)/(1−c) − 2ℓ²c(1−cⁿ)/(1−c)², c = 0 memoryless, c = 1 ballistic