Loading the engineShared by all simulations, so the next one opens instantly.
The physics

Charles-Augustin de Coulomb measured the force between charged spheres with a torsion balance in 1785 and found the same inverse-square law that Newton had written down for gravity a century earlier. The only structural difference is the sign: the force is proportional to the product q1q2, so unlike charges attract and like charges repel. Two opposite charges alone would trace Kepler ellipses, two like charges the hyperbolas of Rutherford scattering. Here eight point charges of unit mass move in a box of 800 by 800 pixels, and every pair interacts.

What you see

Red discs carry a positive charge, blue discs a negative one. The faint arrows show the direction of the electric field on a regular grid, with lengths scaled to the strongest field on screen. The line at the bottom of the canvas counts the charges and shows the kinetic energy KE and the pair potential energy PE in simulation units; their sum is the total energy, apart from the small spring energy of discs that touch. One second of the simulation is one second on screen at normal speed, and the initial speeds are 80 to 200 pixels per second in random directions.

Governing equation

Each charge feels the softened Coulomb force of all others,

𝐫¨i=∑j≠ikqiqj𝐫i−𝐫j(|𝐫i−𝐫j|2+ε2)3/2,qi=±1,

with softening length ε=15 pixels, and the energy

E=∑i12|𝐫˙i|2+∑i<jkqiqj|𝐫i−𝐫j|2+ε2

is conserved by the continuous equations. The charges are stiff discs: when two overlap, a spring force κ(2r−d) pushes them apart, with κ scaled to k so that even opposite charges press into each other by only a few pixels. Like the Coulomb force it has a potential energy, so contacts conserve energy too. The integrator is kick-drift-kick with 32 substeps of 1/1920 s per frame. Accelerated real charges radiate and lose energy (Larmor), which this classical model leaves out.

Presets

Mixed charges: four positive and four negative charges. Unlike charges pull toward each other and whip past at close range: pairs form, fly apart and re-form, and in the first minute the mean distance to the nearest neighbour swings between about 65 and 165 pixels and the mean speed between 140 and 225 pixels per second. Touching opposite charges press into each other by up to 5 pixels. The total energy stays constant to 0.4 percent of the peak kinetic energy in the first minute, and to 1 percent at the highest coupling.

Positive charges: eight positive charges repel each other and spread over the whole box and bounce off the walls. At the default coupling they never touch in the first minute (closest approach 28.7 pixels, contact at 28), and KE plus PE stays constant to 0.3 percent.

Negative charges: the same eight charges with the opposite sign. The motion is exactly the same as with positive charges, since the force depends only on the product qiqj, but the field arrows now point toward the charges instead of away from them.

Parameters

Initial charges chooses all positive, all negative or alternating signs and takes effect on Reset.

Radius (px) is the hard-core radius of each disc and acts at once; on Reset it also sets the minimum spacing of the starting positions.

Coupling (log₁₀ k) is the base-10 logarithm of the force constant k and acts at once. At 3 the pair energy is below 0.2 percent of the kinetic energy and the charges fly almost straight; at 7 the closest approach of like charges in the first minute is 31 pixels.

Walls acts at once. Elastic walls reflect the charges. Coulomb walls push every charge back with the force k/(4d2+ε2) at wall distance d, the softened force of a mirror charge of the same sign behind the wall. A charge that does reach such a wall bounces off it as off an elastic wall.

Field arrows, Equipotential lines, Velocity arrows and Acceleration arrows switch the overlays. The equipotential lines are 14 levels of the potential ∑ikqi/ri2+ε2, red above the middle level and blue below it.

Field grid (cells per side) sets how many arrows per side the field grid has and how finely the equipotential lines are traced.

Arrow length scales the field arrows.