# Modeling with first order differential equations

Let us consider first some common task. Like a number of products made in a factory. We assume that each day, the amount of newly produced goods is the same (constant). The result product from the factory is being accumulated, but the change of goods made at any day is zero.

But in some other problems the change of amount grows/declines over time.

## Radioactive decay

Transmutation of radioactive particles depends on number of such particles. The number of observed transmutations is not constant in time, but (at given time) is e.g. 10 % of all radioactive particles. That also reminds so called half-life: for C14 is around 5600 years.

Carbon dating is used to determine approximate ages of fossilized matters. All living organism contain two isotopes of carbon: C12 and C14. The first element is stable, the second is radioactive. Furthermore the ratio between them for living organism is constant within any known time epoch. However once the organism dies, the isotope C14 is being lost by radiation and is no longer being replaced. Transmutation is caused by either decay or nuclear reaction. Many types of decay do cause transmutation of the decaying radioisotope.

So we have

 $A(t)$ number of particles at given time $dA/dt$ change of the number of particles through given timeframe

The increase or decrease of particles $dA$ depends on number of all particles, on a constant $k$ and on the time period (the longer we wait, the more particles transmute). Then the differential equations describing events is

$$dA = A(t)\ k\ dt,$$

where $k$ is a constant binded with given general problem. We might think of $k$ being a physical constant.

## Newton's Law of cooling/warming

The speed of cooling/warming depends on distance of temperatures.

 $T_B$ temperature of the immersed body $T_M$ temperature of the medium (i.e. usually constant) $(T_B-T_M)$ the higher the temperature is, the faster cooling/warming proceeds

$$dT_B = k(T_B-T_M)\ dt$$

When the DE is solved, the constant $k$ has to be evaluated. That is usually done from temperature $T_B$ read when the experiment starts (at $t=0$) and from temperature observed later.

## Mixtures

The mixing of two solutions when one solution is pumped into a tank can be readily solved by differential equations. Let us talk about brine (salt solution) in the tank, which is being released from the tank at a rate $R_{OUT}$ while other solution is flowing into the tank at a rate $R_{IN}$.  $A$ amount of salt inside the tank (in grams) $R_{IN}$ inflow: salt entering the tank (in grams) during one time unit $R_{OUT}$ outflow: salt being released from the tank (in grams) during one time unit

The actual change of the amount of salt in grams in the container depends on salt flowing to and from the container:

$$dA = (R_{IN} - R_{OUT})\ dt$$

## Draining a tank

We know from hydrodynamics that the water speed at outflow is $v=\sqrt{2gh}$. We want to analyze the height $h$ of the water in given time $t$ (the purpose might be to know volume of remaining water in the tank).  The released amount (volume) of water depends on speed, time and cross-section of the outflow pipe:

\begin{align} dV &= -A_hv\ dt \nonumber \\ dV &= -A_h\sqrt{2gh}\ dt \nonumber \\ \end{align}

Since volume $V=A_wh$, where $A_w$ is constant, then $dV=A_w\ dh$:

$$A_w\ dh= -A_h\sqrt{2gh}\ dt \hskip2em \text{or} \hskip2em \frac{dh}{dt} = -\frac{A_h}{A_w} \sqrt{2gh}$$

## Example

Half-life of C14 is 5600 years. The ruins of a town were evaluated as from 7000 BC. How much of carbon remains during observation?

9000 years ago the ruins contained 100 %. After 5600 years they contained 50 %. We might guesstimate, that today it would be around 35 %. But let us do rather the math.

Because we are talking about decay, it is good practice to place minus sign into DE. It does not affect the solution (the constant $k$ would change its sign).

\begin{align} dA &= -A\ k \ dt \nonumber \\ \frac 1 A dA &= -k\ dt \nonumber \\ \log A &= -kt+c \nonumber \\ A &= e^{-kt + c} \nonumber \\ \end{align}

So we have solved the DE in advance, but there are so many letters to deal with. Variable $t$ is a time, we will substitute time in years. Variable $A(t)$ is amount of particles, in our case, it is 100 % at $t=0$ and 50 % after 5600 years. The constant $c$ will be determined from initial value and constant $k$ (for C14) as well. When both $k$, $c$ are determined, we have particular solution which fits to the case and can be used to answer the question from the beginning.

For $A(t=0)= 100\ \text{%}$ and $A(t=5600) = 50\ \text{%}$: \left. \begin{align} 100 &= e^{-k\cdot 0 + c} \implies c = 4.605 \nonumber \\ 50 &= e^{-k\cdot 5600 + 4.605} \implies k = 1.237\times 10^{-4} \nonumber \end{align} \right\} \hskip2em \underline{\underline{A = e^{-1.237\times 10^{-4} t + 4.605} }}

Substituting $t=9000$ years into solution brings $A(t=9000) = 32.8\ \text{%}$. So, in the time of observation, there remained 32.8 % of carbon isotope.

Note: we could also consider $A(t=0) = 1$ and $A(t=5600) = 0.5$ instead of messing with per cents. In such case the solution is $A= e^{-1.237\times 10^{-4} t}$.

## Example

The population of colony doubles in 50 days. In how many days will the population triple?

First, it is a good idea to make a guesstimate by intuition. That is useful to test the final result for correctness.

If we assign $A$ to the amount of population, then we may form differential equation

\begin{align} dA &= k\cdot A \cdot dt \hskip2em \nonumber \text{or} \\ \frac{dA}{dt} &= kA \nonumber \\ \end{align}

It says that the longer we wait, the larger the colony becomes. And the increase depends on the actual size of the colony: regardless the colony has one or 200 members, the increase $dA$ will double, so it has to depend on $A$. There is also a constant $k$ which has to be determined.

\begin{align} dA \frac 1 A &= k\ dt \nonumber \\ \log A &= kt + c \nonumber \\ A &= e^{kt +c} \label{ref:mod1} \end{align}

We have to determine values of two constant $k$ and $c$ by means of initial values (IV). One IV is at the time of 50 days, the other at the time of beginning.

\begin{align} t = 0: &A = 1 \nonumber \\ t = 50: &A = 2 \nonumber \end{align}

Substituting IV into $(\ref{ref:mod1})$ we make two equations which determine values of $k$ and $c$ and the particular solution can be formed:

$$\begin{equation} \underline{A = e^{0.01386t}} \label{ref:mod2} \end{equation}$$

From the solution $(\ref{ref:mod2})$ it is easy task to get answer to initial question:

\left. \begin{aligned} t=0: &A = 1 \nonumber \\ t=?: &A = 3 \end{aligned} \right \} \hskip1em 3 = e^{0.01386t} \implies \underline{\underline{t = 79\ \text{days}}}

## Example

If 1.7 % of a substance decomposes in 50 years, A) what percentage of the substance will remain after 100 % years? B) How many years will be required for 10 % to decompose?

One has to realize quickly that such task deals with half-time of particles. There is a (yet unknown) time in which the amount $A$ of particles always decreases to half: if the half-time is 1 day, each day the change $dA$ will be half of $A$.

\begin{align} dA &= -k\cdot A \cdot dt \hskip2em \nonumber \text{or} \\ \frac{dA}{dt} &= -kA \nonumber \\ \end{align}

The minus sign in above equation is less of importance. It expresses the fact that the amount of particles is decreasing in the time. Even if we omit minus sign, the equation will still work, only the constant $k$ will be found negative.

A= e^{-kt+c} \nonumber \\ \left. \begin{aligned} t=0: &A = 100\ \% \nonumber \\ t=50: &A = 98.3\ \% \end{aligned} \right \} \hskip1em \begin{aligned} 100 =& e^{-k\cdot 0 + c} \implies c = 4.6052 \nonumber \\ 98.3 =& e^{-k\cdot 50 + 4.6052} \implies k= 3.435 \cdot 10^{-4} \end{aligned}

The particular solution for given case is

$$\underline{A = e^{-\cdot 3.435\cdot 10^{-4}\ t+ 4.6052}}$$

Using the above solution we find the answers to questions from beginning:

\begin{aligned} \text{A)}&\ \underline{\underline{96.6\ \%}} \\ \text{B)}&\ 90 = e^{-\cdot 3.435\cdot 10^{-4}\ t+ 4.6052} \implies \underline{\underline{t = 307\ \text{years}}}\\ \end{aligned}

## Example

A body whose temperature is 180 °C is immersed into liquid which is kept at a constant temperature of 60 °C. In one minute the temperature of the body decreases to 120 °C. How long will it take for the body to decrease to 90 °?

Let us assign $T_B$ to temperature of the body, $T_M$ to temperature of the medium. Then we can describe the problem by Newton's Law of Cooling/Warming. The temperature of the body is decreasing. The longer we wait, the more the temperature will decrease. The colder is the medium, the more the temperature will decrease:

$$\begin{eqnarray} dT_B &=& -k(T_B-T_M)\ dt \hskip2em \text{or} \nonumber \\ \frac{dT_B}{dt} &=& -k(T_B - T_M). \nonumber \end{eqnarray}$$

In above DE $k$ is a parameter to be found. The minus sign is to depict that the temperature is decreasing. But even with positive sign the equation is going to work, only the constant $k$ is going to have negative sign.

Let us solve the DE, $T_B(t)$ is unknown value which we are after and $T_M$ is a constant only (in our case 60 °C).

$$\begin{eqnarray} dT_B\frac{1}{T_B - T_M} &=& -k\ dt \nonumber \\ \log (T_B- T_M) &=& -kt + c \nonumber \\ T_B &=& T_M + e^{-kt + c} \nonumber \end{eqnarray}$$

We have to solve constants $k$ and $c$ from initial values:

$$t=0: T_B=180\ ^o\mathrm{C} \implies c = 4.787 \nonumber \\ t=1: T_B=120\ ^o\mathrm{C} \implies k = 0.693 \nonumber \\$$

Then we have $T_B = T_M+ e^{-0.693t + 4.787}$ and from this function we can express that answer to the question is that the body will decrease to 90 °C in two minutes.

## Example

A dead body was found within a closed room of a house where the temperature was a constant 70 °F. At the time of discovery the core temperature of the body was determined to be 85 °F. One hour later a second measurement showed that the core temperature of the body was 80 °F. Assume that the time of death corresponds to t=0 and that the core temperature at that time was 98.6 °F. Determine how many hours elapsed before the body was found.

The room temperature is a constant $T_M = 70$. The body temperature $T_B(t)$ depends on time.

 The room temperature $T_M = 70\ ^o\mathrm{F}$ The body temperature $T_B = 98.6\ ^o\mathrm{F}$ $t = 0$ At unknown time $\Delta$ temperature observed $T_B = 85\ ^o\mathrm{F}$ $t = \Delta$ One hour later the temperature observed $T_B = 80\ ^o\mathrm{F}$ $t = \Delta + 1\ \text{hour}$
\begin{align} dT_B &= -k(T_B - T_M)\ dt \nonumber \\ \frac{dT_B}{dt} &= -k(T_B - T_M) \nonumber \\ \frac{dT_B}{dt} &= -k(T_B - 70) \nonumber \\ \frac 1 {T_B - 70} dT_B &= -k\ dt \nonumber \\ \log {T_B - 70} &= -kt +c\nonumber \\ T_B &= 70 + e^{-kt +c}\nonumber \\ \end{align}

Now we have to use initial values to determine value of $k$, $c$ and especially $\Delta$.

From $t=0,\ T_B = 98.6 \implies c = 3.353$.

From $t=\Delta,\ T_B = 85$ and $t=(\Delta+1),\ T_B=80 \implies \Delta=1.6$ hour.

## Example

A tank contains 200 liters of fluid in which 30 grams of salt are dissolved. Pure water is then pumped into the tank at a rate of 4 l/min; the well-mixed solution is pumped out at the same rate. Find the number A(t) of grams of salt in the tank at time t.

If $A(t)$ is an actual amount of salt in grams in the tank, then $dA = (R_{IN} - R_{OUT})\ dt$, where $R_{IN}$ is a rate of incoming salt and $R_{OUT}$ is rate of salt being released. In our case $R_{IN}$ is zero. The outflow of salt at any time is $R_{OUT} = \frac{4}{200}A(t)$ in grams per second.

So we have differential equation

\begin{align} dA &= (-\frac{4}{200}A)\ dt \nonumber \\ dA &= (-\frac{1}{50}A)\ dt \nonumber \\ -50\ dA\frac{1}{A} &= dt \nonumber \\ -50 \log A &= t + c \implies c = -170 \nonumber \ \\ \log A &= -\frac{1}{50}(t+c) \nonumber \\ \end{align}

And the answer is

$$\underline{\underline{A(t) = 30e^{-{1}/{50}t}}}. \nonumber$$

## Example

A tank contains 200 liters of fluid in which 30 grams of salt are dissolved. Brine containing 1 gram of salt per liter is then pumped into the tank at a rate of 4 l/min; the well-mixed solution is pumped out at the same rate. Find the number A(t) of grams of salt in the tank at time t.

What was discussed in the last example can be applied here. In addition $R_{IN} = 4$ grams per second enters the tank.

So we have differential equation

\begin{align} dA &= (4-\frac{4}{200}A)\ dt \nonumber \\ dA &= (4-\frac{1}{50}A)\ dt \nonumber \\ \frac{1}{4-\frac{1}{50}A}\ dA &= dt \nonumber \\ -50 \log (4-\frac{1}{50}A) &= t + c \implies c = -61.189 \nonumber \ \\ \log (4-\frac{1}{50}A) &= -\frac{1}{50}(t+c) \nonumber \\ 4-\frac{1}{50}A &= e^{-1/50(t+c)} \nonumber \\ 4-\frac{1}{50}A &= 3.4e^{-1/50t} \nonumber \\ \end{align}

And the answer is

$$\underline{\underline{A(t) = 200-170e^{-{1}/{50}t}}}. \nonumber$$

## Example

A tank of 100 l contains 30 g of salt. Fresh water comes at 3 l/min and flows out at the same rate. Find the salt content after 10 minutes.

We know that the change of amount of salt $A(t)$ can be described by DE

$$dA = (R_{IN} - R_{OUT})\ dt$$

where $R_{IN}$ is a salt in grams on inflow and $R_{OUT}$ is a salt in grams on outflow. Now we have to ask how much is $R_{IN}$ and how much is $R_{OUT}$. Since fresh water is coming into the tank, $R_{IN} = 0$.

In one minute, 3 from 100 litres are released, i.e. $\frac 3{100} A(t)$ in grams of salt are released every minute. So, $R_{OUT} = \frac{3}{100}A(t)$

Let us make the differential equation:

\begin{align} dA &= (0 - \frac{3}{100}A(t))\ dt \nonumber \\ \frac 1 A dA &= -\frac 3 {100}dt \nonumber \\ \log|A| &= -\frac{3}{100} t + c \nonumber \\ A(t) &= e^{-3/100\cdot t + c} \nonumber \\ \end{align}

The solution is here, we have to find constant $c$. That will be done from initial value at the time $t=0:\ A(t=0) = 30$ grams.

\begin{align} 30 &= e^{-3/100\cdot 0 + c} \implies c= 3.401\nonumber \implies \\ \implies A(t) &= e^{-3/100\cdot t + 3.401} \nonumber \\ \end{align}

The question from the beginning asks for salt content after 10 minutes:

$$\underline{\underline{ A(t) = e^{-3/100\cdot 10 + 3.401} = 22.22\ \text{g}}}$$

## Example

A tank holds 300 l of liquid in which is 50 g of salt. Another solution is pumped into tank at the rate of 3 l/min, its concentration is 2 g/l.

The solution is pumped out at the rate of 2 l/min.

Describe the problem by DE, if $A(t)$ is amount of salt in grams in the container at any time.

Again we have to determine $R_{IN}$, which is inflow of salt in grams per time unit. In this case $R_{IN} = 3 \cdot 2 = 6$ g/min.

Again we have to determine $R_{OUT}$, which is the outflow of salt in grams per time unit. In this case, in one minute, $\frac 2 V A(t)$ grams are flowing out. Since 3 l/s are on inflow and only 2/l on outflow, the volume is now function of time: $V(t) = 300 + 1\cdot t$.

$$dA = \left(3\cdot 2 - \frac 2 {V(t)}{A(t)}\right) \ dt = \left(6-\frac{2}{300+t}A(t)\right)\ dt$$

or

$$\underline{\underline{\frac{dA }{ dt} = 6-\frac{2}{300+t}A(t)}}$$

## Example

The case like the above case, but the water flows out at 3.5 l/min.

Not much has to be changed compared to the previous example. Only this time the volume is decreasing: $V(t) = 300 - 0.5t$. Then

$$dA = \left(3\cdot 2 - \frac {3.5} {V(t)}{A(t)}\right) \ dt = \left(6-\frac{3.5}{300-0.5t}A(t)\right)\ dt$$

or

$$\underline{\underline{\frac{dA }{ dt} = 6-\frac{7}{600-t}A(t)}}$$

List of chapters