= Solution
{c}
Use the full continuous piecewise linear space $V_h\subset H^1(0,1)$, including endpoint basis <functions>, because the <boundary conditions> are Neumann. Define
$$
a(w,v)=\int_0^1(w'v'+e^xwv).
$$
Choose $u_h^0$ as the $L^2$ projection of $u_0$ onto $V_h$. For each time step seek $u_h^{m+1}\in V_h$ with
$$
\boxed{\left(\frac{u_h^{m+1}-u_h^m}{\Delta t},v_h\right)
+a\left(\frac{u_h^{m+1}+u_h^m}{2},v_h\right)=0
\quad(v_h\in V_h).}
$$
This is the conforming <Crank-Nicolson method>. The reaction coefficient and the diffusion are both treated at the midpoint; integration by parts has removed the boundary flux through the homogeneous Neumann condition.
Back to article page