Numerical Methods for PDEs: Finite Differences

the leapfrog scheme

The wave equation u_tt = c^2 * u_xx involves a SECOND derivative in time, not a first — a vibrating string, a sound wave, a ripple. Its honest character is that it does not diffuse and smear like heat; it propagates, carrying features along without flattening them. A good scheme should mirror that, and the leapfrog scheme does: it is centred in time as well as in space, using a symmetric three-level stencil that 'leaps' over the present to connect past and future.

You approximate BOTH second derivatives with the symmetric central stencil. In time, u_tt becomes (u_j^{n+1} - 2 u_j^n + u_j^{n-1}) / k^2 — it reaches back to the PREVIOUS time level n-1 and forward to n+1, skipping nothing but treating them symmetrically. In space, u_xx becomes (u_{j-1}^n - 2 u_j^n + u_{j+1}^n) / h^2. Equating and solving for the only future unknown gives u_j^{n+1} = 2 u_j^n - u_j^{n-1} + (c k / h)^2 * (u_{j-1}^n - 2 u_j^n + u_{j+1}^n). The name comes from the pattern: even and odd time levels advance like two interleaved sequences, each leaping over the other. The scheme is explicit and second-order accurate in both time and space, O(k^2 + h^2).

Leapfrog is the natural explicit scheme for waves because, unlike a diffusive scheme, it has NO numerical dissipation: with the right step it conserves the wave's energy and lets it travel cleanly. The cost is twofold. First, it is only conditionally stable — the CFL condition demands the Courant number c k / h be at most 1, the numerical statement that information must not outrun the grid. Second, it needs two starting levels (n and n-1), so you must bootstrap the first step by another means (often a Taylor expansion using the initial velocity). It can also support a spurious 'computational mode' — a sawtooth in time that the three-level stencil silently admits — which is usually controlled by a small filter or an occasional averaged step.

A plucked string with c = 1, h = 0.1, k = 0.08 gives Courant number c k / h = 0.8 <= 1 (stable). To start, you have the initial shape (level 0) and use the given initial velocity to build level 1, then leapfrog: each later value is twice the current minus the previous, plus the spatial curvature term. Push k to 0.12 so the Courant number exceeds 1, and the wave's amplitude grows without bound.

A three-level explicit scheme for waves — non-dissipative, stable when c*k/h <= 1.

Because it touches no diffusion, leapfrog adds no numerical dissipation — wonderful for energy conservation, but it offers no built-in damping of noise, so high-frequency errors and the spurious computational mode persist unless you filter them. Applied to the DIFFUSION equation, by contrast, leapfrog (the Richardson scheme) is unconditionally unstable — central-in-time is wrong for first-order-in-time PDEs.

Also called
central-time central-spaceCTCS蛙跳法中心時間中心空間