In trying to implement a simplistic numerical solver for wave equations, I have run into a conceptual problem that I haven't been able to solve.

Consider a one-dimensional wave equation of a quantity $y$

$$ \frac{\partial^2y(x,t)}{\partial t^2} = c^2 \frac{\partial^2y(x,t)}{\partial x^2} $$

With a periodic boundary condition, i.e.: $y(x+L)=y(x)$, with $L$ being the length of the system.

The point usually made in books, lecture notes, internet tutorials, etc., is that the wave equation needs to be discretized and rearranged:

$$ y(x,t+\Delta t) = 2(1 - \lambda) y(x,t) - y(x,t-\Delta t) + \lambda \{y(x+\Delta x, t) + y(x-\Delta x,t)\} $$

With $\lambda = (\frac{c\Delta t}{\Delta x})^2$ a constant prefactor, that must not become greater than 1.

Now, the scheme is an explicit one and simply solves the equation forward in time. I am quite familiar with the idea behind it and how it works (one might compare this to the Euler method). One needs two initial conditions (said to be at time $y(x,0)$ and $y(x,-\Delta t$) to start solving it.

The point I don't understand, though, is: Assuming I have the two points, $y(x,t)$ and $y(x,t-\Delta t)$, where do I obtain the extra two required spatial points from? In other words, where do I obtain $y(x+\Delta x, t)$ and $y(x-\Delta x,t)$ from?

These, of course, cannot be given in advance, since they depend on $\Delta x$ but I also do not see a way to calculate these points simply, since they are part of the equation.

All guidelines I have looked at seem to treat this problem as if these points were already known or trivial to calculate, but I don't understand how this is to be done. Any help is greatly appreciated.


You start with $y(x,0)$ and $y(x,-\Delta t)$ for all values of $x$ (or all values of $x$ on your numerical grid, at least).

Then, when you need to compute the value of $y(x,\Delta t) = y(x, 0 + \Delta t)$ for a particular value of $x$, you need to know, e.g. $y(x + \Delta x,0)$ and $y(x -\Delta x,0)$. But you already know these values, as we discussed in the first paragraph. Thus, you can compute $y(x,\Delta t)$ for every $x$ in your grid, and you are now setup to compute $y(x,2 \Delta t)$ with these values.

  • $\begingroup$ Ah! I see, so it is basically like a typewriter, going from left to right and then one line down. Thank you so much, this cleared it up. I flagged your reply as the correct answer. $\endgroup$ – Mark Anderson Jan 14 '14 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.