Unconstrained Growth and Decay

Module 2.2 · Student follow-along

TipToday’s question

If a population grows at a rate proportional to its current size, how can we turn that idea into a simulation?

Where we are going

By the end of class, you should be able to:

  • tell the difference between an amount, a rate, and a change;
  • turn a differential equation into an update rule;
  • recognize the stock, flow, parameter, and initial condition in a model; and
  • build and graph a simple simulation in R.

First: make a prediction

A population begins with 100 individuals and grows continuously at a rate of 10% per hour.

Without calculating, predict the population after 8 hours:

  • less than 180;
  • between 180 and 240; or
  • greater than 240.

Then sketch the graph you expect. Will the population gain the same number of individuals every hour?

Name the pieces

Let \(P(t)\) be the population at time \(t\).

Symbol Meaning Units
\(P\) current population individuals
\(P_0\) initial population individuals
\(r\) per-capita growth rate per hour
\(t\) time hours
ImportantPause: what are we assuming?

What must be true for the population to keep growing this way? Think about resources, births and deaths, movement, and whether every individual is alike.

From words to mathematics

The population’s rate of change is proportional to the current population.

On the board, translate that sentence into an equation:

\[ \frac{dP}{dt} = \boxed{\phantom{rP}} \]

For a short time step \(\Delta t\), we approximate the change with

\[ \Delta P \approx \text{rate of change} \times \text{time step}. \]

Complete the update rule:

\[ P_{\text{new}} = P_{\text{old}} + \boxed{\phantom{rP_{\text{old}}\Delta t}} \]

WarningUnits check

If \(r\) has units of 1/hour, \(P\) has units of individuals, and \(\Delta t\) has units of hours, what units does \(rP\Delta t\) have?

Try one step by hand

Use \(P_0 = 100\), \(r = 0.10\) per hour, and \(\Delta t = 1\) hour.

\[ P_1 = \underline{\hspace{7em}} \]

Before doing a second step, answer this: should the next increase be the same size, larger, or smaller?

See the system

The population is a stock: an amount that accumulates. Growth is a flow: a rate that changes the stock.

flowchart LR
    S((source)) -->|growth = rP| P[Population P]

flowchart LR
    S((source)) -->|growth = rP| P[Population P]

The feedback loop matters:

\[ \text{larger population} \longrightarrow \text{more growth} \longrightarrow \text{larger population}. \]

Build the simulation in R

1. Choose the model settings

initial_population <- 100
growth_rate <- 0.10
time_step <- 1
end_time <- 8

Which of these is the initial condition? Which is the model parameter?

2. Create the time points

time <- seq(
  from = 0,
  to = TODO,
  by = TODO
)

time

How many values should time contain? Make a prediction before running it.

3. Make space for the results

population <- numeric(length(time))
population[1] <- TODO

population

Why does the initial population belong in position 1 even though time begins at 0?

4. Repeat the update

for (i in 2:length(time)) {
  old_population <- population[i - 1]
  growth <- TODO
  population[i] <- TODO
}

Read the loop aloud in plain English. What does one trip through the loop represent?

5. Put time and population together

results <- data.frame(
  time = time,
  population = population
)

results

Check the first two rows against the step you calculated by hand.

6. Graph the story

plot(
  TODO,
  TODO,
  type = "TODO",
  xlab = "Time (hours)",
  ylab = "Population",
  main = "Unconstrained growth"
)
ImportantStop and interpret
  • Did the result agree with your opening prediction?
  • Is the graph a straight line? Why or why not?
  • Where can you see positive feedback in the code?
  • What would make this model unrealistic?

If we have time: test the simulation

The differential equation also has an exact solution:

\[ P(t) = P_0 e^{rt}. \]

Add the exact solution to the results:

results$exact <- TODO

Then add it to the graph:

lines(results$time, results$exact, col = "darkorange", lwd = 3)

legend(
  "topleft",
  legend = c("simulation", "exact"),
  col = c("black", "darkorange"),
  lty = 1,
  lwd = c(1, 3)
)

Do the two curves agree exactly? What part of our simulation introduced the difference?

A smaller time step

Change time_step from 1 to 0.25 and run the model again.

  • What else in the code changes automatically?
  • Does the simulation move closer to or farther from the exact solution?
  • What do we gain—and what does the computer have to do more often?

Growth becomes decay

What single change would turn growth into decay?

growth_rate <- TODO

Before running the code, predict the graph’s shape. Does the model ever produce a negative population?

Before you leave

In one or two sentences, explain the update rule

\[ P_{\text{new}} = P_{\text{old}} + rP_{\text{old}}\Delta t \]

without using mathematical symbols.

TipThe big idea

A simulation repeatedly applies a small update. The update comes from the model—not from R. R simply helps us repeat it, store the history, and see the consequences.

Back to top