Math Insight

The logistic growth model

Math 2241, Spring 2023
Name:
ID #:
Due date: Feb. 22, 2023, 11:59 p.m.
Table/group #:
Group members:
Total points: 1
  1. Let $p(t)$ be the population size of a herd of elk in a forest, where the variable $t$ denotes time in years. Let $r$ be the net per-capita growth rate of the population, i.e., $r$ is the growth rate (due to births) minus the death rate. If $r$ is positive, the growth rate is greater than the death rate; if it is negative, the death rate is larger. A differential equation capturing the dynamics of the population is \begin{align*} \diff{p}{t} &= rp\\ p(0) &= p_0. \end{align*} (We could also have written the differential equation as $\diff{p}{t}(t) = r p(t)$ or as $p'(t) = rp(t)$, but we often neglect to write the time argument to make the equation look prettier). The quantity $p_0$ is called the initial condition, as it specifies the population size that we start with.

    We also call the differential equation a continuous dynamical system, as population size $p(t)$ changes continually at each moment in time. The variable $p$ is the state variable of the dynamical system.

    1. To be concrete, for now, let's set the (net) growth rate $r$ to $r=0.2$ so that the dynamic system is \begin{align*} \diff{p}{t} &= 0.2 p\\ p(0) &= p_0. \end{align*} Notice that for this differential equation, to know the rate of change $\diff{p}{t}$ at any moment $t$, we don't actually care about what the value of $t$ is (there is no $t$ directly in the right hand side of the differential equation). All we need to know is the value of the state variable $p$, and we can directly compute the rate of change $\diff{p}{t}$ (by multiplying by 0.2).

      If at $t=17$, the population size is $p(17)=1234$, what is $\diff{p}{t}$ at time $t=17$?
      $p'(17) = $

      If at the moment $t=31.987$, we knew that the population size was exactly $1234$ elk, what is rate of change in the population size at that moment?
      $p'(31.987) = $

      Typically, we are primarily interested in understanding the qualitative behavior of system rather than obtaining some formula to give us exactly what the population size will be at each time. In this case, we care if the population is growing or shrinking. If at some time $t$ (and again, it doesn't matter what that time is), the population contains $1234$ elk, the sign of $\diff{p}{t}$ is
      . Therefore, at that moment the population size is
      .

      To represent where $p$ is increasing and decreasing, we'll use a “phase line” diagram, where the phase line is just a representation of the different values that $p$ can take. Since the rate of change $\diff{p}{t}$ doesn't depend directly on time, we don't need to represent time at all on the phase diagram. The below applet shows a phase line for our system. Our goal is to show on this phase line where $p(t)$ is increasing, decreasing, or staying constant. (Although negative values of $p$ don't make biological sense, we include some negative values as it helps get a fuller picture of the behavior of the mathematical equations.)

      Feedback from applet
      direction vectors: correct directions:
      direction vectors: no stray vectors:
      equilibria: locations:
      equilibria: number of equilibria:
      equilibria: stability:
      solutions: final values:
      solutions: initial conditions:
      solutions: number of solutions:

      If $p$ is zero, then $\diff{p}{t}$ is
      so that the population size is
      . This means, if for some reason, the population size is zero, it will remain zero for all time (which makes sense if we aren't allowing elk from somewhere else to move in an colonize our empty forest). The value of the state variable $p=0$ is called an equilibrium.

      On the above phase line applet, increase $n_e$ to 1, as we have one equilibrium and move the resulting red point that appears to the location of the equilibrium ($p=0$).

      For the case that $r=0.2$, if $p$ is positive, then the sign $\diff{p}{t}$ is
      so that the population size is
      . We use vectors (arrows) to show where $p$ is increasing (i.e., $\diff{p}{t}$ is positive) and where it is decreasing. Since $p$ is increasing for all positive values, draw some rightward pointing arrows on the positive part of the phase line. On the applet, increase $n_v$ to reveal arrows that you can move to phase line. (The applet only requires one vector, but it looks nicer if you draw more short vectors spread over the phase line.) Make sure all arrows are completely on the phase line, as it doesn't make sense to have anything off the line.

      Although it doesn't make sense to have negative numbers of elk, if $p(t)$ were negative, the differential equation (with $r=0.2$) shows that in this case, the sign of $\diff{p}{t}$ is
      so that the population size would be
      to even more negative numbers of elk (whatever that means). Draw a leftward point arrow on the negative portion of the phase line to show this fact.

      Notice how the arrows are pointing away from the equilibrium at $p=0$. Since solutions move away from the equilibrium, we say it is unstable. To show it is unstable, click the point so that it is an unfilled circle.

      The last step is to use this information from the phase line to determine what a solution must look like. Let's start with the initial condition $p(0)=100$. If you look at the above phase line, when $p=100$, the arrows point to the
      , meaning the solution $p(t)$ must be
      . Since the arrows never change direction, it means $p(t)$ must keep increasing
      .

      On the above phase line, increase $n_s$ to one in order to plot a solution curve on the phase line. (Actually, the curve will have to be a straight line, since it going to be stuck on the phase line.) Drag the base of the vector representing the solution curve to the initial condition point, i.e., to $p=$
      . Although $p(t)$ should be increasing forever, you'll have to make it stop when you reach the end $p=1000$, so end the arrow there.

      If, on the other hand, the initial condition was $p_0=300$, will the solution look much different? Increase $n_s$ to two and plot what the solution starting at $p_0=300$ should look like with the resulting arrow.

      It's hard to visualize the solutions $p(t)$ on the phase line, since there is no representation of time $t$. It is just an arrow pointing right. Let's also plot the solutions $p(t)$ like we would normally plot functions, on a graph versus time, using the below applet.

      Feedback from applet
      Equilibrium stability:
      Final values:
      Found equilibria:
      Initial conditions:
      Number of curves:
      Valid shapes:

      Start by plotting the equilibrium $p(t)=0$ for all time $t$. Increase $n_c$ to one to show one curve. Since in this case, the $p$ axis is the vertical axis, the equilibrium corresponds to a horizontal line at the height $p=0$. Move all three points along the line $p=0$. The curve should turn red to show it is an equilibrium (a constant solution). To show that the equilibrium is unstable, click the curve so that it is a dashed curve.

      Next, plot the solution with initial condition $p(0)=100$. Increase $n_c$ to two and move the first point to the height of $p=100$. Since $p(t)$ must be
      , move the remaining two points to give the appropriate shape for the curve. Remember, $p(t)$ must increase without bound. For the applet to recognize that you mean it should keep increasing, make sure it curves upward and hits the upper edge of the graph.

      For the initial condition $p(0)=300$, the curve looks pretty the same. Increase $n_c$ to three to sketch that solution. (In reality, this solution curve should not cross the one you drew for $p(0)=100$, though the applet does not require the curves to avoid any crossing.)

    2. What changes if instead, if the death rate is larger than the growth rate, so the net growth rate becomes negative? Let's set $r=-0.2$ and analyze the dynamical system \begin{align*} \diff{p}{t} &= -0.2 p\\ p(0) &= p_0 \end{align*} in the same way as for the case with a positive $r$. The equilibrium is in the same location. However, in this case, when $p$ is positive, the rate of change $\diff{p}{t}$ is
      so that $p(t)$ must be
      . You should draw leftward pointing arrows on the phase line when $p$ is positive. On the other hand, when $p$ is negative, the rate of change $\diff{p}{t}$ is
      so that $p(t)$ is
      . The arrows should point rightward when $p$ is negative. Notice how the arrows are pointing toward the equilibrium $p=0$. Since nearby solutions move toward the equilibrium, the equilibrium is said to be stable, so leave the point for the equilibrium a filled in circle.

      Feedback from applet
      direction vectors: correct directions:
      direction vectors: no stray vectors:
      equilibria: locations:
      equilibria: number of equilibria:
      equilibria: stability:
      solutions: final values:
      solutions: initial conditions:
      solutions: number of solutions:

      What about the solution when $p(0)=300$? In this case, $p(t)$ must be
      . However can it past $p=0$? No, it must stop when it hits the equilibrium $p=0$, as we know that $\diff{p}{t}$ is zero there. The solution cannot cross an equilibrium. The same thing is true for the solution when $p(0)=900$. Both solutions stop when they get to $p=0$. Graph arrows representing these two solutions on the phase line.

      Graph the equilibrium and the two solutions for $p_0=300$ and $p_0=900$ on the below plot versus time.

      Feedback from applet
      Equilibrium stability:
      Final values:
      Found equilibria:
      Initial conditions:
      Number of curves:
      Valid shapes:

      In this case, the equilibrium is stable, so leave it as a solid red horizontal line. The solutions for $p(0)=300$ and $p(0)=900$ are always decreasing. They must slow down and get closer and closer to the equilibrium $p=0$ as time increases. Make sure the curves have this correct shape and end up essentially at the equilibrium $p=0$ by the time that they reach the right side of the graph.

    3. For this qualitative approach, the actual value of the parameter $r$ doesn't matter, only its sign. As long as the growth rate exceeds the death rate, then the net growth rate $r$ satisfies the inequality
      . For the growth-dominated regime, the phase line looks exactly like the phase line of part a. The solutions versus time have the same shape as part a: as long as we start with at least some elk (i.e., the initial condition is positive), the population size increases without bound and eventually
      . On the other hand, if the death rate exceeds the growth rate, then the net growth rate $r$ satisfies the inequality
      . In the death-dominated regime, the phase line and the solutions look like the phase line and solutions of part b. The population size always decays toward zero, and
      .

      You can read more about this exponential growth and decay that results from simple linear differential equations such as the one we explored here.

    4. Verify these results by simulating the differential equation using the R_script: run_linear_ode.R. This script assumes you have the R package deSolve installed on your computer. (To install via RStudio, select Install Packages from the Tools menu, type desolve in the Packages box and click Install.) Download the script run_linear_ode.R to a directory and run it. (One way is to type source("run_linear_ode.R") in the R console when you are in the same directory where you downloaded the file.)

      Running the script doesn't seem to do anything, but it defines the function run_linear_ode, which you can now call to have R simulate the linear differential equation that you've analyzed above. To run with $r=0.2$ and $p_0=100$ for $20$ years, run the commands

      results=run_linear_ode(r=0.2, p0=100, tmax=20)
      plot(results)
      

      Your plot should verify the results you obtained above. (See the comments at the beginning of the script for more information on how to use the script.) Such a script is overkill for this simple problem, as we can easily solve this differential equation without a computer. We provide the script so you can look at the script and explore its behavior, better preparing yourself for using R to solve more complicated equations.

  2. Now, let's imagine that the forest where the elk live can sustainably support at most a population of $K$ elk. We change the model for the dynamics of the elk population to a logistic growth equation \begin{align*} \diff{p}{t} &= rp\left(1-\frac{p}{K}\right)\\ p(0) &= p_0 \end{align*} where $r$ is the (net) low-density growth rate of the population, which specifies how fast the population would grow when the population size is small. The growth rate slows down as the population size gets closer to $K$, which is called the carrying capacity. (Notice how the factor in parenthesis gets small when $p$ is close to $K$.)

    For the logistic model, we're usually interested in a positive low-density growth rate $r$. With a positive $r$, the population size would grow without bound if one used the linear model $\diff{p}{t}=rp$. The idea is that the carrying capacity of the logistic model should limit growth when the population gets large and keep the population size under control.

    1. To be concrete, let's set $r=0.2$ and $K=5000$. We can use the phase line to analyze the behavior of the model for these parameters. On the below phase line, plot the equilibria of the logistic model and direction vectors on each segment of the phase line. If the equilibrium is stable (i.e., the nearby direction vectors point toward the equilibrium), draw it as a solid point; if the equilibrium is unstable (i.e., the nearby direction vectors point away from the equilibrium), draw it as an unfilled point. Lastly, sketch arrows representing solutions of the dynamical system for initial conditions $p(0)= 500$ and $p(0)=6000$. (If you need more guidance, see the following help section.)
      Feedback from applet
      direction vectors: correct directions:
      direction vectors: no stray vectors:
      equilibria: locations:
      equilibria: number of equilibria:
      equilibria: stability:
      solutions: final values:
      solutions: initial conditions:
      solutions: number of solutions:

      Translate your solutions onto a plot of the population size $p$ versus time $t$. Since the equilibria are constant solutions, plot them the same way as the other solutions. On the below graph, the equilibria will be horizontal lines. Represent stable equilibria with solid lines and unstable equilibria with dashed lines. (If you need more guidance, see the following help section.)

      Feedback from applet
      Equilibrium stability:
      Final values:
      Found equilibria:
      Initial conditions:
      Number of curves:
      Valid shapes:

  3. The qualitative analysis of the logistic equation couldn't tell us exactly what the solutions looked like. To get a more precise picture (and also to check our results), we can simulate the logistic equation on a computer.

    To get ready to simulate the logistic model in R, download the R script run_logistic.R and execute it in an R command shell. (One way to execute the file is to enter source("run_logistic.R") when you are in the directory where you saved the file.) Once you run the script file once, it will define the function run_logistic, which we will use to simulate the above logistic model. (We assume that you already have the R package deSolve installed on your computer.)

    1. Simulate the logistic model for $40$ years using the parameters $r=0.2$ and $K=5000$. To start a simulation, you must choose an initial condition $p_0$. For example, to simulate it with initial condition $p_0=1000$, run the command
      results = run_logistic(r=0.2, K=5000, p0=1000, tmax=40)
      Then to plot the results, you can run the command
      plot(results)
      However, R adjusts the plot so that the $y$-axis starts at 1000. To always include the origin and to keep the scale consistent for all plots, you can specify the limits for the $y$-axis manually with a command such as
      plot(results, ylim=c(0,6000))

      (See comments at beginning of script for more details on how to run it as well as how to look at the output results.)

      Simulate it starting with many different initial conditions $p_0 \ge 0$, including some smaller and larger than $5000$. Be sure to try setting the initial condition to each of the equilibria to verify you got the equilibria correct.

      Consistent with the phase line analysis, you should find that for most initial conditions $p_0 \ge 0$, the population size approaches the same value for large $t$. (If you start with a really small initial condition, you may need to simulate longer than 40 years by increasing tmax.)

      Summarize your results.
      As long as $p_0 >$
      , the population size approaches
      .
      If we start with $p_0=$
      , then the population size stays at
      .
      These results should be consistent with the qualitative analysis from the phase line.

      Does this make sense? (Optional.) (Show)
    2. If $r=0.2$ and $K=5000$, and the initial population size is $p_0=100$, how long does it take for the population to reach $p(t)=4000$ elk?
      years. (Your answer should be within 1 year of the correct answer; examine the output of the simulation to determine correct time. If needed, you can specify a value of nt in your call of run_logistic to increase the number of points where it displays the results.)

      If you increase $r$ to 0.4, how long does it take for the population to reach 4000 elk?
      years.

      If you leave $r$ at 0.2 but increase $K$ to 10000 and start with $p_0=200$, how long does it take for the population to reach 8000 elk?
      years.