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]+∂[f[x,t],x] dx + ∂[f[x,t],x,x] dx^{2}/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 ∂[f[x,t],t]== f[x,t]+c dx^{2} ∂[f[x,t],x,x]

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