\chapter[More Differential Equations]{More Differential Equations}

A very common type of differential equation is the
differential equations of the form $\disp\frac{dy}{ dt}=ky+l$, where
both $k$ and $l$ are allowed to be functions of $t$.  Such a differential
equation is called {\bf linear} (because $y$ occurs only to the first power)
and, if $l\ne 0$, {\bf nonhomogeneous}.  If $l=0$, then it is called a
linear {\bf homogeneous} differential equation.

\smallskip
The homogeneous differential equation $\disp\frac{dy}{ dt}=k(t)y$ is of the type
solved in the last section by separation of variables.  However, if
$l(t)$ is not zero (and not a constant multiple of $k(t)$), then
the nonhomogeneous differential equation $\disp\frac{dy}{ dt}=k(t)y+l(t)y$
cannot be solved by separation of variables.  The method used to solve
such a differential equation will not be covered in Math 125 (but you
will get it in the next course that you take on differential equations).
In this chapter our interest is not in solving these differential equations,
but rather in setting them up correctly.


\begin{example}
%{\bf Example 1.} 
In Example~18.2 of the last section, suppose that the water
pumped into the container is not fresh, but rather has a concentration of
0.4 gm/liter.  Find a differential equation for the amount of salt in the
water at time $t$.

\smallskip
As we saw in the last section, the differential equation for the amount of
salt $y(t)$ is 
\[
\frac{dy}{ dt}=r_1k-\frac{ry}{ V_0+(r_1-r)t}= 5\cdot
     0.4-\frac{3y}{ 100+2t}=-\frac{3}{ 100+2t}y+2, 
\] 
i.e., our function $k(t)$ is
$-3/(100+2t)$ and our function $l(t)$ is $2$.

\end{example}


\begin{example} (Heating/cooling with sinusoidal ambient temperature.)\

%{\bf Example 2.}
In Newton's law of cooling we no longer assume that the ambient temperature
is constant.  Suppose we are interested in the temperature $y(t)$ inside an
unheated building under the assumption that the outside temperature is
varying sinusoidally between its warmest value in mid-afternoon and its
coldest value some time after midnight.  For simplicity, we shall choose
$t=0$ to be the time at which the temperature reaches its average value $D$
(some time in mid-morning).  Then when $t=6$ it reaches its maximum $D+A$,
when $t=12$ it's back to $D$, when $t=18$ it reaches its minimum $D-A$, and
finally when $t=24$ it comes back to $D$ and repeats the temperature values
of the day before.  The formula for such a sinusoidal function is
$b(t)=A\sin(\alpha t)+D$, where in this case $\alpha=2\pi/24=\pi/12$ (24 is
the period of the sinusoidal function).  According to Newton's law of
cooling, we have $$\frac{dy}{ dt}=-k(y-b)=-k\left(y-\left(A\sin(\alpha
t)+D\right)\right),$$ where the constants $A$ and $D$ depend on the range
of oscillation of the outside temperature, $\alpha=\pi/12$, and $k$ depends
on the particular building (the better insulated the building is, the
smaller $k$ is).  This is a differential equation of the form $dy/dt=
k(t)y+l(t)$, where the constant $-k$ is playing the role of $k(t)$,
and the function $k\left(A\sin(\alpha t)+D\right)$ is playing the role of
$l(t)$.

\smallskip

\begin{rightindent}{3.5truein}

Without going through the method of solution, we will give the result ---
the function $y(t)$ that satisfies this differential equation. Here $y(t)$
is written in terms of $t$ and the constants $k$, $A$, $D$, and $y_0$.
It turns out to be convenient to introduce a new constant $\theta$,
which is the angle constructed using $\alpha$ as the opposite side
and $k$ as the adjacent side (i.e., $\theta=$Arctan$(\alpha/k)$).
See the diagram at the right.

\end{rightindent}
\hfill
%-figure QA -----------------------------
\begin{psfigure}{1.5in}{1.5in}{figQA.ps}
%\putcrosshair{0,0}
\puttext{35., 0}{\Small$\alpha$}
\puttext{-7., -25.}{\Small$\theta$}
\puttext{0, -45.}{\Small$k$}
\end{psfigure}
%------------------------------

It can be shown that
$$y(t)=D+\bigl(y_0-D+A\sin\theta\cos\theta)e^{-kt}+A\cos\theta\sin(
\alpha t-\theta).$$

For large $t$, the exponential decay term in the formula for $y(t)$ becomes
negligible.  If we drop that term we obtain the ``steady state'' solution,
which does not depend on our initial value for the building's temperature.
Thus, we arrive at the following formula for the steady state temperature
function of the building: 
\[
   y(t)=D+(A\cos\theta)\sin(\alpha t-\theta),
\text{ where } \theta=\text{Arctan}(\alpha/k)
\text{ and } \alpha=\pi/12.
\]
The practical interpretation of this formula is that the building's
insulation has two effects: (1) to decrease the magnitude of temperature
oscillation around $D$, namely by a factor of $\cos\theta=k/\sqrt{k^2+
\alpha^2}$, and (2) to cause a ``phase shift'' of $\theta$ (equivalent
to a ``delay'' of $12\theta/\pi$ hours if $\theta$ is measured in radians,
or $\theta/15$ hours if $\theta$ is measured in degrees).

\smallskip
The practical meaning of the steady state solution is as follows.  Suppose
that the house is heated to a high temperature $y_0$, and then at time
$t=0$ the heat is turned off.  For a while, the house cools off to the
range in which the outside temperature is oscillating (around $D$).  If $t$
is small, then the term 
\[
\left(y_0-D+\frac{Ak\alpha}{ k^2+\alpha^2}\right)e^{-kt}
\]
is important, since it describes this cooling
process.  But after a while the outside temperature ``takes over,'' and the
inside temperature no longer depends to any significant extent on what the
initial inside temperature $y_0$ was.  As the exponential decay
(``cooling'') term becomes negligible, the inside temperature can be
described by the steady state solution, which is a purely sinusoidal
function, as we have seen.

\end{example}


\smallskip

In Example 2 we admittedly adopted a somewhat unrealistic simplifying
assumption to the effect that the outside temperature varies sinusoidally
day in and day out.  Nevertheless, from a qualitative point of view our
solution reveals phenomena that do occur in practice, namely, the decrease
in magnitude of oscillation and the phase shift which are caused by the
building's insulation.  This explains why on a hot summer day the inside of
a house remains hot long after the outside temperature has dropped to a
comfortable level.

\newpage

\bigskip

%\centerline{\bf Homework on Linear Non-Homogeneous Differential Equations}

%\begin{homework}\
%\label{homework:18}
%
%\medskip
%\exercise
%In Example 18.2, show that the solution given satisfies the initial
%condition $y(0)=y_0$ and also the differential equation.  You will have
%to use the trig formulas for $\sin(A\pm B)$, $\cos(A\pm B)$, and also
%the triangle relating $\alpha$, $k$, and $\theta$.
%
%\smallskip
%\exercise
%In Example 18.2, 
%
%(a) find a formula for the initial temperature which would cause the
%building's temperature function $y(t)$ immediately to equal the steady
%state function;
%
%(b) explain what happens to the phase shift (time delay) and the
%oscillation amplitude of the steady state function if the building is very
%well-insulated ($k$ is near 0) and if the building is very poorly insulated
%($k$ is large); 
%
%(c) find an approximate formula in terms of $k$ for the time delay in the
%steady state function if the building is very well-insulated and if it is
%very poorly insulated (note: the units of $k$ are time${}^{-1}$); (d) if
%the outside temperature oscillates between $70^\circ$F and $90^\circ$F,
%reaching $90^\circ$F at 3 p.m., while the inside temperature oscillates
%between $75^\circ$F and $85^\circ$F, determine when the inside of the
%building is hottest, and draw a graph of both the outside and inside steady
%state temperature functions.
%
%\smallskip
%\exercise
%In Problem 18(b) of the first problem set on differential equations,
%suppose that the immigration $I$ is only 2 million people/year at time
%$t=0$, but that it increases steadily each year by 250000 people/year.  As
%before, suppose that the country's population is 300 million at time $t=0$,
%and the death rate exceeds the birth rate by 1\%.  
%Write a differential equation for the population function.  
%
%\smallskip
%\exercise
%Suppose that a cup of coffee at temperature $y_0$ is brought into a room
%whose temperature is $b$ at time $t=0$ but is increasing at the rate $a$ (in
%${}^\circ$F/min).  Let $k$ denote the constant of proportionality in Newton's
%law.  Find a differential equation for the temperature function $y(t)$.  
%
%\smallskip
%\exercise
%In Problem 6 of the last problem set, suppose that, instead of fresh
%water, water with 2 gm/liter of salt is entering the vat.  As before, the
%vat contains 100 liters with $y_0$ grams of salt at time $t=0$, water comes
%into the vat at $2+0.5t$ liters/min and leaves the vat at $2$ liters/min.
%Give the differential equation satisfied by $y(t)$.
%
%\smallskip
%\exercise
%Suppose that a vat contains $V$ liters of water and $y(t)$ grams of
%salt.  Water is coming into the vat at constant rate $r$ liters/min and
%leaving at the same rate.  The concentration of salt at time $t=0$ is $k$
%gm/liters, but this concentration is increasing steadily at $\alpha$
%gm/liter each minute.  Write a differential equation for $y(t)$.
%
%\smallskip
%\exercise
%The normal mean temperature in Fairbanks, Alaska is closely approximated
%by the sinusoidal function $$37\sin\left(\frac{2\pi}{ 365}(t-101)
%\right)+25,$$
%where $t$ is the number of days from the beginning of the year.  This
%formula gives the expected average daily temperature during the $t$-th day
%(obtained by averaging the temperature on the $t$-th day over a 30-year
%period).\footnote{This formula for the temperature in Fairbanks is
%taken from an article by B.~M.~Lando and C.~A.~Lando in the September 1977
%issue of {\it The Mathematics Teacher}.}
%
%Suppose that on April 11 you sell a building in Fairbanks (so take April
%11, rather than the beginning of the year, to be $t=0$).  As part of the
%purchase agreement, you are required to pay for electricity to keep the
%building heated to $65^\circ$F for the first 4 years.  The cost of heating
%the building is known to be \$0.50 for each degree-day below 65${}^\circ$,
%and this cost is not expected to change during the 4-year period.  That is,
%at any time $t$ the rate at which the heating bill accumulates is equal to
%\$0.50 times $(65-\text{current~temperature})$.  To cover your obligation
%to pay for heating you leave an amount $y_0$ of money with the electric
%company.  The electric company agrees to pay interest $k$ (compounded
%continuously) on the money, and also each day deduct the heating cost for
%that day.  (We make the simplifying assumption that this is a continuous
%process, rather than something that happens once a day.  In the same way,
%when writing the above formula for the temperature function in Fairbanks we
%suppose that $t$ is a continuous variable.)
%
%(a) Write a differential equation for the amount of your money the electric
%company has at time $t$.
%
%(b) If $k=0$, i.e., if the electric company pays no interest on the money
%you deposited with them, how much should you leave with them to cover the 4
%years' heating cost?
%
%(c) Now suppose that $k$ is $9\frac{1}{ 8}\%$ annual interest (i.e.,
%$k=0.09125~\text{yr}^{-1}$ --- but be careful to use consistent time
%units).  Find a formula for $y(t)$ in terms of $t$ and the constant $y_0$.
%
%(d) In the situation of part (c), how much money should you leave with the
%electric company to exactly cover the heating cost for 4 years?
%
%\smallskip
%\exercise
%At time $t=0$ a vat contains 100 liters of water with $y_0$ grams of
%salt.  At that time you start letting water flow out of the vat at a rate
%$r(t)$ that depends on time: the rate starts at 12 liters/min at time
%$t=0$, and it decreases at $a$ liters/min${}^2$ (until it reaches 0, at
%which point the experiment stops).  There is no water coming into the vat,
%but someone is sprinkling salt into the water at the rate $l$ gm/min.  
%
%(a) Write formulas for $r(t)$ and the volume $V(t)$.  
%
%(b) Find the differential equation satisfied by the amount $y(t)$ of salt
%at time $t$.  (The constants $a$ and $l$ should appear in your differential
%equation.)  
%
%\smallskip
%
%\exercise
%At time $t=0$ we have $x_0$ grams of radioactive substance A and $y_0$
%grams of radioactive substance B.  The former has half-life $H_1$, and so
%has radioactive decay constant $k_1=(\ln 2)/H_1$; the latter has a
%different half-life $H_2$ and decay constant $k_2=(\ln 2)/H_2$.  The
%substance A decays into the substance B, which then, in turn, decays into
%some non-radioactive substance.  
%
%(a) Find a formula for the amount $x(t)$ of A at time $t$.
%
%(b) Find a differential equation satisfied by the amount $y(t)$ of $B$ at
%time $t$.
%
%
%\smallskip
%\begin{rightindent}{3.25 truein}
%\exercise
%The diagram at the right shows two vats, the first containing $V$ liters of
%water and the second containing $W$ liters of water.  Water with $k$
%gm/liter of impurity is entering the first vat at constant rate $r$, water
%is passing from the first vat to the second vat at the same rate, and water
%is leaving the second vat also at rate $r$.  Let $x(t)$ be the amount of
%impurity in the first vat at time $t$, and let $y(t)$ be the amount in the
%second vat at time $t$.  
%\end{rightindent}
%\hfill
%%-figure QB -----------------------------
%\begin{psfigure}{2.25in}{1.5in}{figQB.ps}
%%\putcrosshair{-1,-1}
%%\puttext{0,-1}{}
%\end{psfigure}
%%------------------------------
%
%(a) Find a formula for $x(t)$.  
%
%(b) Find a differential equation satisfied by $y(t)$.
%
%\end{homework}
