# Lecture 1. Deterministic exponential growth

Slides: [pdf](https://www.dropbox.com/scl/fi/8ph47ej2iy0bxbasajjtr/L1.pdf?rlkey=sq3ukz3u0b6k2xjwmkwdqgqmb&dl=1) · [keynote](https://www.dropbox.com/scl/fi/hxvghi4gsqiczvnb7h0kq/L1.key?rlkey=fo4m5tzjmgoy3pmczt1lnj4gw&dl=1) · [powerpoint](https://www.dropbox.com/scl/fi/avfuoyz4fdpcgpibqgs2b/L1.pptx?rlkey=rjp8v5l3du41t4hpudrnubz7k&dl=1)
Notebook: [Colab](https://colab.research.google.com/drive/17b8pZ7ySXn7BRdd6GJLYDzh2BdZUbokV?usp=sharing)

---

## The simplest scenario birth and death

 Over a short interval $\Delta t$, the number of individuals changes by births and deaths, each proportional to the number of individuals present:

$$
n(t+\Delta t) = n(t) + \underbrace{b\,\Delta t\, n(t)}_{\text{births}} - \underbrace{d\,\Delta t\, n(t)}_{\text{deaths}} .
$$

Here $b$ and $d$ are **per-capita rates**, with units of $1/\text{time}$: $b\,\Delta t$ is the probability that a given individual reproduces in $\Delta t$ (this reading is what we will take seriously in [L2](l2.html)). Taking $\Delta t \to 0$,

$$
\boxed{\ \frac{dn}{dt} = (b-d)\, n = r\, n\ }
\qquad
n(t) = n(0)\, e^{rt} ,
$$

with **growth rate** $r=b-d$. The population grows if $r>0$ and declines if $r<0$. Only the difference $b-d$ appears: growth is degenerate with respect to the *turnover* $b+d$. Demographic noise ([L2](l2.html)) breaks this degeneracy.

Two derived quantities are more useful than $r$ itself:

$$
t_{\text{double}} = \frac{\log 2}{r} 
$$

### Discrete generations

[Exponential growth](https://en.wikipedia.org/wiki/Exponential_growth) is not an artefact of continuous time. Suppose instead that all individuals reproduce synchronously every $t_r$, each leaving $k$ offspring (and then dying — non-overlapping generations). Then

$$
n\bigl((g+1)t_r\bigr) = k\, n(g\,t_r)
\quad\Longrightarrow\quad
n(t=g\,t_r) = n(0)\, k^{\,g} = n(0)\, k^{\,t/t_r} = n(0)\,e^{rt} ,
$$

so that

$$
\boxed{\ r = \frac{\log k}{t_r}\ }
$$

In the ecological literature $k$ is the *[basic reproductive number](https://en.wikipedia.org/wiki/Basic_reproduction_number)* $R_0$ (expected offspring per individual per generation) and $t_r$ the generation time, so $r=\log R_0 / t_r$. 

### Orders of magnitude

$E.\ coli$ in good conditions: $r \approx 2\ \mathrm{h^{-1}}$, i.e. a [doubling time](https://en.wikipedia.org/wiki/Doubling_time) of $\log 2/2 \approx 20$ min. Starting from a single cell,

$$
n(6\,\mathrm{h}) = e^{2\cdot 6} \approx 1.6\times 10^{5} ,
\qquad
n(12\,\mathrm{h}) \approx 2.6\times 10^{10} .
$$

Humans: the growth rate of the world population is currently $r\approx 0.015\ \mathrm{yr^{-1}}$ (1.5% per year), so

$$
t_{\text{double}} = \frac{\log 2}{0.015\ \mathrm{yr^{-1}}} \approx 46\ \text{years} .
$$
using $t_r = 25y$ as generation time, we get $k = e^{r t_r} \approx 1.5$

## What fraction of all humans ever born is alive today?

A calculation that looks like arithmetic and is actually a test of a model. Take the discrete-generation picture, $n(g) = k^g$, starting from $n(0)=1$. The number of individuals that ever lived, up to and including the present generation $g$, is

$$
n_{\text{tot}} = \sum_{h=0}^{g} k^{h} = \frac{k^{\,g+1}-1}{k-1} ,
\qquad n_{\text{now}} = k^{\,g} .
$$

Therefore

$$
\frac{n_{\text{now}}}{n_{\text{tot}}} = \frac{k^{\,g}(k-1)}{k^{\,g+1}-1}
\ \xrightarrow[\ g\gg 1\ ]{}\
\boxed{\ \frac{k-1}{k}\ }
$$

and, equivalently, for every ancestor who ever lived there are

$$
\frac{n_{\text{now}}}{n_{\text{tot}}-n_{\text{now}}} = \frac{k^{\,g}(k-1)}{k^{\,g}-1} \xrightarrow[\ g\gg1\ ]{} k-1
$$

individuals alive today. The result is independent of the number of generations: under exponential growth a *finite fraction* of everyone who ever lived is alive right now. With $k=2$ it would be one half.

Now the data. Estimates put the number of *Homo sapiens* ever born at $\approx 117$ billion, against $\approx 8$ billion alive ([PRB](https://www.prb.org/articles/how-many-people-have-ever-lived-on-earth/)), so

$$
\frac{n_{\text{now}}}{n_{\text{tot}}} \approx 0.07
\quad\Longrightarrow\quad
k \approx 1.07 .
$$

Reproduction barely above replacement, averaged over 200,000 years. The current $r$ is *not* representative of human history: for almost all of it, growth was nearly flat, and the exponential we measure today is a recent anomaly (see the world population data on [Our World in Data](https://ourworldindata.org/grapher/population?yScale=log&country=~OWID_WRL)). The model is not wrong — it is being applied over a window where its parameters are not constant.

## Numerics: integrating $\dot n = f(n)$

The one equation in this course whose exact solution we know, which makes it the right place to learn how to integrate the ones we do not.

**[Euler](https://en.wikipedia.org/wiki/Euler_method).** Expand to first order:

$$
x(t+\Delta t) = x(t) + f\bigl(x(t)\bigr)\Delta t + O(\Delta t^2) .
$$

The local error per step is $O(\Delta t^2)$; over $t/\Delta t$ steps the **global** error is $O(\Delta t)$: first-order accuracy. For $\dot n = rn$ the scheme gives $n_{j+1}=(1+r\Delta t)n_j$, i.e. $n(t) = n(0)(1+r\Delta t)^{t/\Delta t}$, which converges to $n(0)e^{rt}$ only as $\Delta t\to0$ — and undershoots it for finite $\Delta t$.

**[Runge–Kutta 4](https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods).** Sample the slope four times inside the step:

$$
\begin{aligned}
\kappa_1 &= f\bigl(x(t)\bigr)\Delta t, &
\kappa_2 &= f\bigl(x(t)+\tfrac12 \kappa_1\bigr)\Delta t, \\
\kappa_3 &= f\bigl(x(t)+\tfrac12 \kappa_2\bigr)\Delta t, &
\kappa_4 &= f\bigl(x(t)+\kappa_3\bigr)\Delta t,
\end{aligned}
$$

$$
x(t+\Delta t) = x(t) + \tfrac16\bigl(\kappa_1 + 2\kappa_2 + 2\kappa_3 + \kappa_4\bigr) + O(\Delta t^5) ,
$$

with global error $O(\Delta t^4)$.

**In practice**, use [`scipy.integrate.solve_ivp`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html), which chooses $\Delta t$ adaptively from an error estimate. The point of coding Euler and RK4 by hand once is to know what the adaptive step is adapting.

## Exercises

1. A population doubles every 20 minutes. How long until a single cell reaches the mass of the Earth ($6\times10^{24}$ kg, cell mass $\sim 10^{-15}$ kg)? 
2. Suppose the per-capita rates are not constant but periodic, $r(t) = r_0 + A\cos(\omega t)$. What's the long-term growth rate?
3. With discrete non-overlapping generations and $k$ offspring, what fraction of all individuals ever born belongs to the last $j$ generations?
4. Overlapping generations. For the birth–death model $\dot n=(b-d)n$, compute the number of individuals ever born up to time $t$ and show that the fraction alive tends to $(b-d)/b$ at long times. Compare with $(k-1)/k$. What happens for $d=0$?
5. Download the [world population data](https://ourworldindata.org/grapher/population?yScale=log&country=~OWID_WRL) and estimate the fraction of humans ever born who are alive today. Population alone is not enough: what do you have to assume about births (e.g. generation time, or birth rate), and what about the time before the data start? How close to 7% do you get?

## References and material

- S. Strogatz, *Nonlinear Dynamics and Chaos*, ch. 1–2.
- Data on human population https://ourworldindata.org/grapher/population

## References

- R. Levins, [The strategy of model building in population biology](https://www.jstor.org/stable/27836590), *Am. Sci.* **54**, 421 (1966).
- T. R. Malthus, *An Essay on the Principle of Population* (1798).
- L. A. Jones, G. Montz, [Population increase and associated effects of zebra mussels](https://doi.org/10.3391/bir.2020.9.4.12), *BioInvasions Records* **9**, 772 (2020).
- M. N. Flynn, W. R. L. S. Pereira, [Population approach in ecotoxicology](https://doi.org/10.5132/eec.2013.01.011), *Ecotox. Environ. Contam.* **8**, 75 (2013).
