Hey everyone, not a typical Numberphile video for obvious reasons.
Ben Sparks, who ironically is the person who lives closest to me,
he's only about 40 miles, uhhhh, I think he's that way,
But he's at home at the moment. So am I, but we're gonna have a talk via technology
hopefully. And what are we talking about Ben? What are we gonna try and discuss?
I think there's a lot of videos and chat out there about how
mathematicians are modeling the spread of the COVID-19 virus.
And it's kind of like this sort of halcyon days for mathematical modellers. Despite it being a horrible circumstance,
everybody is queuing up to ask the mathematicians' opinion on what's going to happen next. And I guess it's a shout out, mathematical
modelling is what helps us predict what happens in the world, in general. What I wanted to show you was a
way of using one of the standard
models of disease spread on a free piece of software that people can just try
themselves and see that the modelling that people are doing to predict this is, it's kind of accessible.
- I see you've got the honorary brown paper
- Needs must, we've got to do something properly Numberphile
I actually don't have any physical brown paper that I could find so I had to, you know,
get a screen grab of brown paper and put it in GeoGebra
Which I'm going to use to show you a model of a disease spread. Um, I hope -
- And is that is an image taken from an actual Numberphile brown paper? - An actual Numberphile brown paper, yeah
I mean, spared no expense here.
So, I'm gonna try and build you a mathematical file in this program called GeoGebra
Which anyone can try and follow along with, the program's free.
So grab it if you want to try it. The three variables
I'm going to use I've written on the screen already, um, just checking you can see that all right
I've got "S" for "susceptible",
meaning a bunch of people that are
possibly able to get a disease; "I" for "infected", people who have got the disease,
and "R" for recovered by which I mean are not infected anymore.
To be honest, that doesn't necessarily mean recovered, right? um
They may be dead, which means they're not gonna be infectious anymore
and that's the sad truth of modelling diseases like this, is that
there are two ways out: you recover or you don't, but either way you stop infecting people.
I'm gonna use "R" for "recovered",
some people call it "removed",
but I will forget to say that word, so I'm going to use "recovered" as long as you know what I mean
and we're gonna build up, like all good mathematical models, some sort of simple, almost naïve assumptions of how diseases spread
and follow the mathematical consequences of those simple things just to make a prediction,
and actually GeoGebra will do the lifting, the heavy lifting, for us. So, happy for me. Let's start chatting maths.
Okay, I'm gonna set up a population of size 1, this sounds a little bit confusing, and I'm typing into the top thing here
n equals 1 which means
I'm using like my entire population to mean like 100% so zero to one measures some fraction of the population and the whole population is
size 1. You can do these models with a large number, but it- everything just scales
So I'm just gonna go with between 0 and 1, which is why my graph is 0 and 1 about here on the screen.
I'm also gonna set up some initial setup. So presumably there are some infected people in my population
Otherwise, you've got to be asking why you'd be doing the model
So I'm gonna start some values of infected, and susceptible and recovered, and the infected I'm going to call "Istart",
not meaning me starting, I mean the number of infected people at the start of this, I'm going to call 1%, which is 0.01
and everyone else is therefore susceptible.
So those susceptible people at the start is gonna be N, the total number of people, take away "Istart"
And that gives us 99% susceptible. That's because no one of this stage has recovered
So "Rstart" is 0. And those are like my initial conditions for a model. It all looks a bit cryptic.
I'm basically programming in maths. I'm gonna set up 2, 3 more variables in fact
which we'll use in a minute and it'll feel a bit arcane until you realise why, but I'm gonna use
sliders for this, so there's a slider tool here. I'm just gonna put it here.
This slider is gonna represent how quickly this disease gets transmitted. Like, the infection rate.
So I'm making a slider. It won't do anything yet, but you can see I can change this number
It's gonna be something to do with how quickly it
infects people, and I get another slider for how quickly people recover from this disease.
Which is gonna be smaller, 'cause it takes a while to recover from diseases. Otherwise, they usually don't really register in any model.
- What are the units of time here Ben?
- It doesn't actually matter. So we could pick a unit and run with it,
let's say days, but I'm not necessarily gonna have the numbers right to model this in days,
but then, if you change the unit of time
you'd just have to change these parameters to reflect that. And we can do some- because they're on sliders
we can do the playing around with it later on to see if we can change the units. - (Brady: Okay, and at the moment, they're called a and b?)
- a and b, yeah
I can give them different names if you like. - (Brady: Just to really help me remember what they are)
- Well, yeah, let's rename it. Let's call this transmission,
just call it transm.
All coding has to have horrible names right, but I still want to type in really long names all the time. Let's call it recov
so I've got a transmission rate and recovery rate.
And I'm gonna use them to build some naive models. One more parameter I need, which is
how long I'm gonna let the model run for. You'll see why this is useful later
I'm gonna call this the max time. I'm gonna go up to about 20 for now.
Okay, good, now we're into the real maths.
What I'm gonna do is set up three what they call "differential equations", which sounds scarier than it should
but these are equations which tell us the sort of "naive" assumptions we're going to make about these three numbers.
What I want to know in the end is: what these numbers are over time
How many susceptible? How many are infected? And how many are recovered?
But what I can't tell you is straight away what those numbers are. I can guess though at how quickly they're going to change depending on
various things, so I'm going to write down three equations, which tell me about the rate of change of these things.
The first one is called "S' " I'm gonna call it "S' "
And that is sort of mathematical code for
If you were gonna write it longhand, maybe "ds/dt" if you know any calculus, that's the derivative of s with respect to time
But in everyday language it's the rate of change of the number of susceptible people - how quickly it's changing.
And it's gonna depend on time
So this bit looks technical, but I'm typing in a bunch of variables
The rate of change of susceptible people depends on time and the number of susceptibles and the number of infecteds
And the number of recovereds. All of these things might affect that
but in practice and here, this is the first time we actually get some maths written on the screen:
The rate of change of susceptibles is negative because the number of susceptible people will go down
because they're getting infected. Does that bit make sense?
- And we're working on this assumption that once you've been infected,
if you've recovered or died you can't get it again?
- Yeah.
We are assuming in this particular model of disease that once you've infected and recovered you are now sort of immune in some sense
So you don't become susceptible again.
The thing is that if you've got loads of susceptible people and a few infected people, at first anyway, the susceptible people go down
so what I'm expecting here is a negative rate of change, which is why I've wrote a negative sign at the top of the screen there.
And it's going to depend on three things. One is the parameter "a" which I've called transm now
transm.
the transmission rate,
and that will also depend on how many people are susceptible. So if there's lots of susceptible people you can imagine we're gonna
lose them to the infections quite quickly and also depend on how many infected people there are. So this is relatively simple
there's a number, the transmission rate, multiplied by the susceptible people multiplied by the infected people
and it's negative because the susceptible people are going down. They're gonna turn into infected people
So there's my first equation. It's a differential equation. It's a rate equation -
that's what it means by a differential equation. We need to do two more for the other two variables and it's not too bad
so I'm gonna go with I next.
I' is gonna depend on the same four possibilities here
But this time, the first bit's obvious because if people were susceptible,
and that's what this first equation we typed in was capturing,
They're going to become infected next. So anything that's gone away from susceptible has become infected
So it's exactly the same as what I just wrote down but this time positive.
So you can see it's the same thing: transmission rate times S times I but this time it's not got a negative sign
because the infected people are going up, presumably, if they're moving from susceptible to infected
However, I hope we are aware that some people can recover? And so that will cause the number infecteds to go down
so I need a negative bit and this is where the recovery bit comes in. I've call it recov, is that right?
and that will depend on how many people are infected. The more people that are infected the more people that can recover, obviously
At a certain rate so that's got the I number in there as well
- I notice you're not attaching any, like, weightings or anything to these, to these numbers - No
- It all seems like a really one-to-one... - Well,
there are two weightings. The two weightings are these precise numbers: transm - transmission rate - and recovery rate.
So there are weightings, but I'm trying to keep the model simple so there's like this - at the moment
it's 3.2. And that'll affect how many people are going to move from susceptible to infected
and the recovery rate is going to affect how many people move from infected to recovered.
So those are the weightings if you like, but they're the only
parameters. And this is the thing with models - you start simple and you realise that even simple models can capture behavior and then you
upgrade the models, which will be a whole week's course instead of a single video
Let's do one more equation, which is the R'. The rate of change of recovered people
So the same four variables in here and this time
It's a simple end again because anyone who's infected and now recovered is going to move into this category
so it's precisely the term I just had at the end of the infected rate but this time positive so the recov
multiplied by the number of infected.
So actually there are only two terms in this: there's the negative version in the susceptible to
infected one then again, so negative there and positive there
and then the effective one you've got in the negative people that's recovering from infected to recovered. So again sums up to negative there and positive there
So that was that. That was the hard bit and that's the modeling bit
That's what mathematicians get paid for to come up with these models. To be honest, they're not rocket science. They're,
sensible guesses at how things might behave.
Solving these equations is a different matter; before we do that I'm just going to change the color
So we can keep track of this. So susceptible we made blue,
infected we had a sort of browny-red and recovered let's go with green. Is that all right? Can you see those colours okay?
- Ben's colourblind by the way people, which is why he's asking me all the time. - [Both]: *laugh*
Brady: He got no idea
- I , Ihad a long chat with Brady about: is that actually red? Anyway, we're gonna go with this. We've got a browny-red infected colour, which is,
you know, maybe suitable.
So if you want to solve differential equations, then you need to go and study some serious maths
and I'm not here to teach you to solve differential equations. What's nice about mathematicians is that they have programmed computers to do
numerical solutions just like a calculator can solve equations for you, GeoGebra here can solve differential equations.
So I'm gonna type in here is a command called "Nsolve"
in fact there it is, "NSolveODE"
The ODE stands for Ordinary Differential Equation, mathematicians are as bad as everyone else at coming up with acronyms that no one
recognises, but ordinary differential equation in this case is system of three differential equations,
and this command is just gonna spit out the solution. So this is the exciting bit
you just get to type it in and it should do all the work for us.
First of all, I need a list of derivatives and that's the three things I just typed in
These are rate equations or derivatives. In GeoGebra we need curly brackets for a list
So it's S' I called it, and then I' and then R', close that list
It asks for the initial x-coordinate and on our scale x-axis is time
so we're gonna start at time zero.
And we will a list of initial y-coordinates, or in this case the initial values of our three functions
And those are the things I set up at the very beginning. So let's go in the same order
Sstart - the number of people starting susceptible
and then Istart, I think I did that order, and then Rstart
Finally, I need a final x-coordinate and this is why I set up a max time thing, because it's gonna tell me how long to
go on the simulation for now. Now it's already done something. That's my command
That's the sort of magic of using a piece of software to solve an equation for you
If I hit return, it has done three things which look kind of down here. They don't look very complete yet
But can you see that one of them's going down,
one of them's going up and one's going up a little bit more slowly? They're all black. We'll sort out the colours because
GeoGebra doesn't do the colours for us, I wish it did frankly for my own colour vision deficiency
But I can also increase the time it, it carries on, so you can see this is the important bit. When I crank up the time
you see how these things develop over time.
And actually it'd be much nicer to see this with colour so let's rewind that and put some colours on the first one
it solved is S, so let's rename that to be S and make it
excitingly blue. I don't know why blue is exciting. The next one is our browny-red,
rename that to be Infected
and finally we've got Recovered
And that was a green
Can I click? Yeah. And finally let's just make them nice and thick.
And now we can see - I could even just animate this and right-click and animate it and you see what happens to the numbers of
Susceptible, Infected, and Recovered over time. This might be worth guessing what you think will happen, but let's just click go.
And so what I hope you're seeing is, this red graph has been in the news a lot - this bump of
infected people - which does tail off again -
but it's nice that GeoGebra is just doing this for us
(Brady: You're going back in time now.)
- Ben: Yeah. I've got to change of properties of the number here to stop it oscillating
but yeah, you can go and tinker with this yourself
That's what it starts with. The number of susceptible people goes down
infecteds goes up and people do start recovering enough of for the infecteds to jump off.
but it's how high that bump is that's really what's causing all the headlines at the moment 'cause if that bump of infected people
- The red bump. That's when the number of infected people is at its highest, the red bump is at its peak. - Yeah
And according to this model which is going between zero and 100% like almost 80% of the population got it at once.
And that's obviously if you project that to our NHS, that's a problem.
Which is what - we've just started this week of lockdown in the UK
I mean it's unprecedented because they're trying to stop this bump from dominating the entirety of all hospital
intensive care beds.
But now we've done it, and this is the nice thing about doing a model, is that we can change these parameters
So I said this- - We can flatten the curve! - We can flatten the curve, we can squash the bubble,
whatever you want to call it and there are two ways according to our model, right?
Let's crank up the time so we've got enough model
We can decrease the transmission rate
Which means like stop people from talking to each other
social distancing, all that stuff. And if I start knocking that down, if I just kind of animate that down you can see
what's happening to the model there. - (Brady: As you lower the transmission rate that red bump gets lower)
- Gets lower, yeah - (Brady: And that means there are fewer people all needing the hospital at once?)
- Exactly. We're squashing the bubble a bit, flattening the curve and that's kind of what we're trying to do at the moment.
And you can see that this model lets us try and see how much you have to do that
and you see that eventually if you reduce this rate hugely
Not only do you flatten the curve, you also stop everyone from getting the disease in the long run.
We can crank up the maximum time. I may go off the edge of our
pre-arranged paper here, but let's just see what happens. I crank up time and see what we see here.
So this is settled down now and not everyone has the disease so maybe 10% this blue line susceptibles,
there's still 10% people susceptible in the long run
but they've never got the disease and that, is kind of what we're praying for because some people
won't survive this disease and if we can stop
at least like maybe 10% of the most vulnerable from getting it, that would be great.
You see why reducing the transmission rate doesn't just squash the curve it also reduces
the number people actually getting the disease in the long run
- And of course a vaccine may be developed in the interim in which case the susceptible people can be made susceptible...
- Absolutely, you can take them out of the equation entirely if you vaccinate them.
I mean you can also increase the recovery rate if you crank up the way the people recover
you can see that increasing that flattens the curve as well
but that's much harder to do. The NHS is doing that,
they're trying to keep people healthy and recover quickly in hospital
But in practice we know that it takes at least a week or so to get over this thing and sometimes a lot longer
- There aren't treatments or cures that can really help us move that slider very much.
- Exactly, yeah. We'll do our level best obviously in the NHS
but we can't control it very well and what you might have heard some people talking about on the
sort of chat shows about modelling this stuff is something called R_0
which is the sort of rate of infection is actually a comparison of these two numbers
So it's one divided by the other. If I do transmission divided by recov
That number - let's just crank it onto the screen there
(Brady: We should call it R_0 for the sake of, uh - )
Yeah, let's call R_0, that sounds sensible, you know.
It's confusing calling it R_0 sometimes because it might also refer to the Rstart
which was...but anyway,
this is R_0 meaning some sort of reproduction rate and you can see that, umm
we think the R_0 for the COVID-19 is about three, perhaps?
And it's kind of like a ratio of these two things, but this is possibly a good model for our disease
we're looking at now - and obviously we haven't sorted out the units of time,
but even - maybe it's about right. The number of days might spike in about two weeks
from when things start off
I'm not doing a full analysis, but you can see that even in a free piece of software with three basic differential equations
It solves it for you and you can begin to get a predicting model that tells us what's going to happen in the future
- Ben, the transmission rate, like, you're moving it like a slider,
it's like almost like an abstraction you can just play with. - Yeah, yep
- How do the modellers go change that number based on things like "We're going to close the cinemas",
"We're going to close the schools, We're going to stop people, we're going to keep people in their house for two weeks or three weeks."
How do those real-world interactions turn into a number?
Well, this is where there's a lot of argument out there in the press right? This is guesswork.
We don't know what the transmission rate and recovery times are, they're not written in the back of a textbook.
All we can do is estimate them from the data we get
from say, China, who've been dealing with it longer than the rest of the world,
which is why the data from China is super valuable and also why we need to know whether we can trust it.
So you go and get data from China and then maybe Italy and then maybe Iran
and then you ask serious questions about whether that data is reliable, to build your models on.
And then you start saying "Well if we social isolate maybe we can reduce this by a certain amount", and you have to look at other
studies that have been done to see how much certain actions will reduce that. But it is guesswork,
this is why having a model is super important because you can't do the guesswork live,
and wait to see if everyone dies because that's just not how things should run.
- One thing that was absolutely clear though is no matter what happened, whenever you slid the transmission down,
the red bump flattened. - Yeah, and it flattens a lot.
- Even if we don't know how much it's flattening, it does flatten it.
- Absolutely. And the more we can flatten it the better.
The actual details of exactly what numbers we need to keep our society safe is guesswork from everybody
which is why, I mean, the government has got a difficult job - and everybody is going to be second guessing them, including experts
and including the experts that they're relying on for their information.
But it's important stuff and for once you've got a listen to the mathematicians
because they're the only ones with the access to this model to predict what will happen
- Oh, and Numberphile viewers now can make their own model.
- And Numberphile videos, 'cause they're all going to be making their own model
So there is a file I made earlier which I'll, umm - this file here,
which I just put a little animation on so you can see these numbers tracking over time.
And this one I have left it as a and b
but people can make their own and come up with their own labels on this and actually I think realizing that the model is
within their own grasp is - certainly it's kind of useful for me. I'm a mathematician
but I have to go and dig up my knowledge on these things and think,
"ah, how do I program this?" And it turns out to be not that hard particularly if the
computer will do the grunt work of solving the things for you.
- Ben, as a math guy, as you've been following this pandemic as it unfolds
and the way it's been covered in the media and social media and things like that -
how have you felt about the way that lay people are grasping the mathematics? And how well do you think it's being explained?
- I think it's hard to explain well, because like all maths it needs a bit of a run-up.
Even in this description I've been talking about differential equations.
If you're not sure what a rate of change or what differentiation is,
then that run-up needs to happen to make you comfortable with the rest of the explanation.
But the number of people who have been talking about exponential growth, logarithmic scales
which most Numberphile viewers will be familiar with, it turns out they're desperately important to discuss the sort of epidemics that we're seeing.
So it's been fascinating and sobering to realise sometimes in our mathematical world
we think we live in these abstract things, but this is desperately important in a very real-life way.
So that's both exciting for me as a maths educator, like people realise
this is important, and sobering because it does seem to be the crises when we notice that it's important.
When everything is running normally, we don't really notice that these models are important.
- So in the video description for this video,
I'm going to put some links to some files from Ben, more stuff that you can tweak and play around with. I'm also going to
link to some other YouTube videos that have been made by other
creators that are really good about what's going on with the Coronavirus and the pandemic.
But Ben, I want you to stay inside and go and wash your hands. - You too, Brady.
[Preview of next video]: A test, and you get that letter in the mail saying "You have tested positive for this disease."
If you get that letter, if you're anything like me, your stomach falls into your feet and you start to worry. A question that
mathematics can help us answer is, how worried do you really need to be? Maybe very worried, maybe not at all.