Modelling for Zombies

Some mathematicians at the University of Ottawa have just released a paper looking at the mathematics behind a zombie apocalypse.  What are the best strategies for avoiding being eaten?  How quickly would zombies spread through the population?  This may seem a little silly as zombies aren’t real – but actually the mathematics behind how diseases spread through a population is very useful – and, well, zombies are as good a way as any to introduce this.

The graphic above from the paper shows how zombie movement can be modelled.  Given that zombies randomly move around, and any bumping would lead to a tendency towards finding space, they are modelled in the same way that we model the diffusion of gas.  If you start with a small concentrated number of particles they will spread out to fill the given space like shown above.

Diffusion can be modelled by the diffusion equation above.  We have:

t: time (in specified units)

x: position of the x axis.

w: the density of zombies at time t and point x.  We could also write w(t,x) in function notation.

a: a is a constant.

The “curly d” in the equation means the partial differential.  This works the same as normal differentiation but when we differentiate we are only interested in differentiating the denominator letter – and act as though all other letters are constants.  This is easier to show with an example.

z = 3xy2

The partial differential of z with respect to x is 3y2
The partial differential of z with respect to y is 6xy

So, going back to our diffusion equation, we need to find a function w(x,t) which satisfies this equation – and then we can use this function to model the spread of zombies through an area.  There are lots of different solutions to this equation (see a list here).  One of the easiest is:

w(x,t) = A(x2 + 2at) + B

where we have introduced 2 new constants, A and B.

We can check that this works by finding the left handside and right handside of the diffusion equation:

Therefore as the LHS and RHS are equal, the diffusion equation is satisfied. Therefore we have the following zombie density model:

w(x,t) = A(x2 + 2at) + B

this will tell us at point x and time t what the zombie density is.  We would need particular values to then find A, B and a.  For example, we can restrict x between 0 and 1 and t between 1 and 5, then set A = -1, B = 21, a = 2 to give:

w(x,t) = (-x2 + -4t) + 21

This begins to fit the behavior we want – at any fixed point x the density will decrease with time, and as we move further away from the initial point (x = 0) we have lower density.  This is only very rough however.

A more complicated solution to the diffusion equation is given above.  In this equation Z(x,t) stands for the density of zombies at point x and time t. Z0 stands for the initial zombie density – where all zombies are starting at the same point (x between 0 and 1). L stands for the edge of the domain.  This is a 1 dimensional model – where zombies only travel in a straight line.  For modelling purposes, this would be  somewhat equivalent to being trapped in a 50 metre by 1 metre square fenced area – with (0,0) as the bottom left corner of the fence. L would be 50 in this case, and all zombies would initially be in the 1 metre square which went through the origin.

Luckily as t gets large this equation can be approximated by:Which means that after a long length of time our 50 metre square fenced area will have an equal density of zombies throughout. If we started with 100 zombies in our initial 1 metre square area (say emerging from a tomb), then with Z0 = 100 and with L = 50 we would have an average density of 100/2 = 2 zombies per metre squared.  In other words zombies would be evenly spaced out across all available space.

So, what advice can you take from this when faced with a zombie apocalypse? Well if zombies move according to diffusion principles then initially you have a good advantage to outrun them – after-all they will be moving randomly and you will be running linearly as far away as possible. That will give you some time to prepare your defences for when the zombies finally reach you. As long as you get far enough away, when they do reach your corner their density will be low and therefore much easier to fight.

Good luck!

If you liked this post you might also like:

Surviving the Zombie Apocalypse – more zombie maths.  How long before the zombies arrive?

How contagious is Ebola? – using differential equations to model infections.