Classroom presentations of Coulomb's law often stop at the algebra: a single equation tells us the electric field magnitude a distance from a point charge. Yet the field is more than a number; it shapes the trajectory of any other charge placed nearby. The simulator above preserves the core purpose of the original calculator—finding the field from a lone source—but elevates it into an experiment. Field lines radiate from the source charge at the canvas center while a test charge responds to the force in real time. As you tweak charge, mass, or starting position, the dot accelerates and curves, and energy bars quantify kinetic and potential contributions. What was once a static homework problem becomes a miniature laboratory where you can freeze, reset, and export data to analyze the dynamics of electrostatic interaction.
The scenario assumes a single fixed source charge located at the origin and a test charge with mass . The position of the test charge is , giving a separation . All calculations occur in vacuum with permittivity , folded into Coulomb's constant 9 N·m²/C². Inputs use SI units exclusively: coulombs for charge, kilograms for mass, meters for position, seconds for time. The code rejects non‑finite values and clamps the timestep to the range 10‑5–0.05 s to avoid instability. Radiation reaction, magnetic forces, and relativistic effects are neglected; the test charge is assumed small enough not to disturb the source.
The electric field from the source charge follows Coulomb's law:
A test charge experiences force , giving accelerations . In component form, the derivatives are
Positions advance according to and . The potential and kinetic energies are
Their sum provides a simple check on numerical accuracy; the script reports the fractional drift from the initial total energy.
The simulator uses a classical fourth‑order Runge–Kutta (RK4) integrator, which evaluates the derivatives at four sub‑steps within each timestep. RK4 offers a good balance between accuracy and computational cost for smooth forces like Coulomb's. The local truncation error scales with , so halving reduces drift by roughly a factor of sixteen. The input box lets you explore this tradeoff; tiny steps preserve energy but slow the animation, while large steps run fast but may overshoot near the origin where forces are strongest. If the particle approaches within one millimeter of the source, the code automatically pauses and warns that the point‑charge model and numerical method become unreliable at such small separations.
Try a source charge of microcoulomb and a test charge of the same magnitude but opposite sign, mass gram, starting 0.1 m to the right of the origin. With a timestep of 0.0005 s, pressing Play reveals the particle accelerating toward the origin, passing through, and decelerating as it moves away on the opposite side. The energy bars show potential energy converting to kinetic near the center. The output panel reports a maximum speed of about 42 m/s. Downloading the CSV yields columns of time, position, velocity, and energies that you can import into a spreadsheet. Plotting total energy confirms that the RK4 integrator keeps the relative error below 0.1% over the 0.05 s run.
The table highlights how changing one parameter influences the motion. All cases start at (0.1, 0) m with timestep 0.0005 s.
Scenario | Q (μC) | m (g) | Peak Speed (m/s) | Energy Drift (%) |
---|---|---|---|---|
Baseline | 1 | 1 | 42 | 0.08 |
Heavier mass | 1 | 5 | 19 | 0.05 |
Stronger charge | 2 | 1 | 59 | 0.12 |
Blue radial lines indicate the electric field pointing away from a positive source (inward if is negative). The orange dot marks the test charge; its trail fades over time to show trajectory without relying on color alone. Energy bars beneath the canvas depict kinetic energy in orange stripes and potential energy in blue stripes, each scaled to the initial total. The caption beneath the canvas narrates the motion—for example, “t = 0.020 s, r = 0.055 m, KE 60%, PE 40%”—ensuring screen‑reader users receive equivalent information.
The model treats charges as mathematical points and ignores radiation emitted by accelerating charges, an effect relevant only at relativistic speeds or extreme accelerations. Magnetic forces are omitted, so trajectories remain planar. Near the inverse‑square law diverges; the code halts rather than allow unphysical energies. Future extensions could include multiple source charges to form dipoles, overlays of equipotential lines, or relativistic corrections when velocities approach the speed of light. For more complex geometries, see the line charge field calculator or the charged ring field calculator.
Standard treatments of electrostatics can be found in D. J. Griffiths, Introduction to Electrodynamics, and M. A. Heald & J. B. Marion, Classical Electromagnetic Radiation. Numerical integration techniques follow the exposition in W. Press et al., Numerical Recipes. Field line visualization methods draw on M. Agrawala et al., “Visualizing Vector Fields Using Line Integral Convolution,” IEEE Computer Graphics and Applications (1993).