You are currently browsing the tag archive for the ‘diffusion’ tag.

**Surviving the Zombie Apocalypse**

*This is part 2 in the maths behind zombies series. See part 1 here*

We have previously looked at how the paper from mathematicians from Ottawa University discuss the mathematics behind surviving the zombie apocalypse – and how the mathematics used has many other modelling applications – for understanding the spread of disease and the diffusion of gases. In the previous post we saw how the zombie diffusion rate could be predicted by the formula:

In this equation Z(x,t) stands for the density of zombies at point x and time t. Z_{0} 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.

We saw that as the time, 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 Z_{0} = 100 and with L = 50 we would have an average density of 100/2 = 2 zombies per metre squared.

**When will the zombies arrive?**

So, say you have taken the previous post’s advice and run as far away as possible. So, you’re at the edge of the 50 metre long fence. The next question to ask therefore, how long before the zombies reach you? To answer this we need to solve the initial equation Z(x,t) to find t when x = 50 and Z(50,t) = 1. We solve to find Z(50,t) = 1 because this represents the time t when there is a density of 1 zombie at distance 50 metres from the origin. In other words when a zombie is standing where you are now! Solving this would be pretty tough, so we do what mathematicians like to do, and take an approximation. This approximate solution for t is given by:

where L is the distance we’re standing away (50 metres in this case) and D is the diffusion rate. D can be altered to affect the speed of the zombies. In the study they set D as 100 – which is claimed to be consistent with a slow, shuffling zombie walk. Therefore the time the zombies will take to arrive is approximately t = 0.32(50)^{2}/100 = 8 minutes. If we are a slightly further distance away (say we are trapped along a 100 metre fence) then the zombies will arrive in approximately t = 0.32(100)^{2}/100 = 32 minutes.

**Fight or flight?**

Fighting (say by lobbing missiles at the oncoming hordes) would slow the diffusion rate D, but would probably be less effective than running – as the time is rapidly increased by the L^{2 } factor. Let’s look at a scenario to compare:

You are 20 metres from the zombies. You can decide to spend 1 minute running an extra 30 metres away (you’re not in good shape) to the edge of the fence (no rocks here) or can spend your time lobbing rocks with your home-made catapult to slow the advance. Which scenario makes more sense?

**Scenario 1**

You get to the edge of the fence in 1 minute. The zombies will get to the edge of the fence in t = 0.32(50)^{2}/100 = 8 minutes. You therefore have an additional 7 minutes to sit down, relax, and enjoy your last few moments before the zombies arrive.

**Scenario 2**

You successfully manage to slow the diffusion rate to D = 50 as the zombies are slowed by your sharp-shooting. The zombies will arrive in 0.32(20)^{2}/50 = 2.6 minutes. If only you’d paid more attention in maths class.

If you liked this post you might also like:

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

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 = 3xy^{2}

The partial differential of z with respect to x is 3y^{2}

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(x^{2} + 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(x^{2} + 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) = (-x^{2} + -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. Z_{0} 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 Z_{0} = 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.