Question
Use the explicit finite-difference method with $m = 5$ subintervals in $x$ and $n = 50$ subintervals in $t$ to approximate the solution of
$$\begin{aligned} &u_t = u_{xx}, && 0 < x < 1,\ 0 < t < 0.5, \\ &u(0,t) = 0, \quad u(1,t) = 0, && 0 < t < 0.5, \\ &u(x,0) = \sin\pi x, && 0 \le x \le 1. \end{aligned}$$
Compute the approximations at the interior grid points for the first two time levels ($t = 0.01$ and $t = 0.02$), and compare with the exact solution $u(x,t) = e^{-\pi^2t}\sin\pi x$.