1.8: Applications to Heating and Cooling

Open In Colab

Reading: Section 4.2 from Exploring Differential Equations with Boundary Value Problems by William F. Trench which is shared under a CC BY-NC-SA 3.0 license.

Cooling Coffee


A group of students want to develop a rate of change equation to describe the cooling rate for hot coffee in order that they can make predictions about other cups of cooling coffee. Their idea is to use a temperature probe to collect data on the temperature of the coffee as it changes over time and then to use this data to develop a rate of change equation.

The data they collected is shown in the table below. The temperature \(C\) (in degrees Fahrenheit) was recorded every 2 minutes over a 14 minute period.

Time (min) Temp. ( degree F) \(\dfrac{dC}{dt}\) ( degree F per min)
0 160.3
2 120.4
4 98.1
6 84.8
8 78.5
10 74.4
12 72.1
14 71.5

Question 1:


Figure out a way to use this data to fill in the third column whose values approximate \(\displaystyle\frac{dC}{dt}\), where \(C\) is the temperature of the coffee.

Solution to Question 1:






Use the Python code cell below to help with the calculations


import numpy as np

# Create vector of values for t
t = np.arange(0, 16, 2)  

# Create vector of temperature values, c
c = np.array([160.3, 120.4, 98.1, 84.8, 78.5, 74.4, 72.1, 71.5])  

# Create vector to save each approx for dC/dt
diff = np.zeros(8)

########################################################
# Student to do: Replace ?? with an appropriate formula
########################################################
diff[0] = ??  # approx for dc/dt at t=0
diff[1] = ??  # approx for dc/dt at t=2
diff[2] = ??  # approx for dc/dt at t=4
diff[3] = ??  # approx for dc/dt at t=6
diff[4] = ??  # approx for dc/dt at t=8
diff[5] = ??  # approx for dc/dt at t=10
diff[6] = ??  # approx for dc/dt at t=12
diff[7] = ??  # approx for dc/dt at t=14

print(diff)

Question 2:


Do you expect \(\displaystyle\frac{dC}{dt}\) to depend on just the temperature \(C\), on just the time \(t\), or both the temperature \(C\) and the time \(t\)? Explain in practical terms.

Solution to Question 2:







Question 3:


Roughly sketch below your best guess for the graph of \(\displaystyle\frac{dC}{dt}\) on the axes below. Label the variable you decided to plot on the horizontal axis.

Solution to Question 3:





Blank Axes


Question 4:


In the code cell below, the object myin is the input for the model for \(\dfrac{dC}{dt}\). In the code below, define myin to be either t or c depending on your answers to Question 2 and Question 3. Then run the code to plot and find an equation that best fits your data.

Solution to Question 4:






Edit one line of code in the cell below and run.




from numpy.polynomial.polynomial import polyfit
import matplotlib.pyplot as plt

# Note arrays t, c, and diff are defined in previous code cell above. 

################################################################
# Student to do: Replace the ?? in the line of code below.
################################################################

myin = ??  # Replace the ?? with your input (either t or c)
myout = diff

b, m = polyfit(myin, myout, 1)

plt.plot(myin, myout, '.')
plt.plot(myin, b + m * myin, '-')

# Display formula on plot
plt.text(80,-20, f"dc/dt = {round(b,2)} + {round(m,2)} Input", 
         horizontalalignment="left", 
         fontsize = 16, 
         color = "b")
plt.show()

A Formula for Newton’s Law of Heating and Cooling


Newton’s Law of Heating and Cooling states that the temperature \(T\) of an object at time \(t\) changes at a rate which is proportional to the difference of its temperature and the temperature of its surrounding:

\[\color{dodgerblue}{\large \boxed{\frac{dT}{dt} = -k(T-A)}}, \]

where \(A\) is a constant that denotes the ambient temperature and \(k>0\) is a constant that depends on the object.

Question 5:


Based on the model you found in Question 4, determine the ambient temperature of the room in which the coffee in Question 1 is cooling.

Solution to Question 5:







Question 6:


What happens as \(\mathbf{t \to \infty}\) if the initial temperature \(\mathbf{T_0>A}\)? If the initial temperature \(\mathbf{T_0 < A}\)?

Solution to Question 6:







Practice: Applications to Economics


Question 7:


Let \(S(p)\) denote the number of units of a particular commodity supplied to the market at a price of \(p\) dollars per unit, and let \(D(p)\) denote the corresponding number of units demanded by the market at the same price.

  • In static circumstances, market equilibrium occurs at the price where demand equals supply.
  • However, certain economic models consider a more dynamic economy in which price, supply, and demand are assumed to vary with time.
  • One of these, the Evans price adjustment model, assumes that the rate of change of price with respect to time \(t\) is proportional to the shortage, which is the difference between the quantity demanded and the quantity supplied.

Question 7a:


Write a differential equation for the rate of the change of the price of the good with respect to time.

Solution to Question 7a:







Question 7b:


If we assume that supply and demand are linear functions given by \[ S(p) = 2+p \quad \mbox{ and } \quad D(p)=8-2p, \] find a general solution to the differential equation in Question 7a.

Solution to Question 7b:







Question 7c:


If the price is \(\$5\) at time \(t=0\) and the price is \(\$3\) at time \(t=2\), determine what happens to \(p\) in the long run.

Solution to Question 7c:







Practice: Applications to Forensic Science


Question 8:


A detective finds a murder victim at 9 am. The temperature of the body is measured at \(90.3^{\circ}\)F. One hour later, the temperature of the body is \(89.0^{\circ}\)F. The temperature of the room has been maintained at a constant \(68^{\circ}\)F.

Question 8a:


Assuming the temperature, \(T\), of the body obeys Newton’s Law of Cooling, write a differential equation for \(T\). Your equation will include the constant \(k\) (for now).

Solution to Question 8a:







Question 8b:


Solve the differential equation to estimate the time the murder occurred.

Solution to Question 8b:







Creative Commons License Information


Creative Commons License
Exploring Differential Equations by Adam Spiegler is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://github.com/CU-Denver-MathStats-OER/ODEs and original content created by Rasmussen, C., Keene, K. A., Dunmyre, J., & Fortune, N. (2018). Inquiry oriented differential equations: Course materials. Available at https://iode.sdsu.edu.