Xwaves
Michael Creutz
creutz@bnl.gov
This program illustrates the behaviors of three common wave equations,
differing in the relation between the frequency w and the wave number
k. First is the simple wave equation with w proportional to k; this
is the equation is obeyed by free photons. Second is the Klein-Gordon
equation with w proportional to the sqrt(k^2+m^2) with m a constant
representing a particle mass, say that of the electron or a pion.
Finally is the equation for long wavelength water waves, which obey w
proportional to sqrt(k).
This should run on any X platform. To compile, try the xtoys
Makefile. Otherwise try
cc -O -o xwaves xwaves.c -lm -lX11
If this does not work immediately, try adding -I and -L flags to
directories where the X includes and libraries are located. For
example, on a Sun try
cc -O -I/usr/openwin/include -L/usr/openwin/lib -o xwaves xwaves.c -lm -lX11
The program starts with wave packets cycling around the periodic
boundary conditions. The equation is that for light, and the wave
packets move with the same velocity as the short waves of which they
are composed.
If you now click on the "mesons" button, the mass term of the
Klein-Gordon equation is turned on. Note how the short components now
move faster than the packets. This illustrates how the group velocity
of a wave equation can differ from the phase velocity. For the
Klein-Gordon equation, the phase velocity exceeds the speed of light,
but this is not a problem because information is carried only by wave
packets, which move at the group velocity. The latter is always less
than the speed of light.
Selecting the water button shows a similar effect. In this case the
group velocity is exactly one half the phase velocity. This follows
from the frequency going as the square root of the wavelength. This
is my favorite example of an interesting result following from
dimensional analysis.
Mathematically, the phase velocity v_p of a wave equation is given by
the relation
v_p=w/k
while the group velocity v_g is
v_g=dw/dk
Only for the simple wave equation are these equal.
The program has a variety of other buttons to play with. The
``quit,'' ``pause,'' and ``slow'' buttons do the obvious things. A
mouse click in the wave portion of the window will insert a
disturbance, much like throwing a rock into a pond. The ``damp''
button slowly damps out any waves present, while ``vacuum'' settles
the system immediately. The ``reverse'' button reverses the motion of
all waves. The ``right'' button eliminates all left moving waves.
Pressing ``packet'' restores the initial two packet state.
The ``blob'' gadget changes the display so the waves run around a
spherical blob rather than along the periodic line. The ``drift''
button lets that blob drift around and bounce off the window walls.
It has no effect when not in the blob display mode. A highly excited
drifting blob with the slow button seems like a blend of Matisse with
a lava lamp.
For each one of the three equations, try calming the state with the
vacuum button and then exciting a pulse with a mouse click. Observe
how the light equation gives a pulse dividing into oppositely moving
pieces that move without changing shape. With the meson equation, an
oscillating central region emits at first short wavelengths followed
by longer ones. With water, the long waves are the first to leave the
excitation region.
Some technical details: The waves are displayed using the Xlib routine
XPolyFill() with 256 points on the wave surface. To avoid
discretization errors, the evolution is calculated in momentum space
and then a fast Fourier transform gives the position space
coordinates. You can easily obtain other wave equations by modifying
the routine makedispersion().