The Wave Equation

Basics

Many physical systems can be modeled by a scalar-valued function of space and time. In the case when the second derivative with respect to time (that is the acceleration) is proportional to the second derivative with respect to space (that is the local convexity), the system exhibits wave behavior.

In one dimension, one can write 2f/∂t2=c22f/∂x2 . The corresponding (scalar) second derivative with respect to space in higher dimensions is the divergence of the gradient. The gradient has as many dimensions as the domain space of the function in question, while the divergence (of a vector-vector function, such as the gradient) is a scalar (function). Thus, the general wave equation is the following partial differential equation:

2f/∂t2=c2div grad f

Exact Solutions

In the one-dimensional case the general solution is

f(x,t)=A(x-ct)+B(x+ct)
where A and B are (twice) differentiable scalar functions. The above formula (the so-called d'Alambert solution) can be easily verified using the chain rule for differentiation.

The exact solution for higher dimensions also exists. It looks as follows:

f(x,t)=∫τy |x-y|r-1D(y,τ+|x-y|/c)dy
where r is the dimensionality of x and D is the so-called excitation (or disturbance) function (a scalar function of time and space).

Numerical Solution

In numerical models, both time and space are (usually uniformly) quantized. Instead of differentials, we use differences. By simple calculations, one can see that the divergence of the gradient becomes the (appropriately scaled) difference between a sample point and the average of its neighbors.

A numeric simulation of the two-dimensional case using Euler's method would have the following pseudo-code:

  1. ddf:=c^-2*[f-(f1+f2+f3+f4)/4]
  2. f:=f+df
  3. df:=df+ddf
  4. go to 1.
where f1(x,y)=f(x+1,y), f2(x,y)=f(x-1,y), f3(x,y)=f(x,y-1), f4(x,y)=f(x,y+1).

A java applet accomplishing the same on a 200 by 200 grid can be found below. Periodic excitation can be added by pressing the mouse button. Note the circular shape of the wavefronts, the reflections, the law of conservation of energy, the doppler effect and the increment of entropy.


All the text and the software above have been originally written by Daniel A. Nagy