# Alan Turing and How Zebras Get Their Stripes

Gordon Brown recently apologized for the way the British government treated Alan Turing in the 50’s. In general, I don’t think much of these “government apologies”, but in this case I think that it is good to acknowledge how badly he was treated after he did so much to help the country during the war.

You probably know Turing for his work at Bletchley Park breaking German codes during World War II. He also did a lot of the earliest work on the theory of computation and later worked on the ACE at NPL. The most basic general purpose computing device is now known as a Turing machine. You might also know him because of the eponymous Turing test from the field of artificial intelligence.

But did you know that he also did important work in developmental biology? In the last years of his life, he got interested in where the patterns on different types of animals come from. You know, the zebra’s stripes, the jaguar’s spots, and all those sort of patterns. He proposed that they could all be explained with a simple model called a reaction diffusion system.

A. M. Turing (1952). The Chemical Basis of Morphogenesis. Philosophical Transactions of the Royal Society of London, volume B 237, pages 37–72.

The basic idea is that you have two different chemicals which react with each other. Over time, the reactions change the local concentrations of the chemicals, but spatial differences in the concentrations get evened out through a simple process called diffusion. It’s a very simple set of equations, but it turns out to be an extremely powerful idea. It does indeed appear to be the basis for all of these patterns, but it is also behind the formation of things like your ribs and the bones in your hand. It’s at the core of modern developmental biology.

Here’s a simple MATLAB function that illustrates. This one uses the Gray-Scott equations instead of the one from Turing’s paper, but the idea is the same.` `

```
```function [u v] = grayscott(u,v,k,f)
ru = .15;
rv = .075;
uvv = u.*v.*v;
dudt = ru*del2(u) - uvv + f*(1-u);
dvdt = rv*del2(v) + uvv - (f+k)*v;
u = u + dudt;
v = v + dvdt;

If you run this like so:

```
```% control the pattern.
k = 0.0475;
f = 0.0118;
% Fill the arrays with 1,0. It is stable and boring
u=1+zeros(200);
v=zeros(200);
% Put some different values in one area
u(50:80,50:80)=.5+rand(31,31)/2;
v(50:80,50:80)=.25+rand(31,31)/2;
% Show the initial conditions
img=imagesc(u);
colormap(hot);
axis('off');
drawnow;
for idx1=1:2000
for idx2=1:25
% update the values
[u v]=grayscott(u,v,k,f);
% clamp the edges
u(1,1:end)=1;
u(end,1:end)=1;
u(1:end,1)=1;
u(1:end,end)=1;
v(1,1:end)=0;
v(end,1:end)=0;
v(1:end,1)=0;
v(1:end,end)=0;
end
% draw
set(img,'CData',u),
drawnow;
end

You’ll get results which look something like this

If you fiddle around with those numbers k and f, you’ll get all sorts of different patterns of stripes, spots, and other cool patterns. For example, if you use k=0.059, f=0.034, you’ll get something more like this:

If you’re interested in learning more about Alan Turing, you might also enjoy this book:

Hodges, Andrew

Walker & co. 2000

Craig Reynolds posted a link to this cool reaction-diffusion toy.

You’ll need a browser that supports WebGL like Chrome.