Solution (source code)

= Solution

The causal <Green function> for the heat operator is
$$
G(x,t;\xi,\tau)=H(t-\tau)
\frac1{\sqrt{4\pi D(t-\tau)}}
\exp\left[-\frac{(x-\xi)^2}{4D(t-\tau)}\right],
$$
where $H$ is the <Heaviside step function>. It vanishes for $t<\tau$, satisfies the homogeneous heat equation away from the source, and approaches $\delta(x-\xi)$ as $t\downarrow\tau$. Superposing the responses to all infinitesimal sources gives <Duhamel principle>:
$$
\boxed{
\theta_f(x,t)=\int_0^t\int_{-\infty}^{\infty}
\frac{\exp\left[-\dfrac{(x-\xi)^2}{4D(t-\tau)}\right]}
{\sqrt{4\pi D(t-\tau)}}
f(\xi,\tau)\,d\xi\,d\tau}.
$$
The lower limit and causality give the required homogeneous initial data.