Geometric growth

Geometric growth arises in biology because organisms reproduce. Suppose we have a population of simple organisms (e.g., bacteria). At hour \(t\), the population is of size \(N_t\). Suppose that the organisms reproduce continually so that the population increases by a factor \(R\) after one hour. Then the population sizem \(N\) should obey \[N_{t}=R\,N_{t-1}.\] The following computes the population trajectory for 30 hours, assuming that \(R=1.1\) and the population size is initially 10. We accomplish this using a for loop:

R <- 1.1
t <- seq(from=0,to=30,by=1)
N <- numeric(length(t))
N[1] <- 10
for (h in seq_len(length(t)-1)) {
  N[h+1] <- R*N[h]
}

Let’s plot the trajectory:

ggplot(data=data.frame(t=t,N=N),mapping=aes(x=t,y=N))+geom_line()

Plot it on the log scale:

ggplot(data=data.frame(t=t,N=N),mapping=aes(x=t,y=N))+geom_line()+
  scale_y_log10()

Linear difference equations

Inhomogeneous linear difference equation

Now suppose that we add \(H\) organisms per hour. The population size \(N\) should then obey \[N_{t}=R\,N_{t-1}+H.\]

Exercise

Write a for loop to compute the population trajectory under this model. Assume that \(N_{0}=10\) and \(R = 1.1\) as before, and that \(H=5\). Plot the results. Estimate the growth rate in the long term.

Now solve the inhomogeneous equation analytically and plot the result. Compare it with your numerical results.

Second order linear homogeneous difference equation

Let’s now suppose that the organisms live about two hours and have reproductive rates that change over the course of their lives. One way to model this gives us the second order equation, \[N_{t} = R_1\,N_{t-1}+R_2\,N_{t-2}\]

Exercise

Write a for loop to compute the population trajectory under this model. Assume that \(N_{0}=10\) and \(N_{1}=20\) and that \(R_1 = 0.2\), \(R_2=1.1\). Plot the results. Estimate the growth rate in the long term.

Now solve the equation analytically and plot the result. Compare it with your numerical results.

Second order linear inhomogeneous difference equation

Let’s now add some immigration at a rate \(H\) per hour. We then have \[N_{t} = R_1\,N_{t-1}+R_2\,N_{t-2}+H.\]

Exercise

Write a for loop to compute the population trajectory under this model. Assume that \(N_{0}=10\) and \(N_{1}=20\) and that \(R_1 = 0.2\), \(R_2=1.1\), \(H=5\). Plot the results. Estimate the growth rate in the long term.

Now solve the equation analytically and plot the result. Compare it with your numerical results.

Nonlinear difference equations

If the reproduction rate depends on the population size, we obtain a nonlinear difference equation. For example \[N_{t}=\frac{R\,N_{t-1}}{1+a\,N_{t-1}}.\]

Let’s study the dynamics of this model using the nlfde1.R script. The script’s contents are as follows:

require(manipulate)

manipulate({
  t <- seq(from=0,to=tmax,by=1)
  N <- numeric(length(t))
  n <- N0
  N[1] <- n
  for (i in seq_len(length(t)-1)) {
    n <- R*n/(1+a*n)
    N[i+1] <- n
  }
  plot(t,N,type='l',ylim=c(0,1.1)*max(N))
},
R = slider(min=0,max=5,initial=1.1,step=0.01),
a = slider(min=0,max=1,initial=0,step=0.01),
N0 = slider(min=0,max=20,initial=1,step=1),
tmax = slider(min=0,max=100,initial=10,step=1)
)

Back to course schedule