A pendulum and two magnets - an example of a chaotic system

Micro controllers
Vector graphics

My java applets were developed a long time ago and have not been digitally signed. Nowadays a browser will typically not allow a java applet to run unless it is signed. Getting the applets signed is somewhat expensive, and since I no longer do any java development it is unlikely that I will get the applets signed. It it still possible to run the applets, but in that case you will need to change the security policy of your browser to allow unsigned applets to run.

The java applet below is a simulation of a system consisting of a pendulum and two magnets. The pendulum is attracted by the magnets and the movement is also damped (air resistance, friction and so on), so eventually the pendulum will come to rest by one of the magnets. However, predicting which magnet the pendulum will stop by is very difficult. This is because this is an example of a chaotic system.

The scientific notion of chaos does not describe disorderliness or randomness at all - it describes unpredictability. A chaotic system is characterized by having exponential error growth (also often described with the phrase sensitive dependence on initial conditions AKA the butterfly effect). The state of a system (in this case the position and velocity of the pendulum) can be measured with high, but not infinite, precision. This means that any description of a system will have some small errors (possibly extremely small if the measurement is very accurate). If the dynamics is such that these measurement errors grow exponentially these initially very small errors will eventually be large enough to invalidate any prediction. This means that chaotic systems are impossible to predict in the long run even if the initial conditions have been measured with high precision and that the rules that govern the system are known and fully deterministic. Exponential error growth is not a particularly obscure property for a system to have. An example of a system with this property that everyone is familiar with is the weather.

Simulation controls

Use the mouse to position the pendulum. When you have picked a starting position use the left mouse button to release the pendulum. It is possible to use the shadow of the pendulum to draw a trace on the floor. By restarting and placing the pendulum very near previous initial position it is possible to illustrate the sensitive dependence on initial conditions. The traces of two initial conditions that close to each other will at first be very similar, but will after a while be very different.

pendulum basins of attraction

The image (click it to see a larger version of it) above is a map of the initial conditions of the system, i.e. locations where the pendulum is released. It is assumed that the the pendulum starts at rest (If the pendulum also had an initial velocity we would need a four-dimensional map instead to accomodate the possible initial states). Points in the map that are colored red correspond to initial conditions where the pendulum comes to rest by the left magnet, while blue points correspond to initial conditions where the pendulum comes to rest by the right magnet. The red and blue areas are called the basins of attraction of the system. The boundary between red and blue is actually complicated enough to be a fractal. By changing the strength of the magnets and the strength of the damping it is possible to change the shape of the basins of attraction. This movie show this type of change in the basins of attraction when strength of magnets and damping are varied. Changing the strength of the magnets changes the number of red/blue areas, whereas changing the damping merely changes the shape of the red/blue areas.