Newton law of cooling is a very popular law of nature to study for first differential equation in high school. It says that an object's temperature rate of change (time derivative) is proportional to the difference of temperatures of object and surrounding.
$$\frac{\partial{T}}{\partial t} = k(T(t)-T_s)$$
Usually here $T_s$ (Temperature of (s)urrounding) is assumed constant. But what happens if $T_s$ is not constant? For example let us model outdoor temperature as a cosine with minimum at midnight: $$T_s(t) = 20-10\cos\left(\frac{2\pi t}{24}\right)$$
This could be a typical Swedish summer day, temperature between $10$ and $30$ degrees (celcius). Assume at a party someone forgets a beer at pre-party $t=22$ in evening ( $10$ pm ) but finds it again at after-party $t=26$ ( $2$ am ).
How can we approach this problem of calculating how much warmer the beer has gotten ( in other words of solving $T(t)$ )?
We can relax the partial derivative since we're assuming $T = T(t)$. Say the beer is forgotten at $t_0$ such that $T(t_0) = T_0.$ Finding the solution $T$ boils down to solving the resulting IVP with variable forcing. Suppose $k = -\kappa$. Then the problem is \begin{cases} \displaystyle\frac{\mathrm{d}T}{\mathrm{d}t} + \kappa T = \kappa T_s \\ T(t_0) = T_0. \end{cases} This equation has a general solution using an integrating factor $e^{\kappa t}$. Multplying each side of the differential equation by this factor, we have \begin{align} e^{\kappa t}\left(\frac{\mathrm{d}T}{\mathrm{d}t} + \kappa T\right) &= e^{\kappa t}\kappa T_s \\ \frac{\mathrm{d}}{\mathrm{d}t}\left(e^{\kappa t}T\right) &= e^{\kappa t}\kappa T_s \\ e^{\kappa t}T(t)-e^{\kappa t_0}T(t_0) &= \kappa \int_{t_0}^t e^{\kappa \tau}T_s(\tau) \, \mathrm{d}\tau. \end{align}
For $T_s(t) = 20 - 10 \cos \left(2\pi t/24\right),$ the solution is $$ T(t) = 20\!\left(1 - e^{-\kappa(t - t_0)}\right) + T_0 e^{-\kappa(t - t_0)} + \frac{120\pi \kappa\left(e^{-\kappa(t - t_0)}\sin \frac{\pi t_0}{12} - \sin\frac{\pi t}{12}\right)}{(12\kappa)^2 + \pi^2} + \frac{(12\sqrt{10}\kappa)^2\left(e^{-\kappa(t - t_0)}\cos \frac{\pi t_0}{12} - \cos \frac{\pi t}{12}\right)}{(12\kappa)^2 + \pi^2}. $$