Systems of Differential Equations

A Predator-Prey Model

The traditional "predator-prey" model involves modelling the populations of predators and their prey.  The changes in populations are related: more prey feed more predators, but an overpopulation of predators can lead to depletion of prey, causing a depopulation of predators...  The problem simulated below is a take-off on the traditional one.

This is a model for what fraction of the MIT population would know a particular joke, the joke is told a fraction of the time when a person who has heard it meets someone who hasn't. The rate of joke spreading is proportional to how funny it is.

It is a closely held secret that Susan Hockfield, MIT's president, has an odd sense of humor--she will not let anyone graduate who cannot tell him the joke on graduation day.  This often is a source of embarassment and confusion to the happy families.

JokeFunniness  =  0.66;
JokeSpreadRate[Naive_ ,  Jaded_]  := 
      JokeFunniness*Naive*Jaded

Some people who have heard the joke forget it, depending on how forgetful they are:

PopulationForgetfullness  =  0.2;
ForgotJoke[Naive_ ,  Jaded_]  := 
      PopulationForgetfullness*Jaded

A certain fraction of new students added to the population each day who presumably don't know the joke, the graduation rate is proportional to the entrance rate and the fraction of those who know the joke.

FreshmanEntranceRate  = 0.24;
GraduationRate[Naive_ ,  Jaded_]   =  
        FreshmanEntranceRate*Jaded;

The fraction of students who remain naive tomorrow is

TomorrowsNaive[TodaysNaive_, 
        TodaysJaded_]  :=  TodaysNaive + (FreshmanEntranceRate/365) - JokeSpreadRate[
              TodaysNaive ,  TodaysJaded]/365

The fraction of students who will know the joke tomorrow is

TomorrowsJaded[TodaysNaive_, TodaysJaded_]  :=  
      TodaysJaded  +  
        JokeSpreadRate[TodaysNaive ,  TodaysJaded]/365  -  
        ForgotJoke[TodaysNaive ,  TodaysJaded]/365   -  
        GraduationRate[TodaysNaive ,  TodaysJaded]/365

The population evolves each day as

TomorrowsPopulation[{TodaysNaive_, TodaysJaded_}] := {TomorrowsNaive[
          TodaysNaive ,  TodaysJaded], 
        TomorrowsJaded[TodaysNaive ,  TodaysJaded]}

Calculate the population after 5000 days from now if currently 1/5 of the students are naive and 4/5 of the students are in the know.

NestList[TomorrowsPopulation, { .2,  .8}, 5000] // Short

Now do a longer calculation with the initial naive fraction 0.24 and the jaded fraction 0.76, and use ListPlot to display the trajectory on the naive–jaded plane. Note how the trajectory spirals in to a specific point in the plane. This is an example of a critical point at which the rates of change of each population become zero.

ListPlot[NestList[TomorrowsPopulation, { .24,  .76}, 20000], 
      PlotRange -> All, PlotJoined -> True, 
      PlotStyle -> {Hue[Random[]], Thickness[0.005]}, 
      AxesLabel -> {"Naive", "Jaded"}]

Now calculate trajectories for a variety of initial conditions for the jaded and naive populations, selected randomly, then plot them on the naive–jaded plane:

graphicslist  = 
      Table[ListPlot[
          NestList[TomorrowsPopulation, {Random[], Random[]}, 20000], 
          PlotRange -> All, PlotJoined -> True, 
          PlotStyle -> {Hue[Random[]], Thickness[0.005]}, 
          DisplayFunction -> Identity], {i, 1, 10}]

Show[graphicslist, DisplayFunction -> $DisplayFunction, 
      AxesLabel -> {"Naive", "Jaded"}]

Note that all starting points produce trajectories that converge on the same critical point. This is an example of a system of equations that exhibits a stable critical point.
Note also that some of the trajectories take the system into unphysical states where one of the populations exceeds a fraction of 1!

Analysis of Stability of the Predator-Prey Model

The model above can be written as the system of ODEs:
(dN/dt) = α - ρ N J
(dJ/dt) = -αJ  +  ρ N J  - ϕJ

Find the fixed points:

Ndot  =  α - ρ N J
Jdot  =  -α J + ρ N J - ϕ J

fixedpoint  =  
      Solve[{Ndot == 0,  Jdot == 0}, {N, J}] // 
        Flatten

The next final part of this notebook examines the stability of the critical point for this problem. This is discussed in Kreyszig AEM, pp. 170–174.  Kreyszig describes the stability analysis in terms of an eigenvalue problem. The matrix for which eigenvalues are calculated is the "Jacobian" defined below. It is the same as the matrix A in Kreyszig's Eq. (1) on p. 170.

Define the general Jacobian

Jacob  =  {
{D[Ndot, N],  
            D[Ndot, J]}, 
{D[Jdot, N],  
            D[Jdot, J]}
};
Jacob // MatrixForm

Find the Jacobian at the fixed point:

JacobFixedPoint  =  
        Simplify[Jacob /. fixedpoint];
JacobFixedPoint // MatrixForm

Approach 1: Compute parameters p, q, and Δ defined in Kreyszig's Eq. (7) on p. 171:

Kreyszigp = 
      JacobFixedPoint[[1, 1]] + JacobFixedPoint[[2, 2]]

pValue = 
      Kreyszigp /. {α ->  
            FreshmanEntranceRate,  ρ  ->  
            JokeFunniness,  ϕ  ->  
            PopulationForgetfullness}

Kreyszigq  =  Simplify[Det[JacobFixedPoint]]

qValue  =  
      Kreyszigq /. {α ->  
            FreshmanEntranceRate,  ρ  ->  
            JokeFunniness,  ϕ  ->  
            PopulationForgetfullness}

DeltaValue =  (pValue^2) - 4 qValue

According to Kreyszig's Eq. (9) on p. 172, when p ≠ 0 and Δ < 0, the critical point will be a spiral point. In addition, according to Kreyszig's Eq. (10) on p. 173, when p ≤ 0 and q > 0, the critical point will be stable. These findings correspond to what we observed on the trajectories plotted above.

Approach 2: Compute eigenvalues of the Jacobian at the fixed point and use them in a way not described in Kreyszig...

evals  =  Eigenvalues[JacobFixedPoint]

The Eigenvalues will always have a negative real part because the input parameters are positive real coefficients

Considering the parameters used above, the solution is attracted to the fixed point but oscillates

MitEvals  =  
      evals /. {α ->  FreshmanEntranceRate,  ρ  ->  
            JokeFunniness,  ϕ  ->  
            PopulationForgetfullness}

The Oscillation perioid is about 18 years

2 π /Im[MitEvals[[1]]]