Math216 Introduction to Differential Equations

Deniz Bilman, Department of Mathematics, University of Michigan

Lecture 4

Topic of today is modeling. Often times, we would like to keep track of a quantity $Q$ that changes with respect to, say, time $t$ in a given process. One way to do this is to set up a lab , run an experiment, and perform measurements. But usually scientists would like to be able to tell the values of this quantity $Q$ at later times just by looking at a "snapshot" (initial data, initial state) of the process. This requires, ideally, an explicit formula for $Q(t)$ ($Q$ as a function of $t$). Today, we address the question of coming up with such a formula. We will see that if we write down the physical principles that govern the process, we end up stating a differential equation in words. In our case this will be an ODE that tells us what $\frac{dQ}{dt}$ (the rate of change of $Q$ with respect to $t$) is, i.e. tells us how $Q$ changes with respect to $t$. Solving this ODE (or performing a qualitative analysis of the solutions) gives the desired information on $Q$.

We proceed with an example from the textbook (Boyce & Brannan):

Example

Consider a water tank that initially (meaining at $t=0$) contains $Q_0$ pounds salt dissolved in 100 gallons of water. Assume that

  • There is an inlet pipe that lets water containing $\frac{1}{4}$ lb of salt/gal to enter the tank at a rate of $r$ gal/min.
  • There is an outlet pipe that lets the well-stirred mixture drain from the tank at the same rate.

Goal: Set up an initial value problem (IVP) that describes this flow process, whose solution gives the amount of salt $Q(t)$ in the tank at a time $t$.

What are the physical principles that govern this process?

  • Salt is neither created nor destroyed in the tank.
  • Any change in the amount of salt is solely due to flows in and out of the tank. Therefore the rate of change of $Q$ with respect to $t$ is given by $$ \frac{dQ}{dt} = \text{ rate at which salt is flowing in } - \text{ rate at which salt is flowing out}. $$ This is known as the fundamental balance principle.

Also, as side information, note that:

  • The salt concentration of the inflow is constant: $\frac{1}{4}$ lb/gal.
  • The salt concentration of the outflow is not constant, but it is the same as the salt concentration of the tank.
  • Salt concentration and salt amount are different quantities that have different units.

Now, if we are to write an ODE that is satisfied by the salt amount $Q$, all of the terms in the ODE must have the same unit. That is, if we write an ODE of the form

$$ \frac{dQ}{dt} = f(Q,t), $$

since the unit of $\frac{dQ}{dt}$ is pounds per minute (lb/min), every single term in the expression $f(Q,t)$ must have the unit lb/min as well. Otherwise we are equating apples and oranges. This is absolutely a critical step in this modeling challenge. We see that

  • The rate (lb/min) at which the salt enters the tank:
$$ \frac{1}{4}~\text{lb}/\text{gal} \times r~\text{gal}/\text{min} = \frac{r}{4}~\text{lb}/\text{min} $$
  • The rate (lb/min) at which the salt leaves the tank:

This is involves an extra step. The rate of outflow is again $r$ gal/min. To obtain the rate lb/min for the amount of salt leaving the tank, we need to multiply $r$ gal/min by lb/gal, concentration of salt that is leaving the tank. Now, the amount of salt in the tank is $Q$ and the amount of water in the tank is fixed at 100 for all times because the inflow and outflow rates of water are the same. Thus the salt concentration is $\frac{Q}{100}$ because the mixture is well-stirred. This gives that the rate at which the salt leaves the tank is:

$$ \frac{Q}{100}~\text{lb/gal} \times r~\text{gal}/\text{min} = \frac{rQ}{100 }~\text{lb}/\text{min} $$

Then the ODE that governs the process in this example is

$$ \frac{dQ}{dt} = \frac{r}{4} - \frac{rQ}{100 } $$

subject to the initial value

$$ Q(0)=Q_0. $$

Just by the physics of the problem, it is reasonable to expect that eventually the salt concentration in the tank will be $\frac{1}{4}$ lb/gal because eventually the mixture in the tank will be replaced by the mixture that flows into the tank. Let's proceed with the mathematical analysis an the solution of this ODE to verify our speculation.

Qualitative Analysis and the Phase Portrait

Note that the constant function $\varphi(t)\equiv 25$ is a solution of this ODE and it is the only constant solution. Therefore this autonomous ODE has only one equilibrium solution. Recall that if we let $f(Q,t)$ denote the right hand side

$$ f(Q,t)= \frac{r}{4} - \frac{rQ}{100} = 0~\text{if and only if}~Q=25. $$

Moreover, $f'(25)=\frac{-r}{100}<0$ which implies that $Q=\varphi(t)$ is an asymptotically stable equilibrium solution. Thus for solutions Q(t) corresponding to initial values $Q_0$ that are close to $Q=25$ we will have $\lim_{t\to+\infty}Q(t)=25$.

Solving the ODE

The ODE given above is both linear and separable. In the standard form, it reads

$$ \frac{dQ}{dt} + \frac{r}{100}Q=\frac{r}{4}. $$

Multiplying both sides by the integrating factor $\mu(t) = e^{r t/100}$ gives

$$ \frac{d}{dt}\left(e^{rt/100} Q\right)=\frac{r}{4} e^{rt/100}, $$

which we can integrate and obtain the general solution

$$ e^{rt/100} Q = 25 e^{rt/100} + c, $$

or

$$ Q = 25 +c e^{-rt/100}. $$

Now we impose the initial condition $Q(0)=Q_0$: $Q_0= 25 + c$, which gives $c=25$. Therefore the solution of the IVP is given by:

$$ Q(t) = 25 + (Q_0 - 25)e^{-rt/100}. $$

Note that, for any choice of the initial amount $Q_0$ of salt, the corresponding solution $Q(t)$ tends to 25 as $t\to+\infty$.


In [1]:
using PlotlyJS;
# # using Plots
# # plotly()
const timespan = 0:0.1:200.0;
const initialdata = 0.0:5:50;
const r = 2.0;
tracesODE1 = GenericTrace[];
for q0 in initialdata
  trace = scatter(x=timespan, y=25.0+(q0-25.0)*exp(-r*timespan/100), name = "Q(0)=$(q0)");
  push!(tracesODE1, trace);
end
plot(tracesODE1, Layout(title="Integral Curves of the ODE for the salt amount Q(t)", xaxis=attr(title="t"),yaxis=attr(title="Q(t)")))


Plotly javascript loaded.

To load again call

init_notebook(true)

Out[1]:

Compartment models (the model considered in this problem, using the fundamental balance principle) are often used in problems involving a pollutant in a lake, or a drug in an organ of the body, among others. In such cases, the flow rates may be more challenging to determine or may vary with time. Similarly, the concentration in the compartment may be far from uniform in some cases. Finally, the rates of inflow and outflow may be different, which means that the variation of the amount of liquid in the compartment must also be taken into account. See Example 3 in the book.

Example (Boyce & Brannan 3e, p65, 8)

Cholesterol is produced by the body for the construction of cell walls, and is also absorbed from certain foods. The blood cholesterol level is measured in units of milligrams per deciliter, or mg/dl. The net cholesterol production or destruction by the body is modeled by a rate $r$ per day, times the difference between the body’s "natural" cholesterol level (a constant) and the actual cholesterol level at any time $t$. The rate of absorption from food is estimated as a constant $k$ in milligrams per deciliter per day.

(a) A person's cholesterol level at the start of a testing period is 150 mg/dl. Find an expression for the cholesterol level at any subsequent time $t$. If the rate $r$ is 0.10 per day and the natural level is 100 mg/dl, find the cholesterol level of the person 10 days after the start of the testing period, in terms of $k$.

Solution: Let $c(t)$ denote the cholesterol level (mg/dl) at time $t$. Then the unit of the rate of change of cholesterol level $\frac{dc}{dt}$ is mg/(dl$\times$day). Let $N$ be the natural cholesterol level in the body. The units are

  • $c$ and $N$ are in mg/dl
  • $k$ is in mg/(dl$\times$day)
  • $r$ is per day (1/day)

According to the question:

$$ \frac{dc}{dt} =r\cdot(N-c) + k $$

The reason we use $N-c$ is because we assume that $r>0$ and that if the cholesterol level $c$ is less than the natural level $N$ it tends to increase ($\frac{dc}{dt}>0$). Now the ODE reads in standard form as:

$$ \frac{dc}{dt} + r c = r N + k $$

This is again a first order linear ODE and we can use the integrating factor $\mu(t)= e^{r t}$. Then the ODE is equivalent to

$$ \frac{d}{dt}\left(e^{rt}c\right) = e^{rt}(rN + k), $$

which can be integrated to give

$$ e^{rt}c = e^{rt}\frac{rN+k}{r} + B, $$

or

$$ c = N + \frac{k}{r} + B e^{-rt}, $$

where $B$ is an arbitrary integration constant. Looking at the problem again, we see that the following values are set for the parameters of the ODE: $r=0.1$, $N=100$. The initial datum is $c(0)=150$ mg/dl. Therefore, the general solution becomes

$$ c = 100 + 10k + Be^{-0.1 t}. $$

Note that $c_0=c(0)=100+10k+B$, implying that $B=c_0 -100-10k$. Therefore

$$ c = 100 + 10k + (c_0 -100-10k)e^{-0.1 t}, $$

and for any value of $c_0$, the solution c(t) tends to 100+10k as $t\to +\infty$. Using the initial value $c_0=150$, we get that the solution of the IVP is

$$ c(t) = 100 + 10k + (50-10k)e^{-t/10}. $$

(b) If $k=25$,what is the cholesterol level of this person after a long time?

Solution: $$ \lim_{t\to+\infty} 100 + 250 + 200e^{-t/10} = 350. $$

(c) Suppose this person starts a low-cholesterol diet. What must the value of $k$ be so that the long-time cholesterol level is 180 mg/dl?

Solution:

$$ \lim_{t\to+\infty} 100 + 10k + (50-10k)e^{-t/10} = 100+10k, $$

and $100+10k = 180$ if and only if $k=8$.

Example (Boyce & Brannan 3e, p67, 26)

A rocket sled having an initial speed of 160 mi/h is slowed by a channel of water. Assume that, during the braking process, the acceleration $a$ is given by $a(v) = - \mu v^2$, where $v$ is the velocity and $\mu$ is a constant.

(a) Write the equation of motion in terms of $v$ and $x$, where $x$ is the distance traveled by the rocket sled.

Solution: Note that acceleration is $\frac{dv}{dt}$. Using chain rule,

$$ \frac{dv}{dt} = \frac{dv}{dx}\frac{dx}{dt} = \frac{dv}{dx}v \implies a(v)=v\frac{dv}{dx} $$

Therefore, the equation of motion in terms of $x$ and $v$ is

$$ \frac{dv}{dx} = -\mu v. $$

(b) If it requires a distance of 2200 ft to slow the sled to 16 mi/h, determine the value of $\mu$.

Solution: The ODE obtained in part (a) can be integrated to give

$$ \log(v)=-\mu x + c, $$

where $c$ is an arbitrary constant and we used $v>0$ (no absolute value in logarithm.) Then

$$ v = C e^{-\mu x}, $$

where $C=e^{c}$. Recall that the initial speed (at $t=0$) is $v_0=160$. At $t=0$, by definition of the $x$ variable, $x=0$. Therefore,

$$ 160 = C, $$

which gives the particular solution to be:

$$ v(x)=160 e^{-\mu x}. $$

Now, since $2200\,\text{ft} \approx 0.4167$, we have $v(0.4167)=16$. Then

$$ \log\left(\frac{16}{160}\right)=-\mu\cdot 0.4167, $$

which gives

$$ \mu = \frac{\log(10)}{0.4167}~\text{mi}^{-1} \approx 5.5262~\text{mi}^{-1}. $$
References:

Brannan, James R., William Boyce. Differential Equations: An Introduction to Modern Methods and Applications, 3rd Edition. Wiley, 2015-01-20.

Note that we also covered the escape velocity example in the book.

Acknowledgements

I would like to thank the following people for correcting a mistake in these notes:

  • Ahmed Nafis Arafat

In [ ]: