← Back

Cool Stuff · pattern formation

Turing Patterns

Two chemicals that react and spread out at different speeds can turn a nearly uniform mixture into spots, stripes and labyrinths. Nothing in the rules says "make a spot".

6 November 2026

1The idea

In 1952 Alan Turing asked how an embryo, which starts out nearly uniform, can develop a pattern. His answer, in "The Chemical Basis of Morphogenesis", was that diffusion, usually a smoothing process, can make a uniform state unstable when it is combined with chemical reactions. If one substance spreads faster than the other, small random bumps grow into a regular pattern with its own preferred size.

The Gray–Scott model is a simple reaction–diffusion system that shows this behaviour. A substrate \(U\) is fed in from outside; an activator \(V\) consumes \(U\) to make more of itself and is removed at its own rate:

\[ \begin{align} \frac{\partial U}{\partial t} &= D_u \nabla^2 U - U V^2 + F\,(1-U), \tag{1}\label{eq:u} \\ \frac{\partial V}{\partial t} &= D_v \nabla^2 V + U V^2 - (F+k)\,V. \tag{2}\label{eq:v} \end{align} \]

\(F\) is the feed rate and \(k\) the kill rate. The term \(UV^2\) is the reaction: one \(U\) and two \(V\) make three \(V\). With \(D_u = 2D_v\) the substrate spreads twice as fast as the activator. Pearson (1993) mapped the \((F,k)\) plane and found a whole zoo of patterns in it.

2Try it

The simulator below is a JavaScript copy of turing.py, with the same grid, stencil, parameters and presets. It starts from three random square seeds. Pick a preset, or move the \(F\) and \(k\) sliders while it runs. Click or drag on the picture to add more activator.

step 0
Figure 1. The activator \(V\) on a 150 × 150 grid with wrap-around edges (colour scale 0 to 0.4, as in the Python version). "Speed" is the number of time steps per drawn frame; the Python default is 12. Some patterns take a few thousand steps to fill the grid.
Table 1. Presets, from PRESETS in turing.py. Diffusion constants are fixed at \(D_u = 0.16\), \(D_v = 0.08\), time step 1.
PresetFk

3The code

turing.py solves no differential equation in symbolic form. Diffusion is a 9-point neighbour average (a discrete Laplacian), and the reaction is a few lines of array arithmetic. One explicit Euler step of Eqs. \eqref{eq:u}–\eqref{eq:v} is:

def laplacian(Z):
    return (-Z
        + 0.2  * (roll(Z, 1, 0) + roll(Z, -1, 0) + roll(Z, 1, 1) + roll(Z, -1, 1))
        + 0.05 * (four diagonal neighbours))

def gray_scott_step(U, V, F, k):
    reaction = U * V * V
    U_new = U + (DU * laplacian(U) - reaction + F * (1 - U))
    V_new = V + (DV * laplacian(V) + reaction - (F + k) * V)
    return clip(U_new, 0, 1), clip(V_new, 0, 1)

The full program adds a matplotlib window with sliders for \(F\), \(k\) and grid size, play / step / reset buttons, and the preset buttons. It needs Python with NumPy and matplotlib.

Download turing.py (9 kB), then run:

python3 turing.py --F 0.03 --k 0.0575

4Further reading