Derivation of the diffusion equation

With some appropriate assumptions, it is fairly straightforward to derive the usual diffusion equation from a cellular automaton. Let the density of black cells at position x and time t be f[x,t], where this density can conveniently be computed by averaging over many instances of the system. If we assume that the density varies slowly with position and time, then we can make series expansions such as

f[x + dx, t] f[x , t] + ∂_{x}f[x, t] dx + 1/2∂_{xx}f[x, t] dx^{2} + …

where the coordinates are scaled so that adjacent cells are at positions x - dx, x, x + dx, etc. If we then assume perfect underlying randomness, the density at a particular position must be given in terms of the densities at neighboring positions on the previous step by

f[x, t + dt] p_{1} f[x - dx, t] + p_{2} f[x, t] + p_{3} f[x + dx, t]

Density conservation implies that p_{1} + p_{2} + p_{3} 1, while left-right symmetry implies p_{1} p_{3}. And from this it follows that

f[x, t + dt] c (f[x - dx, t] + f[x + dx, t]) + (1 - 2c)f[x, t]

Performing a series expansion then yields

f[x, t] + dt ∂_{t}f[x, t] f[x, t] + c dx^{2} ∂_{xx}f[x, t]

which in turn gives exactly the usual 1D diffusion equation ∂_{t}f[x, t] ξ ∂_{xx}f[x, t], where ξ is the diffusion coefficient for the system. I first gave this derivation in 1986, together with extensive generalizations.