zombies! appm 2360 project 3€¦ · zombies! appm 2360 project 3 hayden foote - section 549/212...

16
Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213

Upload: others

Post on 30-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

Zombies!

APPM 2360 Project 3

Hayden Foote - Section 549/212

Joe Lopez - Section 549/223

Jarrod Puseman - Section 549/213

Page 2: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

1. Introduction

Very recently, a zombie outbreak has taken control of the continent. We are the last

surviving scientists with enough knowledge of differential equations to stop this epidemic.

Therefore, we will use a system of differential equations to model and predict the number of

surviving humans and the number of zombies with time, in an effort to analyze the consequences

of this plague and suggest strategies to combat it. We will use a model derived from the popular

SIR epidemic model, modified slightly for the unusual conditions of this disease. Specifically,

we make the assumption that the outbreak happens on a fast enough timescale to make the

natural birth and death rate negligible. Second, we assume zombies cannot give birth, that

humans can kill zombies, and that any deceased human or zombie is placed into a “removed”

class, where any member of this class can become a zombie. Thus, we have the system:

− ZSdtdS = β (1)

ZS (N ) ZSdtdZ = β + γ 0 − S − Z − α (2)

Where is the rate at which humans kill zombies, is the rate at which new zombies areα β

infected, is the rate at which removed individuals are revived as zombies, and is the totalγ N 0

population of humans and zombies. Analyzing the equilibrium points of this system can show us

the long term outcomes of the system. The system can also be modified to include and test

various methods of stopping the outbreak.

2. Analysis

The first step in understanding the human-zombie system is to find the nullclines of the

system of differential equations given by

1

Page 3: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

− ZSdtdS = β (3)

ZS (N ) ZSdtdZ = β + γ 0 − S − Z − α (4)

Solving gives Z = 0, S = 0. This logically makes sense; the number of humans− ZSdtdS = 0 = β

will not be changing if there are no zombies in the first place to infect humans (and also no

‘removed’ humans to rise as zombies), or if there are no more humans around, since humans can

only be removed or turned into zombies, and cannot be added into the system in any way, since

we assume the birth rate to be 0. Even if we assumed the birth rate to be non-0, once there are no

more humans, they can’t give birth anyway.

Solving to find the S-nullclines (see Appendix 1.1) gives the nullclinedtdZ = 0

Z = γ(S−N )0(β−α)S−γ (5)

Graphing these nullclines gives the plot below, assuming both Z and S are always

between 0 and This particular graph is made using the parameters given in the ‘SZR.N 0

Parameters’ table.

The S-nullcline seems to suggest an interesting phenomenon. This curve represents the number

of zombies that will result in no change in the number of zombies for a given number of humans.

2

Page 4: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

However, it is only non-negative at two points; when Z=0 and S = , and when andN 0 Z = N 0

S=0. At all other points, the S-nullcline is negative. This indicates that as long as there are either

zombies or ‘removed’ humanoids, the number of zombies will continue to change (and, more

specifically, will continue to grow), since the number of zombies can never be negative. This

makes sense, just thinking about the conditions; if there are any living humans, they will

gradually be converted into zombies, and any removed humanoids will gradually be converted

into zombies as well.

To evaluate the stability of the equilibrium points, we can use the Jacobian matrix of the

system, defined as

For our system, this is

If we evaluate the Jacobian at the equilibrium points, we get

By evaluating the eigenvalues of these matrices, the stability of the equilibrium points can be

determined. For , the eigenvalues are and . For , the eigenvalues are|J(0,N )

0N− β 0 − γ |J (N ,0)0

and (See Appendix 1.2 for the2((β−α)N −γ)+0 √((β−α)N −γ) +4βN γ0

20

2((β−α)N −γ)−0 √((β−α)N −γ) +4βN γ0

20

derivation of these eigenvalues).

3

Page 5: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

If at least one eigenvalue associated with an equilibrium point is positive, that

equilibrium point is classified as unstable. First consider the eigenvalues for (0, ), the allN 0

zombies, no humans case. These eigenvalues are and . Since it is given that all ofN− β 0 − γ

these parameters must be greater than 0, these two eigenvalues with both always be negative.

Thus, the equilibrium point is stable. On the other hand, the parity of the eigenvalues for ( , 0)N 0

is much less obvious. These eigenvalues are and2((β−α)N −γ)+0 √((β−α)N −γ) +4βN γ0

20

. Consider the discriminant, . This is2((β−α)N −γ)−0 √((β−α)N −γ) +4βN γ0

20 βN γ((β )N )− α 0 − γ 2 + 4 0

necessarily positive, as it consists of real numbers being squared (which must be positive) and a

positive constant times parameters which are defined as being greater than 0. As well, this is will

always be larger than since it is that term added in quadrature with another term.((β )N )− α 0 − γ

This means the eigenvalues are some real number plus or minus another real number larger in

magnitude than the first real number, divided by 2. This will result in one positive eigenvalue

and one negative eigenvalue for all values of the parameters. Therefore, this equilibrium point,

, is always unstable.N , )( 0 0

In the context of the model, this means that, in the long run, humanity is doomed. No

matter how effective humans are at fighting off zombies, they will eventually be overrun, since

solutions to the system are all eventually drawn towards the all-zombies scenario. It is worth

mentioning, however, that none of these models take human reproduction into account; if a

solution can be found that allows humans to survive long enough for their reproductive ability to

become relevant, there may be a stable equilibrium solution that still has humans alive - in other

words, a point of zombie-human coexistence.

4

Page 6: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

If we solve this system numerically using MATLAB (See Appendix 1.3), we produce the

model plotted below. This code simply creates a matrix with in the top line and in theSd Zd

bottom line. Then, Using the @ operator in MATLAB and our szr() function to make this

matrix, we create a differential equation we can pass into the ode45() function in MATLAB.

Choosing to enter specific parameters such as our time span and initial conditions, we can get

back from this function a set of vectors containing the numerical solution to the input values

which can then be plotted for inspection.

5

Page 7: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

This model does not appear to approach any of the equilibrium solutions; rather, it seems

that both the zombie and removed categories become asymptotically stable very quickly, around

15,000 and 35,000, respectively. However, knowing what is known from the eigenvalues, this is

misleading. A simple nullcline analysis, as done earlier, quickly shows that (0, 1.5) is not an

equilibrium point, so reasonably, this short snapshot of 35 days is not a complete picture of the

long-term behavior of the system. In fact, because neither of the Jacobian eigenvalues are

positive when evaluated for the point (0, ), when using the parameters used to create thisN 0

model, we know that that equilibrium point is stable and will attract nearby solutions. Therefore,

we can conclude that over a long time, the entire population of humanoids will become zombies.

Intuitively, this makes sense; removed humanoids will gradually become zombies, and, without

any living humans around to remove them, zombies will just keep being zombies, so once all of

the living humans are gone, everything will become zombies, however slowly.

3. The Antidote

Suppose we introduce an antidote to this system that converts zombies back to

susceptible humanoids. If we suppose we can do this at a rate of ⍴ [1/day], then we obtain the

following modified set of differential equations:

− ZS ZdtdS = β + ρ (6)

ZS (N ) ZS ZdtdZ = β + γ 0 − S − Z − α − ρ (7)

If we solve this numerically as before with a slight modification to the szr() function, we

obtain the plot below (See Appendix 1.3 for code). Based on the plot, it appears this strategy is

effective at getting rid of the zombies, but the susceptible population mostly dies off in the

process (becoming part of the removed population). Overall, it is not an effective solution for

6

Page 8: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

saving humanity because almost 90% of humanity appears still to become removed. However, it

is effective in the sense that it does manage to stop the complete extinction of mankind.

To examine the long-run behavior of this system, we want to consider the equilibrium

solutions of the system. These solutions are found in appendix 1.4. One of these solutions is the

same - ( ) - the no-zombie scenario. However, one of the Z-nullclines has changed, and, 0N 0

is now a nullcline. When these nullclines are equated, the equilibrium points are found toS = βρ

be and ( ). When evaluated numerically using the given parameters, these, )(N 0 0 ,βρ γ( −N )ρ

β 0

(β−α) −γ−ρρβ

points are (50,000 , 0) and (13,333.33 , 2.75). This means that there is indeed an equilibrium

solution where humans survive (and zombies survive too), although both in fairly small

7

Page 9: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

quantities. Evaluating the eigenvalues of the Jacobian at these points using MATLAB gives

-0.0001 and -0.1333 for (13,333.33 , 2.75) and 0 and .6 for (50,000 , 0) (See Appendix 1.3 for

this code). This indicates that the all-humans scenario is still unstable; however, the other

scenario, with both a few humans and a couple of zombies, is stable. This means that with the

antidote, while human population will be severely reduced, long-term survival is possible.

4. A New Strategy

Based on the fact that any individual in the removed category may be revived as a

zombie, we notice that removing deceased individual's ability to turn into zombies may be an

effective strategy, as this will slow the spread of zombies. Thus, we propose shooting any

deceased individual into space so that they no longer able to reincarnate as a zombie (because the

effects of gravity allow the removed population to slowly reincarnate as zombies) and do not

endanger the surviving humans. To model this, we must modify our system. We will assume any

individual in the removed class to be quite literally “removed,” as they are no longer on Earth.

To account for this, we simply set , so that removed individuals are no longer revived asγ = 0

zombies. This gives the following systems:

Without using the antidote, we have

− ZSdtdS = β (8)

ZS ZSdtdZ = β − α (9)

If we continue using the antidote in addition to our new strategy, we have

− ZS ZdtdS = β + ρ (10)

ZS ZS ZdtdZ = β − α − ρ (11)

8

Page 10: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

We can analyze these systems as well to asses the effectiveness of both strategies.

Solving each system numerically with MATLAB in the same fashion as before (See Appendix

1.3 for this code) produces the following graphs:

9

Page 11: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

Immediately, we notice there is not a large difference between these graphs and the

previous ones. Unfortunately, because removed individuals were revived at such a low rate to

begin with, this strategy does not have a very large effect on the system. It does definitely help,

as it ensures that once an individual is deceased, they are truly removed and not able to worsen

the situation. However, this effect is not prominent enough to change anything significantly and

it will be up to the government to decide whether or not the small benefits associated with this

strategy are worth its implementation. This method would be far more effective if zombies

revived at a rate 𝛾=0.1 instead of .00001. If we alter our situation to adopt 𝛾=0.1 and plot each of

our four possibilities, we see how effective shooting the removed population into space actually

can be. See the difference below.

10

Page 12: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

5. Conclusion and Recommendations to the President

Dear Mr. President,

As you are aware, our team has been slaving away trying to model this zombie outbreak. Much

to our satisfaction, we have succeeded. The models presented here seem to be pretty cool.

Moreover, they are actually useful if you are trying to observe the effectiveness of a cure.

Without a cure, of course, most of humanity is doomed and disappears relatively rapidly (about

15 days if one zombie is released in the world of about 50,000 people). With a cure, however, we

can manage to save a part of the population and get some control over the zombie population.

Also in case you were wondering, Mr. President, shooting the zombie corpses into space

is not an effective solution. Removing their ability to become zombies again had little effect on

the overall population numbers, and this would cost much more time and money than it would be

worth. If more zombie corpses were returning to “alternative life”, however, this solution would

be highly effective.

Hoping You Have a Plan,

The Zombie Modelers

11

Page 13: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

6. Appendices

1.1 SZR Nullclines

ZS (N ) ZSdtdZ = β + γ 0 − S − Z − α = 0

ZS N S Z ZS0 = β + γ 0 − γ − γ − α

βS S)Z N S0 = ( − γ − α + γ 0 − γ

γS−γN0βS−γ−αS = Z

Z = γ(S−N )0(β−α)S−γ

1.2 Jacobian Eigenvalues

In both cases, we set the determinant of and solve for . ForJ I)( − λ = 0 λ This is − N )(− ) ((β )N ) 0( β 0 − λ γ − λ − 0 − α 0 − γ =

Which implies .− N )(− )( β 0 − λ γ − λ = 0 − N ,λ = β 0 − γ

For

We have − )((β )N ) (− N )(− ))( λ − α 0 − γ − ( β 0 γ = 0

(β )N )λ N γλ2 − ( − α 0 − γ − β 0 = 0

Then, using the quadratic formula, we have .λ = 2((β−α)N −γ)±0 √((β−α)N −γ) +4βN γ0

20

12

Page 14: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

1.3 Code

A. szr() Function

function dydt = szr(t, y, alpha, beta, gamma, N0) % Evaluates the right hand side of the SZR model for %equations S(t) and Z(t). % Here, y(t) = [S(t); Z(t)], so y(1) = S(t) and y(2) = %Z(t). dydt=[-beta*y(1)*y(2);beta*y(1)*y(2)+gamma*... (N0-y(1)-y(2))-alpha*y(1)*y(2)]; End

B. szr2() Function

function dydt = szr2(t, y, alpha, beta, gamma, N0, p) % Evaluates the right hand side of the SZR model for equations S(t) and %Z(t). % Here, y(t) = [S(t); Z(t)], so y(1) = S(t) and y(2) = Z(t). dydt = [-beta*y(1)*y(2)+y(2)*p; beta*y(1)*y(2) + gamma*(N0 - y(1)... -y(2))-alpha*y(1)*y(2)]-p*y(2); end

C. Script to run all cases and plot data clear all; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Assign parameter values alpha = 0.00001; beta = 0.00003; gamma = 0.00001; N0 = 50000; initialZombie=1; % Set length of simulation tspan = [0 35]; % Set initial conditions y0 = [N0-initialZombie; initialZombie]; % Solve system [t,y] = ode45(@(t,y) szr(t,y,alpha,beta,gamma,N0), tspan, y0); hold on plot(t,y(:,1),'b') plot(t,y(:,2),'g') plot(t,(N0-y(:,1)-y(:,2)),'k') legend('Susceptible','Zombies','Removed') title('Zombie Overtaking') ylabel('Humanoids') xlabel('Time (Days)') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Introduce Antidote p=.4; % Solve system [t2,y2] = ode45(@(t2,y2) szr2(t2,y2,alpha,beta,gamma,N0,p), tspan, y0); figure hold on

13

Page 15: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

plot(t2,y2(:,1),'b') plot(t2,y2(:,2),'g') plot(t2,(N0-y2(:,1)-y2(:,2)),'k') legend('Susceptible','Zombies','Removed') title('Zombie Overtaking, Antidote') ylabel('Humanoids') xlabel('Time (Days)') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Shoot zombies into space, no antidote % Assign parameter values alpha2 = 0.00001; beta2 = 0.00003; gamma2 = 0.00000; p2=0.0; % Solve system [t3,y3] = ode45(@(t3,y3) szr2(t3,y3,alpha2,beta2,gamma2,N0,p2), tspan, y0); figure hold on plot(t3,y3(:,1),'b') plot(t3,y3(:,2),'g') plot(t3,(N0-y3(:,1)-y3(:,2)),'k') legend('Susceptible','Zombies','Removed') title('Zombie Overtaking, No Antidote, Zombies to Space') ylabel('Humanoids') xlabel('Time (Days)') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Zombies to space, antidote p3=0.4; % Solve system [t4,y4] = ode45(@(t4,y4) szr2(t4,y4,alpha2,beta2,gamma2,N0,p3), tspan, y0); figure hold on plot(t4,y4(:,1),'b') plot(t4,y4(:,2),'g') plot(t4,(N0-y4(:,1)-y4(:,2)),'k') legend('Susceptible','Zombies','Removed') title('Zombie Overtaking, With Antidote, Zombies to Space') ylabel('Humanoids') xlabel('Time (Days)')

D. Script to give eigenvalues of the antidote system’s Jacobians evaluated at the equilibrium points

14

Page 16: Zombies! APPM 2360 Project 3€¦ · Zombies! APPM 2360 Project 3 Hayden Foote - Section 549/212 Joe Lopez - Section 549/223 Jarrod Puseman - Section 549/213 . 1. Introduction Very

%This script finds the eigenvalues of the jacobian matrices for the %system with antidote. A = [-8.25*10^-5, 10^-7; 4.8*10^-5, -0.1333434]; B = [0, 1.9; -0.00001, 0.599999]; disp(eig(A)) disp(eig(B))

1.4 Antidote Nullclines and Equilibria

− ZS ZdtdS = β + ρ

To find the Z-nullclines, we set this equal to 0.

ZS ρZ0 = − β +

(− S )0 = Z β + ρ

Z = 0 is a solution; so is S= . These are the Z-nullclines.βρ

ZS (N ) ZS ZdtdZ = β + γ 0 − S − Z − α − ρ

To find the S-nullclines, set this equal to 0.

0 = ZS (N ) ZS Zβ + γ 0 − S − Z − α − ρ

βS S )Z N S0 = ( − γ − α − ρ + γ 0 − γ

Z = γ(S−N )0(β−α)S−γ−ρ

To find equilibrium points, equate the nullclines:

Z = 0 = γ(S−N )0(β−α)S−γ−ρ

This means there is an equilibrium point at ( ., )N 0 0

S = βρ

Z =γ( −N )ρ

β 0

(β−α) −γ−ρρβ

15