loading...
running...
The science
Magnetic dipoles. A magnetised ball acts like a point dipole m. Its field at displacement r is B = (mu0/4 pi r^3) [3 (m.r_hat) r_hat - m]. The interaction energy of two dipoles is
U = (mu0/4 pi r^3) [ m1.m2 - 3 (m1.r_hat)(m2.r_hat) ]
Head to tail (aligned along the line joining them) U = -mu0 m^2 / (2 pi r^3): attraction, force 3 mu0 m^2 / (2 pi r^4). Side by side and parallel U = +mu0 m^2 / (4 pi r^3): repulsion, so such pairs rotate until they line up. The force on dipole 2 is
F = (3 mu0 / 4 pi r^4) [ (m1.r_hat) m2 + (m2.r_hat) m1 + (m1.m2) r_hat - 5 (m1.r_hat)(m2.r_hat) r_hat ]
and each ball also feels a torque tau = m x B that turns it like a compass needle (small-angle frequency omega = sqrt(m B / I)). Chains form because head-to-tail is the lowest energy; closed rings and clusters appear when the pull beats friction.
Integration. Velocity-Verlet in small steps (30 microseconds), soft Hooke contacts with damping, Coulomb plus viscous table friction. The hand magnet is a stronger dipole 20 mm above the table.
Checks. (1) canonical pair energies; (2) analytic force equals -dU/dr for three orientations; (3) energy conserved with friction and damping off (attraction, collision, rebound); (4) a ball in its neighbour's field oscillates at sqrt(m B / I).
Simplifications. Point dipoles (real spheres of uniform magnetisation do behave as a point dipole outside, but there is no induced magnetisation of nearby steel here), 2D motion with in-plane moments, no rolling (balls slide and spin), frictionless contact normal law is a linear spring, no thermal motion. Typical neodymium spheres would have a larger moment than the default.