Magnetic Dipoles Screensaver
Magnetic Dipoles is a free, in-browser screensaver where particles follow the real magnetic field of three to five bar magnets superposed on screen. The field at every point is computed from the dipole equation, B = (3(m·r̂)r̂ − m)/r³, so the loops the particles draw are the same ones iron filings would settle into around real magnets. Nothing to download, and ESC exits at any time.
How the Magnetic Dipoles screensaver works
Every bar magnet is a dipole: a vector m pointing from its south pole to its north. Its field at a point r away is (3(m·r̂)r̂ − m)/r³, which is strong along the axis, loops around from pole to pole, and falls off with the cube of distance. The saver sums that expression over every magnet on screen.
Between three and five dipoles are placed with seeded positions, orientations and strengths. Where two magnets face each other the field lines bridge the gap; where they oppose, the lines bulge apart and leave a quiet null point between them. Those are the same features you see in a classroom filings demonstration.
Particles follow the field direction with damping and stroke segments, so the loops are drawn one particle at a time rather than all at once. A small softening term near each pole keeps the field finite where the formula would blow up.
The dipoles do not move on their own; the Evolve slider only matters if a noise field is blended in. The default here is a lower speed, a longer trail and a gentler evolve than the other savers, because the picture is a diagram and it reads best when it accumulates.
Dipoles, iron filings and Maxwell's equations
A magnetic dipole is the simplest magnetic source: a tiny bar magnet with a north and a south pole. A bar magnet, a compass needle or a planet such as Earth can be approximated as a dipole seen from far enough away. Earth’s field is often modelled as a dipole tilted about 11° from the rotation axis, though it has more complicated components and changes slowly over time. The field loops out of one pole and returns to the other.
The familiar picture of iron filings sprinkled over a magnet shows the same thing. Each filing becomes a tiny magnet and aligns with the local field, tracing the field lines. Michael Faraday, around 1831, called the curves the filings trace “magnetic curves” and later developed them into the idea of lines of force and the magnetic field. James Clerk Maxwell later put Faraday’s ideas into mathematical form.
Field lines have no beginning or end: they close into loops, wind endlessly or extend to infinity. This follows from Gauss’s law for magnetism, one of Maxwell’s four equations, which implies that isolated magnetic monopoles do not exist. Where magnets oppose one another, the field cancels at a null point, the quiet gap between the swirls.
A worked example
At the defaults — Cyanotype palette, 2400 particles, Speed 0.9, Trail 70, Evolve 0.6 — pale blue loops bloom out of three or four poles and arc across to their neighbours, exactly like filings on a sheet of paper laid over magnets. Set Trail to 100 and the loops build into a crisp, permanent field diagram; blend in Curl noise at 50% for the studio’s Curled dipoles look, where the loops still hold but the filings drift between them.
Settings & tips
- Trail 100 turns the saver into a static field-line diagram you could put in a textbook.
- Reseed to change how many magnets there are and how they face each other.
- The Blueprint palette on white loops looks like a technical drawing; Ember makes the poles glow like coils.
Frequently asked questions
- Is this the real magnetic field equation?
- Yes. Each magnet is modelled as a point dipole and its field is computed from the standard dipole formula, then summed over all the magnets. The only liberty is a small softening term near each pole so the field stays finite.
- Is the Magnetic Dipoles screensaver free?
- Yes. It runs free in your browser with nothing to download or install, and it works offline once the page has loaded.
- What does the Seed setting do?
- Everything is deterministic from the seed: the noise table, where the field’s features land and the order particles spawn in. Leave it blank for a fresh random layout on every run, or type any short word or number to get the same layout back each time.
- Why does the image ripple when I move the mouse?
- The cursor and a lagging echo of it act as two wave sources. Their interference pattern nudges nearby particles onto the bright fringes and dims the dark ones, so the flow visibly reacts to you. Turn off Cursor ripples in the settings if you want the field left alone.
- How do I exit the Magnetic Dipoles screensaver?
- Press the ESC key at any time to leave fullscreen and return to the page.
- Can a magnet have just one pole?
- No isolated magnetic pole has ever been observed, and Gauss’s law for magnetism implies they do not exist. Cutting a bar magnet in two gives two smaller magnets, each with both poles.
- Why do iron filings line up?
- In a magnetic field each filing becomes magnetised and turns to align with the local field direction, so the filings trace the field lines.
- Is Earth’s field a dipole?
- Roughly. A tilted dipole of about 11° accounts for most of the field at most locations, but the field has more complicated components and changes slowly over time.