This applet is designed to allow you watch the dynamics of two permantent magnets which are forced to have their magnetic moments either parallel or anti-parallel. The magnet on the top is falling under the influence of gravity. It also feels a magnetic force due to its interaction with the bottom magnet. This magnetic force is either repulsive or attractive depending on the orientation of the magnets. The magnet on the bottom is stationary and at rest on a table (for example). Hit the "Go" button to start the motion of the top magnet. This situation is similar to the demonstration we did in lecture on Monday.

If you want to change any of the parameters, you must make that change and then hit "Restart" and then "Go".

You can flip the magnet on the top by pressing the "Flip Top Magnet" button. To increase the amount of time the simulation will follow the motion of the top magnet, increase the time parameter "T" in the lower middle scroll bar.

To introduce friction into the problem (initially set to zero), hit the corresponding button on the lower right. A value of "2" for this friction parameter gives a reasonable damping time.

The configuration of the total magnetic field is shown by the field lines. The fact that sometimes our field lines cross each other is an artifact due to our numerical scheme for integration.

To get this applet to run faster on a slow computer, increase the "Speed" by upping that parameter with the button on the lower left. For better accuracy of the field line integration on a fast computer, decrease this value (a value of 9 is pretty good).

**What are we doing?**

The force of attraction or repulsion between two dipoles which are parallel or anti-parallel goes as one over the distance to the fourth power (see EMI, page 507). After you press "Go" in the applet, the program solves for the motion of the top magnet under the constant downward acceleration of gravity and the inverse distance to the fourth magnetic force, using a fourth order Runge-Kutta integration scheme. After computing the position and velocity of the top magnet at a given time, the program then draws the field lines at that time. The slow part of this is the drawing of the field lines! Graphics always costs more than anything else!