Solution for the One-dimensional Diffusion Equation

It cannot be repeated enough, it is always useful to find cases where one can compare the numerical results and the developed algorithms and codes with closed-form solutions. The above case is also particularly simple. We have the following partial differential equation $$ \begin{equation*} \nabla^2 u(x,t) =\frac{\partial u(x,t)}{\partial t}, \end{equation*} $$ with initial conditions $$ \begin{equation*} u(x,0)= g(x) \hspace{0.5cm} 0 < x < L. \end{equation*} $$