Solution (source code)

= Solution

Substitute the exact smooth solution into the <leapfrog advection scheme> and expand the centered differences. With $\tau=\Delta t$ and $h=\Delta x$, the normalized <local truncation error> is
$$
\frac{u(x,t+\tau)-u(x,t-\tau)}{2\tau}-\frac{u(x+h,t)-u(x-h,t)}{2h}=\frac{\tau^2}{6}u_{ttt}-\frac{h^2}{6}u_{xxx}+O(\tau^4+h^4).
$$
Because $u_t=u_x$, repeated differentiation gives $u_{ttt}=u_{xxx}$. Hence
$$
\boxed{\mathcal T=\frac{\tau^2-h^2}{6}u_{xxx}+O(\tau^4+h^4).}
$$
Equivalently the unnormalized one-update residual is $\tau(\tau^2-h^2)u_{xxx}/3+O(\tau^5+\tau h^4)$. Thus the scheme is second order in space and time. When $\tau=h$, the exact translating solution $u(x,t)=F(x+t)$ satisfies the grid recurrence exactly; initialization still matters for the independent computational branch.