## Roteiros

### Matemática & Estatística

en:ecovirt:roteiro:math:exponencial

# Growth rates and the exponential function - Tutorial in spreadsheets

This tutorial is an informal walk through the main steps for deducing the exponential growth model. With it, we arrive at one of the first principles for ecology: in the absence of external forces, a population will grow or decrease exponentially.

## From discrete to continuous time

It may be more comfortable to think in changes in the population size in discrete intervals: we count the number of individuals at a given time, and repeat the count in the following time steps. This dynamic is described in the geometrical model, in which the population grows without bounds.

But how long do we wait between one census and another? If the births and deaths can occur at any time is a good idea to census the population on very short intervals. This script will show that the continuous time is just another way of thinking in discrete time: we make the intervals as small as we want. This will be our starting point to derive the exponential growth model, with the help of some computer tools.

### Discrete time

Let's see the initial growth phase of a bacteria population in this video1):

Now let's try to describe the number of observed bacteria at every time interval:

TimeN. of bacteria
0 2
1 4
2 8
3 16
4 32
5 64
14 16384
30 1073741824
601152921504606846976

It may be hard to understand what's happening with just this table. A graph may help:

Exercises

Let's build the plot
• write time in the first column A
• write a sequence form 1 to 10 to represent the time intevals
• write nbact in the first cell of the column B;
• write the formula =2^A2 in the B2 cell and press ENTER;
• paste the formula to the other cells below

Notice that we have counts of the population size in discrete time intervals. Another way of describing this data is by asking

• How fast is the population growth or,
• What is the bacteria growth speed

### Intuitive notion for derivatives

To express how much the population varies in a given time period, we can calculate the population variation rate from time $t$ to that time plus an interval $\Delta t$:

Variation rate $= \frac{{N(t + \Delta t) - N(t)}}{\Delta t}$

Or: take the number of bacteria in two times and divide the difference by the time elapsed.

But this $\Delta t$ is arbitrary. If the population has well-defined reproductive periods (i.e., annual), this observation interval may be a good choice. But what if births and deaths can occur at any point in time? The smaller our observation interval, the more precise will be our description of the population dynamics. In these cases, we should make the $\Delta t$ be as close to zero as we can.

But if we approach zero time interval, then ${N(t + \Delta t) - N(t)}$ should also go to zero, as the population sizes in both instants will be very close to each other. So the final result should be something like $0/0$?

Let's see if this logic is correct. First, suppose we have a population whose size is equal to the square of the elapsed time ( $N(t)= t^2$ ), then let's reduce the value of $$\Delta t$$ to see what happens with the variation rate on time t=1:

Decreasing $\Delta t$

time = 1
• write t in the first cell of the column (A) and 1 (one) in the following seven lines below in the same column;
• in the second column (B), write dt (delta time) in the firs cell;
• write the following numbers in the second column: 0.5,0.1,0.01,0.001,0.0001,0.00001,0.000001
• in the third column (C), write tdt (delta time + time);
• include the formula =A2+B2 in C2 cell;
• in the fourth column D write Nt (population size in time t);
• include the formula =A2^2 in D2 cell;
• in the fifth column (E) write Ntdt (population size in time t + dt);
• include the formula =C2^2 in E2 cell;
• in the last column F, write (Ntdt-Nt)/dt and include the formula =(E2-D2)/B2 in the cell F2;
• drag the C2 until F2 cells until the line 8 to copy the formulas
2. Redo the same procedure to times 2 to 5, copying side-by-side the columns just modifying the time column.
3. Observe what happens with the growth rates as time interval decreases.

Strangely, the values seem to converge to 2, and not to 0! Try it a few more times to other values of time.

Notice that the values converge in the following fashion when $\Delta t \rightarrow 0$:

t ${N(t + \Delta t) - N(t)} / {\Delta t}$
1 2
2 4
3 6
4 8
5 10

That means the instantaneous growth rate for $t^2$ is approximated by $2t$ when $\Delta t$ is near zero. We just found out the derivative of the function $N(t)=t^2$!

#### Definition of a derivative

The derivative of a function $X(t)$ is defined as its instantaneous growth rate, obtained by the limit of the variation rate:

$\frac{X(t + \Delta t) - X(t)}{\Delta t}$

when $\Delta t \to 0$ 3). One way to represent a derivative is in the notation of a rate over time:

$$\frac{dX}{dt} = \lim_{\Delta t \to 0} \frac{X(t + \Delta t) - X(t)}{\Delta t}$$

## Exponential growth

A simple way of thinking about derivatives is that they represent instantaneous velocities. The speedometer of a car shows the derivative of its position! Thinking about this analogy, let's study the speed of growth of our bacteria:

TimeN. of BacteriaSpeed
0 2
1 4 2
2 8 4
3 16 8
4 32 16
5 64 32

The bacteria double at each time interval. So, if the population doubles, the growth speed also doubles. If it is multiplied by 4, the speed will be multiplied by 4, and so on. That means that the growth speed is proportional to the population size.

As we're talking about instantaneous speeds, let's represent this proportionality with a derivative:

(1) $${dN}/dt= rN$$

Here, the constant of proportionality $r$ is called the population intrinsic growth rate, that is, how much each individual contributes to the instantaneous variation in the population size. This is the simplest population growth model.

This model is a differential equation, as it sets an equality relation between the derivative of a function (left size) and an algebraic expression on the right hand side of the equation. In other words, this model says some function for the population size $N$ has a derivative proportional to itself. A function that has this property is a solution for this equation. One such function is:

(2) $$N_t=N_0e^{rt}$$

This is the exponential growth function! Let's see how did we arrive here.

### Solutions for differential equations

A first order differential equation is a relation between the derivative of a function and some mathematical expression. Solving one equation like this means finding some function whose derivative satisfies the proposed relation.

The problem is: there is no easy algorithm to find these functions. There are several rules and tables that relate the most common derivatives with the corresponding functions (the “antiderivatives”). Other than those, a lot of mathematical manipulation it is generally needed to express a differential equation in terms of those simple functions. Even then, it is not always possible to express the solution using a known function - what we call an analytic solution. We are lucky that the equation:

$$\frac{dN}{dt}=rN$$

is so simple that the analytical solution exists. Even better, some computer programs are able to solve this type of equation. They are called CAS: Computer Algebra System, and Maxima is one of these programs, that can help us finding the solution for differential equations. You can find more help about this on the [en:ecovirt:roteiro:soft:tutmaxima|Introdução ao Maxima]].

#### Maxima solutions

Below, we are defining an object eq1 in Maxima to indicate that we want to solve the differential equation found above (the command for this is ode2):

The first argument is the differencial equaition, the second one the dependent variable ($N(t)$) and the third one the independet variable ($t$):

The result should be:

$N(t)=c e^{rt}$

Here, $c$ is an unknown constant. The expression above satisfies the differential equation, for any given value of $c$, and this is all the antiderivative rules are able to give.

#### Initial conditions

If we want to single out one function, we need something more: the initial conditions for the system. Let's define the initial population size, $N_0$. This is the population size on time zero, and it may be substituted on the equation for exponential growth:

$$N_0 = c*e^{0} = c*1 = c$$

So, $c = N_0$, and finally we have a single function to represent our exponential growth:

$$N_t= N_0 e^{rt}$$

### The exponential function

Exercises

1. In the spreadsheet, write N0 in A1 cell, and 2 in B1 cell.
2. Write r in A2 cell and 1 in B2 cell.
3. Write n intervals in the A4 cell and Nt in the B4 cell.
4. From cell A5 to A24, write: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 50, 100, 200, 500, 1000, 10000, 100000, 1000000;
5. In cell B5, write the formula =$B$1*(1+$B$2/A5)^A5
6. In cell C4, write “Nt/N0”, and in cell C5 write the formula =B5/$B$1
7. Copy the formulas in cells B5 and C5 and paste it until line 24;
8. In cell D1, writee^r, and write =exp(B2) in cell E1.

### Duplication time

Duplication time 4) is defined as the time neceessary to duplicate some quantity, given a constant growth rate. We can apply this concept to the time needed to a population with constant growth rate to double in size, or to calculate the time until a debt under fixed interests will double.

The solution is simple. Given the inicial value ($N_0$), the growth rate $r$ and the population size projected ($2N_0$), we solve the equation for time:

$$2N_0 = N_0e^{rt}$$

We just need some algebra, dividing both sides by $N_0$:

$$e^{rt} = 2$$

and then taking the natural logarithm for both sides:

$$log(e^{rt}) = log(2)$$ $$rt = log(2)$$ $$t = \frac{log(2)}{r}$$

As $log(2)$ is approximately 0.7, we have:

$$t_{dupl} \approx \frac{0,7}{r}$$

If growth rate is expressed in percentage, we have:

$$t_{dupl} \approx \frac{70}{r_{\%}}$$

## Exercises

### Interests

A way to calculate compound interests from a loan 5) is through the exponential equation, were:

• r = interests
• N0 = loan
• Nt = debt

Uma dívida

You need 1000 dolars and your interests options are:
• 10% per month
• 50% per year
• 0,5% per day
1. Konwing that you will only be able to pay the debt in two years, calculate the money you will pay.
2. Calculate the duplication time for any of the interests above.

### More interests!

A new car

Imagine you receive a undergrad fellowship and decided to by a car. There are two options for you, both with fixed portions:

1. price $27.000,00, interests 1.1% per month to pay after 100 months 2. price$ 31.000,00, interests 0.7% per month to pay after 50 months
1. What will be the final price of the car in both options?
2. the price of the month protions;
3. how many cars will you pay in both options?
4. what is the duplication time in both options?
5. what is your second career option?

### Any similarity will be mere coincidence

According to the physicist Al Bartlett, one of the biggest tragedies of humanity is the incapacity to understand the consequences of constant growth rates. His speech about it is a classic, repeated more than 1600 times! Here, Prof Bartlett proposes the following problem:

Once upon a time, there was a bacterial civilization that living in a 1L bottle. The population grew in a constant rate such that the duplication time was one day. The population grew and the civilization prospered, until the bottle was filled. At this time, half of the bacterias stoped reproducing and migrated to another bottle, to avoid a demographic disaster.As soon as they found another bottle they started to grow at the same growth rate, relieved to be able to reproduce again. How long the relief will take?

## To know more

1)
read this as “when $\Delta t$ tends to zero”, that is, becomes as close to zero as you want.