Solution (source code)

= Solution

Use the <Backward Euler method> in time and the prescribed <central finite differences> in space. With $j\in\mathbb Z$ and $m\geq0$, the implicit <finite difference method> for the <advection-diffusion equation> is
$$
\boxed{\frac{U_j^{m+1}-U_j^m}{\Delta t}+\frac{U_{j+1}^{m+1}-U_{j-1}^{m+1}}{2\Delta x}
=a\frac{U_{j+1}^{m+1}-2U_j^{m+1}+U_{j-1}^{m+1}}{(\Delta x)^2},\qquad U_j^0=u_0(j\Delta x).}
$$
Equivalently, for $\nu=\Delta t/\Delta x$ and $\mu=\Delta t/(\Delta x)^2$, the new time level solves
$$
(\nu/2-a\mu)U_{j+1}^{m+1}+(1+2a\mu)U_j^{m+1}+(-\nu/2-a\mu)U_{j-1}^{m+1}=U_j^m.
$$
The spatial terms are evaluated at the new time level, making this an implicit scheme. On the whole line there are no finite-endpoint <boundary conditions>; in the next part its solution is chosen in the <l2 sequence space>.