Skip to main content
Biology LibreTexts

5.1: Chapter Introduction

  • Page ID
    25447
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    \(\frac{1}{N}\,\frac{∆N}{∆t}\,=\,r\,+\,sN\) \(\leftarrow\,Difference\,equation\,model\)

    \(\frac{1}{N}\,\frac{dN}{dt}\,=\,r\,+\,sN\) \(\leftarrow\,Differential\,equation\,model\)

    Recall that the delta sign (∆) means change in or the difference. Compare the difference equation with the differential form, which uses the terminology \(dN\) and \(dt\). These represent infinitesimally small time steps, corresponding to our common-sense perception of time as divisible ever more finely without limit. In differential equations populations change smoothly rather than in finite steps—growth approximating that of organisms that can reproduce at any time, such as bacterial or human populations.

    It turns out that differential equations are harder for computers to solve than difference equations. Computers cannot make infinitely fine time steps, but have to approximate by using very small time steps instead. On the other hand, difference equations can be harder to solve mathematically.

    r=1; s=-0.001; N=1; t=0;

    dt=1; print(N);

    while(t<=20)

    { dN=(r+s*N)*N; N=N+dN; if (N<0) N=0; t=t+dt; print(N); }

    Above is computer code for a difference equation presented earlier, which leveled off at 1000, but with an addition in red. If the population is far above its carrying capacity, the calculation could show such a strong decline that the next year’s population would be negative—meaning that the population would die out completely. The addition in red just avoids projecting negative populations. Below is similar code for the corresponding differential equation, with the differences again in red.

    r=1; s=-0.001; N=1; t=0;

    dt=1/(365*24*60*60); print(N);

    while(t<=20/dt)

    { dN=(r+s*N)*N*dt; N=N+dN; if(N<0) N=0; t=t+dt; print(N); }

    This intends to model infinitely small time steps. Of course it cannot do that exactly, but must settle for very small time steps. Instead of \(dt\,=\,1\), for example, representing one year, it is set here to about one second, dividing 1 year by 365 days and each day by 24 hours, 60 minutes, and 60 seconds. This is hardly infinitely small, but for populations of bacteria and humans it is close enough for practical purposes. Still, it is important to check for negative populations in case the time step is not small enough.

    Figure \(\PageIndex{1}\). Differential logistic growth (maroon) compared with discrete (green). No dots appear on the differential form, since that represents infinitesimal time steps, whereas the difference form has a dot at each point calculated.

    How small is close enough to infinitely small? is the question. To find out, you can set the time step to something small and run the code, which will produce a set of population values through time. Then set the step smaller still and run the code again. It will run more slowly because it is calculating more steps, but if essentially the same answer appears—if the answer “converges”—then you can make the step larger again, speeding the calculation. With a few trials you can find a time step that is small enough to give accurate answers but large enough to allow your code to run reasonably fast.

    Figure \(\PageIndex{1}\) shows the results of running the differential equation version of the program (the second one above, in maroon) versus the difference equation version (the first above, in green). The differential equation has the same parameters and general shape, but the population approaches its carrying capacity more quickly. Because the differential time steps produce offspring earlier—not waiting for the end of the step— offspring are available to reproduce earlier, and so forth.

    This particular method for differential equations is called “Euler’s method” (pronounced “Oiler’s”), a basic approach not often used in the twentieth century because computers not so long ago were millions of times slower than they are now. Today this method is often fast enough, and is desirable because of its relative simplicity.

    (By the way, calculating bacterial growth for five days with one-second time steps will be fast enough in any programming language. At the time we are writing this (second decade of the twenty-first century), calculating growth for a human population, second-by-second for 20 years, doing the same for 20 years second by second for humans will be too slow in R, tolerable in AWK, and plenty fast in C, Java, or other high-speed languages.)


    This page titled 5.1: Chapter Introduction is shared under a CC BY-NC 4.0 license and was authored, remixed, and/or curated by Clarence Lehman, Shelby Loberg, & Adam Clark (University of Minnesota Libraries Publishing) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.