You are currently browsing the tag archive for the ‘differential equations’ 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.

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

**How Infectious is Ebola?**

Ebola is the latest virus to warrant global fears over a pandemic which infects large numbers of people. Throughout history we have seen pandemic diseases such as the Black Death in Middle Ages Europe and the Spanish Flu at the beginning of the 20th century. More recently we have seen HIV responsible for millions of deaths. In the last few years there have been scares over bird flu and SARS – yet neither fully developed into a major global health problem. So, how contagious is Ebola, and how can we use mathematics to predict its spread?

The basic model is based on the SIR model. The SIR model looks at how much of the population is susceptible to infection, how many of these go on to become infectious, and how many of these go on to recover (and in what timeframe). However given the nature of modelling diseases with very high mortality rates like Ebola, for our Ebola model the SIR stands for Susceptible, Infectious and Dead.

Another important parameter is R_{0}, this is defined as how many people an infectious person will pass on their infection to in a totally susceptible population. Some of the R_{0 }values for different diseases are shown above. Studies into Ebola estimate the R_{0} value at somewhere between 1.7 and 8.6. Therefore whilst Ebola is contagious, it is nowhere near as contagious as a fully airbourne disease like measles.

The Guardian datablog have an excellent graphic to show the contagiousness relative to deadliness of different diseases. You can notice that we have nothing in the top right hand corner (very deadly and very contagious). This is just as well as that could be enough to seriously dent the human population. Most diseases we worry about fall into 2 categories – contagious and not very deadly or not very contagious and deadly. Ebola is in the latter category.

The equations above represent a SIR (susceptible, infectious, dead) model which can be used to model the spread of Ebola.

dS/dt represents the rate of change of those who are susceptible to the illness with respect to time. dI/dt represents the rate of change of those who are infected with respect to time. dR/dt represents the rate of change of those who have died with respect to time.

For example, if dI/dt is high then the number of people becoming infected is rapidly increasing. When dI/dt is zero then there is no change in the numbers of people becoming infected (number of infections remain steady). When dI/dt is negative then the numbers of people becoming infected is decreasing.

The constants β and μ are chosen depending on the type of disease being modelled. β represents the contact rate – which is how likely someone will get the disease when in contact with someone who is ill. ν is the recovery rate which is how quickly people recover (and become immune.

N is the total population

μ is the per capita death rate (Calculated by μ = 1/(duration of illness) )

N – let’s take as the population of Sierra Leone (6 million)

**In the case of Ebola we have the following estimated values:**

μ between 1/4 and 1/10 (because it takes an infected person between 4 and 10 days to die). Let’s take it as 1/7 ≈ 0.14

β as approximately 0.6

N – let’s take as the population of Sierra Leone (6 million)

Therefore our 3 equations for rates of change become:

dS/dt = -0.6 I S/6,000,000

dI/dt = 0.6 I S/6,000,000 – 0.14 I

dR/dt = 0.14 I

Unfortunately these equations are very difficult to solve – but luckily we can use a computer program to plot what happens. We need to assign starting values for S, I and R – the numbers of people susceptible, infectious and dead. We have 6 million people in Sierra Leone, and currently around 8000 reported cases of Ebola. If we assume all 6 million are susceptible, then putting this all into the program gives the following outcome:

This graph is pretty incredible – though it clearly shows some of our assumptions were wrong! Given a starting point of 6 million people all susceptible to Ebola, and 8000 infectious individuals, then within 20 days the population would have crashed from 6 million to less than 1 million and within 60 days you would have nearly everyone dead.

Clearly therefore this graph is very sensitive to our initial assumed values. Say for example Ebola was less contagious than we previous assumed – and so we had β = 0.15 with the other values the same. Then we get the following:

This graph is very drastically different to the last one – you have infections remaining low – though this would still be enough to see a big population drop over the 3 years of the simulation.

Modelling disease outbreaks with real accuracy is therefore an incredibly important job for mathematicians. Understanding how diseases spread and how fast they can spread through populations is essential to developing effective medical strategies to minimise deaths. If you want to save lives maybe you should become a mathematician rather than a doctor!

If you enjoyed this post you might also like:

Differential Equations in Real Life – some other uses of differential equations in modelling predator-prey relationships between animal populations.

Modelling Infectious Diseases – How we can use computer modelling to look at other infectious diseases like measles.

**IB Revision**

If you’re already thinking about your coursework then it’s probably also time to start planning some revision, either for the end of Year 12 school exams or Year 13 final exams. There’s a really great website that I would strongly recommend students use – you choose your subject (HL/SL/Studies if your exam is in 2020 or Applications/Analysis if your exam is in 2021), and then have the following resources:

The Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and each area then has a number of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to ready made exams on each topic – again with worked solutions. This also has some harder exams for those students aiming for 6s and 7s and the Past IB Exams section takes you to full video worked solutions to every question on every past paper – and you can also get a prediction exam for the upcoming year.

I would really recommend everyone making use of this – there is a mixture of a lot of free content as well as premium content so have a look and see what you think.

**Modelling Infectious Diseases**

Using mathematics to model the spread of diseases is an incredibly important part of preparing for potential new outbreaks. As well as providing information to health workers about the levels of vaccination needed to protect a population, it also helps govern first response actions when new diseases potentially emerge on a large scale (for example, Bird flu, SARS and Ebola have all merited much study over the past few years).

The basic model is based on the SIR model – this is represented by the picture above (from Plus Maths which has an excellent and more detailed introduction to this topic). The SIR model looks at how much of the population is susceptible to infection, how many of these go on to become infectious, and how many of these go on to recover (and in what timeframe).

Another important parameter is R_{0}, this is defined as how many people an infectious person will pass on their infection to in a totally susceptible population. Some of the R_{0}values for different diseases are shown above. This shows how an airbourne infection like measles is very infectious – and how malaria is exceptionally hard to eradicate because infected people act almost like a viral storage bank for mosquitoes.

One simple bit of maths can predict what proportion of the population needs to be vaccinated to prevent the spread of viruses. The formula is:

V_{T} = 1 – 1/R_{0}

Where V_{T} is the proportion of the population who require vaccinations. In the case of something like the HIV virus (with an R_{0} value of between 2 and 5), you would only need to vaccinate a maximum of 80% of the population. Measles however requires around 95% vaccinations. This method of protecting the population is called herd immunity

This graphic above shows how herd immunity works. In the first scenario no members of the population are immunised, and that leads to nearly all the population becoming ill – but in the third scenario, enough members of the population are immunised to act as buffers against the spread of the infection to non-immunised people.

The equations above represent the simplest SIR (susceptible, infectious, recovered) model – though it is still somewhat complicated!

dS/dt represents the rate of change of those who are susceptible to the illness with respect to time. dI/dt represents the rate of change of those who are infected with respect to time. dR/dt represents the rate of change of those who have recovered with respect to time.

For example, if dI/dt is high then the number of people becoming infected is rapidly increasing. When dI/dt is zero then there is no change in the numbers of people becoming infected (number of infections remain steady). When dI/dt is negative then the numbers of people becoming infected is decreasing.

The constants β and ν are chosen depending on the type of disease being modelled. β represents the contact rate – which is how likely someone will get the disease when in contact with someone who is ill. ν is the recovery rate which is how quickly people recover (and become immune.

ν can be calculated by the formula:

D = 1/ν

where D is the duration of infection.

β can then be calculated if we know R_{0} by the formula:

R_{0} = β/ν

**Modelling measles**

So, for example, with measles we have an average infection of about a week, (so if we want to work in days, 7 = 1/ν and so ν = 1/7). If we then take R_{0} = 15 then:

R_{0} = β/ν

15 = β/0.14

β = 2.14

Therefore our 3 equations for rates of change become:

dS/dt = -2.14 I S

dI/dt = 2.14 I S – 0.14 I

dR/dt = 0.14 I

Unfortunately these equations are very difficult to solve – but luckily we can use a computer program to plot what happens. We need to assign starting values for S, I and R – the numbers of people susceptible, infectious, recovered (immune) from measles. Let’s say we have a total population of 11 people – 10 who are susceptible, 1 who is infected and 0 who are immune. This gives the following outcome:

This shows that the infection spreads incredibly rapidly – by day 2, 8 people are infected. By day 10 most people are immune but the illness is still in the population, and by day 30 the entire population is immune and the infection has died out.

An illustration of just how rapidly measles can spread is provided by the graphic above. This time we start with a population of 1000 people and only 1 infected individual – but even now, within 5 days over 75% of the population are infected.

This last graph shows the power of herd immunity. This time there are 100 susceptible people, but 900 people are recovered (immune), and there is again one infectious person. This time the infection never takes off in the community – those who are already immune act as a buffer against infection.

If you enjoyed this post you might also like:

Differential Equations in Real Life – some other uses of differential equations in modelling predator-prey relationships between animal populations.

Essential resources for IB students:

Revision Village has been put together to help IB students with topic revision both for during the course and for the end of Year 12 school exams and Year 13 final exams. I would strongly recommend students use this as a resource during the course (not just for final revision in Y13!) There are specific resources for HL and SL students for both Analysis and Applications.

There is a comprehensive Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and then provides a large bank of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to a large number of ready made quizzes, exams and predicted papers. These all have worked solutions and allow you to focus on specific topics or start general revision. This also has some excellent challenging questions for those students aiming for 6s and 7s.

Each course also has a dedicated video tutorial section which provides 5-15 minute tutorial videos on every single syllabus part – handily sorted into topic categories.

2) Exploration Guides and Paper 3 Resources

I’ve put together four comprehensive pdf guides to help students prepare for their exploration coursework and Paper 3 investigations. The exploration guides talk through the marking criteria, common student mistakes, excellent ideas for explorations, technology advice, modeling methods and a variety of statistical techniques with detailed explanations. I’ve also made 17 full investigation questions which are also excellent starting points for explorations. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.

**Real life use of Differential Equations**

Differential equations have a remarkable ability to predict the world around us. They are used in a wide variety of disciplines, from biology, economics, physics, chemistry and engineering. They can describe exponential growth and decay, the population growth of species or the change in investment return over time. A differential equation is one which is written in the form dy/dx = ………. Some of these can be solved (to get y = …..) simply by integrating, others require much more complex mathematics.

**Population Models
**

One of the most basic examples of differential equations is the Malthusian Law of population growth dp/dt = rp shows how the population (p) changes with respect to time. The constant r will change depending on the species. Malthus used this law to predict how a species would grow over time.

More complicated differential equations can be used to model the relationship between predators and prey. For example, as predators increase then prey decrease as more get eaten. But then the predators will have less to eat and start to die out, which allows more prey to survive. The interactions between the two populations are connected by differential equations.

The picture above is taken from an online predator-prey simulator . This allows you to change the parameters (such as predator birth rate, predator aggression and predator dependance on its prey). You can then model what happens to the 2 species over time. The graph above shows the predator population in blue and the prey population in red – and is generated when the predator is both very aggressive (it will attack the prey very often) and also is very dependent on the prey (it can’t get food from other sources). As you can see this particular relationship generates a population boom and crash – the predator rapidly eats the prey population, growing rapidly – before it runs out of prey to eat and then it has no other food, thus dying off again.

This graph above shows what happens when you reach an equilibrium point – in this simulation the predators are much less aggressive and it leads to both populations have stable populations.

There are also more complex predator-prey models – like the one shown above for the interaction between moose and wolves. This has more parameters to control. The above graph shows almost-periodic behaviour in the moose population with a largely stable wolf population.

Some other uses of differential equations include:

1) In medicine for modelling cancer growth or the spread of disease

2) In engineering for describing the movement of electricity

3) In chemistry for modelling chemical reactions

4) In economics to find optimum investment strategies

5) In physics to describe the motion of waves, pendulums or chaotic systems.

With such ability to describe the real world, being able to solve differential equations is an important skill for mathematicians. If you want to learn more, you can read about how to solve them here.

If you enjoyed this post, you might also like:

Langton’s Ant – Order out of Chaos How computer simulations can be used to model life.

Does it Pay to be Nice? Game Theory and Evolution. How understanding mathematics helps us understand human behaviour

Essential resources for IB students:

Revision Village has been put together to help IB students with topic revision both for during the course and for the end of Year 12 school exams and Year 13 final exams. I would strongly recommend students use this as a resource during the course (not just for final revision in Y13!) There are specific resources for HL and SL students for both Analysis and Applications.

There is a comprehensive Questionbank takes you to a breakdown of each main subject area (e.g. Algebra, Calculus etc) and then provides a large bank of graded questions. What I like about this is that you are given a difficulty rating, as well as a mark scheme and also a worked video tutorial. Really useful!

The Practice Exams section takes you to a large number of ready made quizzes, exams and predicted papers. These all have worked solutions and allow you to focus on specific topics or start general revision. This also has some excellent challenging questions for those students aiming for 6s and 7s.

Each course also has a dedicated video tutorial section which provides 5-15 minute tutorial videos on every single syllabus part – handily sorted into topic categories.

2) Exploration Guides and Paper 3 Resources

I’ve put together four comprehensive pdf guides to help students prepare for their exploration coursework and Paper 3 investigations. The exploration guides talk through the marking criteria, common student mistakes, excellent ideas for explorations, technology advice, modeling methods and a variety of statistical techniques with detailed explanations. I’ve also made 17 full investigation questions which are also excellent starting points for explorations. The Exploration Guides can be downloaded here and the Paper 3 Questions can be downloaded here.