Download ModelDownload SourceembedLaunch WebsiteLaunch Website 2


Magnetic Bar Field

screen shot
Screen shot of a bar magnet, the magnetic field and and compass.

Ejs Open Source 2 Bar Magnets & Compass Model

The Ejs Open Source 2 Bar Magnets & Compass Model shows the field of zero, one or two bar magnets and has a movable compass that reports the magnetic field values. The bar magnet modelis built by placing a group of magnetic dipoles along the bar magnet. Users can examine and edit the modelif Ejs is installed.

Exercises: to be updated

  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.


  • Giancoli, Physics for Scientists and Engineers, 4th edition, Chapter 27 (2008).


The2 Bar Magnets and Compass Model was created/remixed by lookang and can be found here
I thank Wolfgang Christian, Francisco Esquembre and Anne J Cox for the original Ejs applet called Magnetic Bar Field Model
I mostly thanks Fu-Kwun Hwang for the masterful educator for his informal learning discussion forum and guidance.
I also used the Easy Java Simulations (EJS) authoring and modeling tool. Exercises written by Anne J Cox.
I also used some creative commons pictures from the internet.
I also took design parameters reference from Phet

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: <> and in the OSP ComPADRE collection <>.

Intro Page



Code Language Translator Run

Software Requirements


Android iOS Windows MacOS
with best with Chrome Chrome Chrome Chrome
support full-screen? Yes. Chrome/Opera No. Firefox/ Samsung Internet Not yet Yes Yes
cannot work on some mobile browser that don't understand JavaScript such as.....
cannot work on Internet Explorer 9 and below



lookang (This email address is being protected from spambots. You need JavaScript enabled to view it.) , Fu-Kwun Hwang, Wolfgang Chrisitan, Francisco Esquembre; Fu-Kwun Hwang; Wolfgang Chrisitan; Francisco Esquembre; Anne Cox; tina

Sample Learning Goals


For Teachers

Examples of what can be simulated




Electromagnetism (part 1): Force acting on a current-carrying conductor in a magnetic field by ETDtogo 


  2. the 2 models of whch was combined from 

Other Resources

end faq

{accordionfaq faqid=accordion4 faqclass="lightnessfaq defaulticon headerbackground headerborder contentbackground contentborder round5"}

3.875 1 1 1 1 1 1 1 1 1 1 Rating 3.88 (4 Votes)