Lesson 7 of 15

Newton's Law of Cooling

Newton's Law of Cooling

The rate of heat loss of an object is proportional to the difference between the object's temperature and the ambient (surrounding) temperature:

dTdt=k(TTenv)\frac{dT}{dt} = -k \cdot (T - T_{\text{env}})

  • TT: object temperature
  • TenvT_{\text{env}}: ambient temperature (constant)
  • k>0k > 0: cooling constant (depends on material and environment)

Exact Solution

T(t)=Tenv+(T0Tenv)ektT(t) = T_{\text{env}} + (T_0 - T_{\text{env}}) \cdot e^{-kt}

The object approaches TenvT_{\text{env}} exponentially. This is just exponential decay applied to the temperature difference (TTenv)(T - T_{\text{env}}).

Applications

  • Forensics: estimating time of death from body temperature
  • Engineering: thermal management of electronics
  • Food science: how quickly food cools to safe serving temperature
  • Metallurgy: quenching and tempering of metals

Worked Example

A cup of coffee at 90°C in a 20°C room with k=0.1k = 0.1:

T(t)=20+70e0.1tT(t) = 20 + 70 \cdot e^{-0.1t} T(10)=20+70e120+25.7=45.7°CT(10) = 20 + 70 \cdot e^{-1} \approx 20 + 25.7 = 45.7°C T(30)20+3.5=23.5°CT(30) \approx 20 + 3.5 = 23.5°C

Your Task

Implement cooling(k, T_env, T0, t_end, n) using Euler's method. Return the final temperature.

Pyodide loading...
Loading...
Click "Run" to execute your code.