Interactive Electromagnetism Lab RK4 Energy-Conserving Solver

Visualizing Lorentz Force Law

Explore how uniform magnetic and electric fields deflect moving charged particles in real time.

Normalized Equation of Motion:
a⃗ = C (v⃗ × B⃗ + E⃗),   C = q/m = ±1
Physical Motivation

When a particle with charge-to-mass ratio C = q/m enters a region containing an electric field E and a magnetic field B, it experiences the Lorentz acceleration:

  • Electric Force (C E): Accelerates the particle parallel (or antiparallel) to the vertical electric field lines, changing its kinetic energy and speed.
  • Magnetic Force (C v x B): Always acts perpendicular to both the velocity v⃗ and magnetic field B⃗ (Right-Hand Rule). Because it is perpendicular to motion, a pure magnetic field does zero work—it bends the trajectory into a circular cyclotron arc of radius rg = |v| / |C B| without changing the particle's speed!
  • Wien Velocity Selector (Ey = v0 Bz): When electric and magnetic forces are equal and opposite, the particle travels straight through undeflected.
How to Use This Simulation
Configure Fields Live Adjust the scroll bars for Bz (⊙ out of page / ⊗ into page), Ey (↑ up / ↓ down), initial velocity v0, and charge C = ±1. All sliders respond live, even while the particle is in flight!
Start, Observe & Reset Press Start to launch the particle horizontally from the left entry port. The simulation runs using a 4th-Order Runge-Kutta solver until the particle leaves the box. Press Reset anytime to restore initial position and velocity.
Quick Lab Presets:
Velocity v⃗ Magnetic Accel C(v⃗×B⃗) Electric Accel CE⃗
t = 0.00 s pos = (0.00, 0.00) vel = (0.50, 0.00) |v| = 0.500 rg = 0.25
Ready to Launch

Field & Particle Control Scrollbars (Live-Updating)

ax = C vy Bz  |  ay = C (Ey − vx Bz)
+2.0 T
-5 (⊗ Into Page) 0 +5 (⊙ Out)
Pointing Out of Page (⊙)
0.00 V/m
-1.0 (↓ Down) 0 +1.0 (↑ Up)
Electric field is Off (0)
0.50 c
0.10 (Slow) 0.55 1.00 (Fast)
Enters horizontally: v⃗0 = (v0, 0)
+1 (Positive)