The wavepacket simulator

Stuart Lynn ( and Owain Kenway (, the School of Physics at the University of Edinburgh.


The wavepacket simulator is a java applet which allows you to build up wave packets, either by manually inputting waves which are superimposed or by inputting a mean wave number and spread. The applet has three modes (auto-packet, manual and lecture). Lecture is probably the least useful as it is specific to a course taught here at Edinburgh, but it does show a nice example wave packet.

Note: The applet has a forth mode called "Tabbed" which allows you to switch between the three modes of the applet using a tabbed interface. Unfortunately, due to Graphics2D bugs on some platforms, (Apple's JDK 1.4 for OS-X for example) it can at times be unusable.

Underlying Physics

This applet is based on the physics of wave propagation. When two waves are present in the same media they combine constructively where there maxima coincide and destructively when there maxima are out of phase by 180 degrees. By adding together many infinite waves, say on a wire we can create more complex wave forms(experiment with the manual section of the applet). One of the most important of these combinations are wave packets as they are used to send information. These can be formed by adding together a large number of waves with very close wave numbers and equal amplitude. However the speed at which each wave propagates through the media is dependent on its wavelength, this means that as time goes on the component waves of the wave packet will drift from there initial configuration and the wave packet will lose its shape. This behaviour is called dispersion and is characterised by a media's dispersion relation.

  1. Using the manual section try adding two waves of the same wave length and amplitude. What does the resulting wave look like?
  2. Using the manual section try adding two waves which are out of phase by 180 degrees. What does the resulting wave look like?
  3. Using the manual section try adding together a number of waves with the same amplitude but slightly diffrent wave numbers. As you add more what happens to the overall wave. When you have added about 9 or 10 waves together press start and see how the resultant wave moves. Does the waves form stay constant with time and just move allong, or does the shape of the wave change?
  4. Using the packet section add together a spread of 50 waves with a mean wavelength of 0.1 and a spread of 0.01. Watch the leading and trailing ends of the wave packet, how does the packet change with time?
  5. Look at the lecture section. Watch the wave as it moves along, what happens to the amplitude and width of the wave as time goes on. If each one of these packets represented some kind of information being sent why is the dispersion of the wave important?

To use the wavepacket simulator applet, you require a web browser which a java plugin later than 1.2 (note it has not been tested with 1.2 - only 1.3.1 and 1.4), for example the latest JRE from Sun or Apple's JDK on Mac OS-X. You can also use the AppletViewer provided with your chosen JRE/JDK.

It is not recommended that you use a remote X-session to run this applet as it draws to the screen a lot and the resulting lag makes the animation jerky.


Unpack the applet - if it came with a group of other applets from the School of Physics at the University of Edinburgh, it should be in the wave subdirectory. Inside the wave directory should be some java code, classes and a number of html files, including an index.html which should contain links to this documentation, JavaDoc for the simulator and some pages with example configurations of the applet.


The provided html files give you some example configurations of the applet. "wave.html" shows the tabbed interface, "wavepacket.html" shows the automatic packet generator, "wavemanual.html" the manual packet generator and finally, "wavelecture.html" shows the demonstration wave packet. The custom parameter that this applet has is "interfaceType" which can be set to 0 (tabbed), 1 (lecture), 2 (packet) or 3 (manual). If it is not set, or has another value, the applet defaults to tabbed. You can set the size of this applet as usual. Below is an example html file which embeds a tabbed 900 pixels by 500 pixels version of the applet.

<title> Tabbed WavePacket simulator applet </title>
        code ="wavepack.class"
       	name= "wave packet"

        param name="interfaceType" value="0">

How the applet is used is up to the user - it could be used in lectures, embedded in online course material or any other use that could be conceived.

Creating wave packets

First, lets take a look at the manual wave packet generator. The screen shots below show it on Mac OS-X and Windows XP.


As you can see, there are two fields and four buttons. To add a wave to the superposition (in the white box at the bottom), put in its wave number and amplitude and click "Add". Add another wave and note that the black wave at the top is the superposition of the two waves. To see the wave move, click "Start", to pause it click "Pause" and to start over click "Clear".

Now let's look at the automatic packet generator interface.


This time there are three fields and the same four buttons. To create a wave packet, enter a mean wave number, spread of wave number and the number of waves (make this fairly high) and click "Add". Your wave packet will be generated, and displayed in the white box below. To remove it, click "Clear". As before, "Start" and "Pause" will animate it.

Known Bugs

  1. The aforementioned graphical glitch in Graphics2D on OS-X.
  2. Sometimes (but very rarely) the Tabbed interface doesn't switch tabs properly under XP. Just click on a different tab and then go back to the one you want.
  3. Sometimes when you click on buttons, they have to be clicked a second time as Java doesn't pass the mouse click event onto the program.

Additional Documentation

There is complete JavaDoc for the classes in this applet in the "javadoc" subdirectory of the applet directory.