Electromagnetic Fields Simulator: Electric, Magnetic and Light Waves
A free electromagnetism simulator: place charges and see field lines, equipotentials and Gauss's law, add current-carrying wires and check Ampere's law, steer a charged particle through electric and magnetic fields, watch Maxwell's equations make waves reflect, refract and diffract, and explore a 3D electromagnetic plane wave.
Place charges and see the electric field they make: field lines leave positive charges and end on negative ones, equipotentials are the lines of equal voltage. Drag a charge to move it. Hover anywhere to read the field and the voltage. Draw a Gauss sphere to check Gauss's law by adding up the field on its surface.
Long straight wires that run straight through the picture: ⊙ carries current out of the screen, ⊗ into it. Each makes a magnetic field that circles round it. Add wires, drag them, and use the Ampère loop to check Ampère's law. Parallel currents attract, opposite ones repel (the arrow on the selected wire).
A charged particle in a uniform magnetic field B (pointing out of the screen, dots) and electric field E. The magnetic force bends it into circles, an electric field across it makes the circles drift sideways. Try the examples: the cyclotron, the E×B drift, the velocity selector and the mass spectrometer.
Maxwell's equations solved live on a grid (the electric field points out of the screen: red = up, blue = down). Waves reflect from metal, slow down and bend in glass, spread through slits and ring in a cavity. Pick a scene, or paint your own materials and place sources.
What an electromagnetic wave is: electric (red) and magnetic (blue) fields that oscillate at right angles to each other and to the direction the wave travels, in step, with B = E/c. Pick a kind of wave, a polarisation, and drag to rotate the view.
The wave is shown frozen-slow: a real visible light wave oscillates 500 trillion times a second.
Electricity, magnetism and light in one place
Four equations describe all of classical electromagnetism. Gauss's law says electric field lines start on positive charge and end on negative charge. Gauss's law for magnetism says magnetic field lines never start or end: they close in loops. Faraday's law says a changing magnetic field makes an electric field, and Ampère–Maxwell says currents and changing electric fields make a magnetic field. Together they predict waves that travel at 299,792,458 m/s: light.
What each tab shows
- Electric charges. Coulomb's law adds up the field of every charge. The field lines are drawn by following the field direction from the positive charges; the closer together they are, the stronger the field. Equipotentials cross field lines at right angles. The Gauss surface adds up E·A over a sphere around the charges with numerical integration and compares it with Q/ε₀: they agree whatever the shape of the charge cloud inside, and charges outside add nothing. Switch to “long line charges” to see the 2D version, where the field falls as 1/r and the surface is a circle.
- Currents. Each straight wire makes a field μ₀I/(2πr) circling round it. The field lines are drawn as contours of the vector potential, which is exactly what field lines are. Ampère's law says the loop integral of B equals μ₀ times the current inside; the loop shows it. Try the solenoid (the field inside is uniform, outside it nearly cancels) and the coaxial cable (no field outside at all). The force between two wires is how the ampere is defined: 1 A in each, 1 m apart, makes 2×10⁻⁷ N per metre.
- Charged particle. The Lorentz force makes a charge in a magnetic field go in a circle of radius r = mv/(qB) with a period 2πm/(qB) that does not depend on its speed: that is how a cyclotron works. Add an electric field across it and the circles drift sideways at E/B whatever the charge or mass. Where v = E/B the forces cancel: a velocity selector. Different masses make different circles: a mass spectrometer. At high speed the relativistic mass makes the circles bigger (switch Mechanics between Newtonian and relativistic to compare).
- Waves. A two-dimensional finite-difference time-domain (FDTD, Yee) solution of Maxwell's equations with the electric field out of the screen. Glass slows the wave to c/n and bends it (Snell's law); a metal surface forces the field to zero so the wave reflects with a sign flip; a lossy absorber turns the wave into heat; the box with metal walls is a resonant cavity that only rings at certain frequencies; two slits make an interference pattern.
- Plane wave. The textbook picture of an electromagnetic wave in three dimensions, for any wavelength from radio waves to gamma rays, with linear, circular and elliptical polarisation. The numbers (frequency, field strength, intensity, photon energy) are exact for the settings.
Accuracy and limits
The electrostatic and magnetostatic fields are exact formulas (checked against Gauss's law, Ampère's law and E = −∇V in the tests). Particle paths use the Boris integrator, which conserves the energy of a particle in a magnetic field to rounding error, with a relativistic option. The wave solver is second-order accurate: waves with fewer than about 10 cells per wavelength travel a few per cent too slowly, and the absorbing edges reflect about 1% (see the tests). It is a 2D, single-polarisation model, so it does not show magnetic-field direction or 3D effects such as Brewster's angle. Everything runs on your device and nothing is uploaded.
Light in a Medium · Michelson–Morley · Photoelectric Effect · More MES tools
