APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Magnetic Bar Field Model Applet Page

Magnetic Bar Field Applet

The EJS Magnetic Bar Field Model shows the field of a bar magnet and has a movable compass that reports the magnetic field values.

  1. Run the simulation. Move the compass around in the magnetic field of the magnet. Move the magnet around. What is the relation between the compass and the field vector (small arrows)?
  2. Test to see how well you can use the compass to determine the location of the magnet: Click on the Radomize position check box and then push the Hide Field button. Use the compass to show the direction of the magnetic field and then move the marker (same size as the magnet) to where you think the magnet is located. Click on Show Field to see if you were correct.  If you were, describe your strategy. If you weren't, explain what went wrong and try again.
  3. The model uses a group of magnetic dipoles to build a model of a bar magnet.  If you have Ejs installed, examine the model and determine how many dipoles are stacked together (and in what configuration) to create a model of a bar magnet.


The Magnetic Bar Field Model was created by Wolfgang Christian and Francisco Esquembre and modified by Anne J Cox using the Easy Java Simulations (EJS) authoring and modeling tool. Exercises written by Anne J Cox.

You can examine and modify a compiled EJS model if you run the program by double clicking on the model's jar file. Right-click within the running program and select "Open EJS Model" from the pop-up menu to copy the model's XML description into EJS. You must, of course, have EJS installed on your computer.

Information about EJS is available at http://www.um.es/fem/Ejs/.
Additional information on this applet can be found in the Open Source Physics comPADRE collection.


  • Giancoli, Physics for Scientists and Engineers, 4th edition, Chapter 27 (2008).
The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics