Electric Field Simulator

JJ Ben-Joseph headshot JJ Ben-Joseph

Field lines of two charges with a test charge trajectory.

Kinetic energy

Potential energy

Energy drift

Simulation summary will appear here.

Exploring Electric Fields with the Simulator

What the Animation Represents

The canvas depicts the combined electric field of two stationary point charges and the trajectory of a lightweight test charge. Positive charges are rendered in warm colors, negative charges in cool colors, and the moving marker shows how a positive test charge would respond to the forces present.

Field arrows illustrate the instantaneous force direction. Because electric fields add vectorially, you can see regions where arrows reinforce each other or cancel, revealing null points and symmetry planes.

Inputs and Physical Units

Positions are entered in meters and charges in Coulombs. Default values are expressed using scientific notation (for example 1e-6 for one microcoulomb) to keep the numbers manageable.

The test particle mass must remain positive, and the integration step Δt is restricted to the range shown to preserve numerical stability. The total simulation time T cannot be shorter than a single step.

Mathematical Model

Each source charge contributes an electric field of magnitude k·qᵢ/r² directed radially away from the charge. The simulator sums the x- and y-components to obtain the net field at the test charge location.

Newton’s second law updates the test particle: a = (qₜ/m)·E. The Runge–Kutta 4 (RK4) scheme samples the force four times within each time step and combines the results to approximate the continuous trajectory.

Potential and kinetic energy are monitored concurrently. Ideally the blue (kinetic) and yellow (potential) bars exchange magnitude while the red error bar stays near zero, indicating that total mechanical energy is conserved.

Running Experiments

Start with opposite charges to visualize dipole patterns, then try like charges to see the field lines bulge outward. Adjust the test charge mass to explore inertia: heavier particles accelerate more slowly but follow the same path.

Increase Δt gradually to observe how large steps introduce energy drift. The CSV export lets you graph position versus time or perform numerical checks in Python, MATLAB, or spreadsheets.

Reading the Numerical Summary

Below the canvas a text panel lists the latest position, velocity, and energy values. This accessibility-friendly description mirrors the visuals so that screen-reader users can follow the simulation.

Energy percentages help you gauge whether the chosen parameters are realistic. If kinetic energy quickly dwarfs potential energy, the charges may be unrealistically large for the selected time step.

Troubleshooting Instabilities

If the particle appears to teleport or the red error bar grows rapidly, reduce the time step and ensure the initial position is not exactly on top of a source charge.

When placing charges very close together the resulting field can be extremely strong. Consider scaling the system (for example, using microcoulomb charges a few centimeters apart) to keep accelerations reasonable.

Ideas for Further Study

Compare the simulated path against analytical solutions such as circular motion in a uniform field. You can approximate a uniform field by placing two large, oppositely charged plates far apart relative to the test region.

Extend the experiment by computing electric potential contours or by adding a magnetic field term qₜ·(v × B) to investigate cyclotron motion. These enhancements build on the same state-update loop used here.

Recommended Reading

Griffiths, D. J., Introduction to Electrodynamics, Cambridge University Press.

Feynman, R. P., The Feynman Lectures on Physics, Volume II, Addison-Wesley.

Embed this calculator

Copy and paste the HTML below to add the Electric Field Simulator to your website.