Statement:
Suppose we wish to solve the heat problem
$$u_t = 3u_{xx}, \: u(0,t)=4, \: u(2,t) = 0, u(x,0) = 4-x^2,$$
using a numerical approximation obtained by discretizing the interval $[0,2]$ into 4 equal pieces to replace the PDE with a system of ODEs involving functions denoted $u_i(t)$.

- Write down the system of ODEs that you need to solve, together with initial conditions on the functions.
- Draw a picture of your discretization of the interval $[0,2]$ and indicate exactly how specific function values $u(x,t)$ are related to approximating values $u_i(t)$.

Solution: I think I'd like to draw the picture first, since it helps me understand the equations:

So, we want equations for each $u_i'$ where $i=1,2,3$. Since,
$$u_t(x_i,t) = 3u_{xx}(x_i,t) \approx 3\frac{u(x_{i+1},t)-2u(x_i,t)+u(x_{i-1},t)}{(1/2)^2},$$
we get (after replacing $u(x_i,t)$ with $u_i(t)$),
$$u_i'(t) = 3\frac{u_{i+1}(t) - 2u_i(t) + u_{i-1}}{(1/2)^2}.$$
Writing that out for $i=1,2,3$ and taking the boundary condition into account, we get
$$\begin{aligned}
u_1'(t) &= 3\frac{u_{2}(t) - 2u_1(t) + 4}{(1/2)^2}, \: u_1(0) = 4-(1/2)^2, \\
u_2'(t) &= 3\frac{u_{3}(t) - 2u_2(t) + u_1(t)}{(1/2)^2}, \: u_2(0) = 4-(1)^2, \\
u_3'(t) &= 3\frac{- 2u_3(t) + u_2(t)}{(1/2)^2}, \: u_3(0) = 4-(3/2)^2.
\end{aligned}$$