# That first sip of coffee in the morning

It is a good idea to enjoy a cup of coffee before starting a busy day.

Suppose the coffee fresh out of the pot with temperature $\alpha^{\circ} C$ is too hot, we can immediately add cream to reduce the temperature by $\delta^{\circ} C$ instantly, then wait for the coffee to cool down naturally to $\omega^{\circ} C$ before sipping it comfortably. We can also wait until the temperature of the coffee drops to $(\omega+\delta)^{\circ} C$ first, then add the cream to further reduce it instantly to $\omega^{\circ} C$.

Typically, $\alpha = 90, \omega = 75$, and $\delta = 5$.

If we are in a hurry and want to wait the shortest possible time, should the cream be added right after the coffee is made, or should we wait for a while before adding the cream?

The heat flow from the hot water to the surrounding air obeys Newton’s cooling and heating law, described by the following ordinary differential equation: $\frac{d}{dt}\theta(t) = k (E-\theta(t))$

where $\theta(t)$, a function of time $t$, is the temperature of the water, $E$ is the temperature of its surroundings, and $k>0$ is a constant depends on the heat transfer mechanism, the contact are with the surroundings, and the thermal properties of the water.

Fig. 1 a place where Newton’s law breaks down

Under normal circumstances, we have $E \ll \omega < \omega+\delta < \alpha-\delta < \alpha\quad\quad\quad(1)$

Based on Newton’s law, the mathematical model of coffee cooling is: $\begin{cases} \frac{d}{dt}\theta(t) = k (E-\theta(t)) \\ \theta(0)= \theta_0\end{cases}\quad\quad\quad(2)$

Fig. 2

Solving (2), an initial-value problem (see Fig. 2) gives $\theta(t) = E + e^{-kt}(\theta_0 - E).$

Therefore, $t = \frac{\log\left(\frac{E-\theta_0}{E-\theta(t)}\right)}{k}=\frac{\log\left(\frac{\theta_0-E}{\theta(t)-E}\right)}{k}.\quad\quad\quad(3)$

If cream is added immediately (see Fig. 3),

Fig. 3 : cream first

by (3), $t_1=\frac{\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)}{k}.$

Otherwise (see Fig. 4),

Fig. 4: cream last $t_2=\frac{\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)}{k}.$

And so, $t_1-t_2 = \frac{\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)}{k}- \frac{\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)}{k}=\frac{1}{k}\left(\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)-\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)\right)\quad(4)$

Fig. 5

Since $\frac{(\alpha-\delta)-E}{\omega-E}- \frac{\alpha-E}{(\omega+\delta)-E}=\frac{(\alpha-\delta-E)(\omega+\delta-E)-(\omega-E)(\alpha-E)}{(\omega-E)(\omega+\delta-E)}=\frac{-\delta(\omega+\delta-\alpha)}{(\omega-E)(\omega+\delta-E)}\overset{(1)}{>0}$

implies $\log\left(\frac{(\alpha-\delta)-E}{\omega-E}\right)-\log\left(\frac{\alpha-E}{(\omega+\delta)-E}\right)>0,\quad\quad\quad(5)$

from (4) , we see that $t_1-t_2 > 0;$

i.e., $t_1 > t_2$

Hence,

If we are in a hurry and want to wait the shortest possible time, we should wait for a while before adding the cream!

Exercise-1 Solve (2) without using a CAS.

Exercise-2 Show that $\frac{\alpha-\delta-E}{\omega-E}\cdot\frac{\omega+\delta-E}{\alpha-E} >1.$

# An ODE to Thanksgiving

A turkey is taken from the refrigerator at ${\theta_0}^{\circ} C$ and placed in an oven preheated to $E^{\circ} C$ and kept at that temperature; after $t_1$ minutes the internal temperature of the turkey has risen to ${\theta_1}^{\circ} C$. The fowl is ready to be taken out when its internal temperature reaches ${\theta_2}^{\circ} C$.

Typically, ${\theta_0} = 2, E=200, t_1=30, \theta_1=16, \theta_2=88$.

Determine the cooking time required.

According to Newton’s law of heating and cooling (see “Convective heat transfer“), the rate of heat gain or loss of an object is directly proportional to the difference in the temperatures between the object and its surroundings. This law is best described by the following ODE (Ordinary Differential Equation): $\frac{d}{dt}{\theta(t)} = k\cdot(E-\theta(t)),\quad\quad\quad(1)$

where $\theta(t), E$ are the temperatures of the object and its surroundings respectively. $k > 0$ is the constant of proportionality.

Fig. 1

We see that (1) has a critical point $\theta^* = E$. Fig. 1 illustrates the fact that depending on its initial temperature, an object either heats up or cools down, trending towards $E$ in both cases.

We formulate the problem as a system of differential-algebraic equations: $\begin{cases} \frac{d}{dt}{\theta(t)} = k\cdot(E-\theta(t)) \\ \theta(0)=\theta_0\\ \theta(t_1)=\theta_1 \\ \theta(\boxed{t_2}) = \theta_2\end{cases}(2)$

To find the required cooking time, we solve (2) for $t_2$ (see Fig. 2).

Fig. 2

Using Omega CAS Explorer, the typical cooking time is found to be approximately $4$ hours ( $3.88...\approx 4$)

Luise Lange of Woodrow Wilson Junior College once wrote (see ” A Century of Calculus, Part I”, p. 50):

“In many calculus texts problems are formulated too one-sidedly in terms of particular, numerical data rather than in general terms. While pedagogically it may be wise to begin a new type of problem with some numerical examples, it is only the general formulation, and the interpretation of the answer in general terms, which can give insight into the functional relation between the given and the derived data.”

I agree with her wholeheartedly! On encountering a mathematical modeling problem stated with numerical values, I prefer to re-state it using symbols first. Then solve the problem symbolically. The numerical values are substituted for the symbols at the very end.

This post is a case in point, as the problem is re-formulated from page 1005 of Jan Gullberg’s “Mathematics From the Birth of Numbers”:

Exercise-1 Solving (2) without using a CAS.

Exercise-2 Given $\theta_0< \theta_1 < E$, show that $k = \frac{t\log(\frac{E-\theta_0}{E-\theta_1})}{t_1} > 0.$

Exercise-3 Given $\theta_0 < \theta_1< E$, verify that $\lim\limits_{t\rightarrow \infty} \theta(t) = E$ from $\theta(t) = -Ee^{ -\frac{t\log(\frac{E-\theta_0}{E-\theta_1})}{t_1} } + \theta_0 e^{-\frac{t\log(\frac{E-\theta_0}{E-\theta_1})}{t_1}} + E.$

Exercise-4 A slice is cut from a loaf of bread fresh from the oven at $180^{\circ} C$ and placed in a room with a constant temperature of $20^{\circ} C$. After 1 minute, the temperature of the slice is $140^{\circ} C$. When has the slice of bread cooled to $32^{\circ} C$?

# Eye Of The Tiger

Evaluate $\int \frac{x^2e^x}{(x+2)^2}\;dx$

is an exercise accompanied my previous post “Integration by Parts Done Right“. It is a special case of $\int \frac{x^2e^x}{(x+\boxed{a})^2}\;dx$.

For various $a$, Omega CAS Explorer gives $\int \frac{x^2}{(x+a)^2}e^x\;dx$ $= \int \left(\frac{x}{x+a}\right)^2 e^x\;dx$ $= \int \left(\frac{x+a-a}{x+a}\right)^2 e^x\;dx$ $=\int \frac{(x+a)^2-2a(x+a)+a^2}{(x+a)^2}e^x\;dx$ $= \int \left(1-\frac{2a}{x+a}+\frac{a^2}{(x+a)^2}\right)e^x\;dx$ $= \int e^x-\frac{2a}{x+a}e^x + \frac{a^2}{(x+a)^2}e^x\;dx$ $= \int e^x\;dx-\int \frac{2a}{x+a}e^x\;dx + \int \frac{a^2}{(x+a)^2}e^x\;dx$ $= e^x-2a\int \frac{e^x}{x+a}\;dx + \int \frac{a^2}{(x+a)^2}e^x\;dx$ $= e^x-2a\int \frac{1}{x+a}(e^x)'\;dx + \int \frac{a^2}{(x+a)^2}e^x\;dx$ $= e^x-2a\left(\frac{1}{x+a}e^x-\int (\frac{1}{x+a})' e^x\;dx\right) + \int \frac{a^2}{(x+a)^2}e^x\;dx$ $= e^x-2a\left(\frac{1}{x+a}e^x-\int\frac{-1}{(x+a)^2}e^x\;dx\right)+ \int \frac{a^2}{(x+a)^2}e^x\;dx$ $= e^x-2a\left(\frac{1}{x+a}e^x+\int\frac{1}{(x+a)^2}e^x\;dx\right)+ \int \frac{a^2}{(x+a)^2}e^x\;dx$ $= e^x-\frac{2a}{x+a}e^x-2a\int\frac{e^x}{(x+a)^2}\;dx + a^2\int \frac{e^x}{(x+a)^2}\;dx$ $= e^x-\frac{2a}{x+a}e^x-\left(2a-a^2\right)\int\frac{1}{(x+a)^2}e^x\;dx$ $\overset{2a-a^2=0}{=} \frac{x-a}{x+a}e^x$ $= \begin{cases} e^x, a=0\\ \frac{x-2}{x+2}e^x, a=2\end{cases}$