The difference equation
The difference equation#
We are going to solve equation (22) numerically on discretized time and space. The discretizations are:
where \(\Delta t\) is the time step and \(\Delta x\) is the grid resolution. The discrete time-space domain is commonly represented as the t-x diagram in Fig. 3.

Fig. 3 The discrete time-space domain represented as a t-x diagram. The numerical solution at time \(t^n\) and position \(x_m\) is \(u_m^n\) and is represented in the diagram in the position (\(x_m\),\(t^n\)).#
Using the 2nd order centered formula (14) to replace the exact derivatives in (22), we get:
We call (27) the difference equation resulting from the discretization of (22) by the 2nd order centred formulas for the first derivative. Rearranging the terms of (27) we obtain a time marching scheme:
known as the leapfrog scheme, which is a three-level scheme, because it employs information at time levels \(n-1\), \(n\) and \(n+1\). Since the discretization of (22) was done with 2nd order formulas, the scheme (28) is of 2nd order.