Maxwell’s equations connect electric charge, current, electric field, and magnetic field. Symbolic notation is not decoration beside a solver: each equation specifies a relationship that a discretized field state should satisfy within a measured tolerance. A grid can draw a convincing travelling wave while violating a source constraint, so every relation needs a named residual.
chargeDensity, currentDensity, electricField, magneticField, divergence, and curl distinct in the API. Record both the maximum and norm of each residual, the grid spacing, boundary policy, and whether the run is source-free. A field update that changes these names or signs silently is a physics bug, not merely a rendering bug.In SI vacuum notation, the four equations are
\[\nabla\cdot\mathbf E=\frac{\rho}{\varepsilon_0},\qquad \nabla\cdot\mathbf B=0,\qquad \nabla\times\mathbf E=-\frac{\partial\mathbf B}{\partial t},\qquad \nabla\times\mathbf B=\mu_0\mathbf J+\mu_0\varepsilon_0\frac{\partial\mathbf E}{\partial t}\]The first two are divergence constraints. The latter two give coupled curl dynamics. For a grid, write the first constraint as a residual rather than pretending finite differences are exact:
\[R_E=\nabla_h\cdot\mathbf E-\frac{\rho}{\varepsilon_0}\]Here ∇h means the particular discrete operator on your mesh. Similar residuals apply to magnetic divergence and the two curl equations. Report their units and norm; do not compare an unscaled residual from one grid resolution with another without considering cell size and source scaling.
const electricGaussResidual = divergence(electricField, cell) - chargeDensity[cell] / vacuumPermittivity;
const magneticGaussResidual = divergence(magneticField, cell);
Start with fixtures the solver should not struggle to explain. With ρ = 0 and uniform fields, both divergence residuals should be approximately zero. For a source-free analytic plane wave, E and B remain transverse while the curl updates propagate phase. For a symmetric static point-charge approximation, exclude the singular source cell and compare sampled divergence with the deposited charge policy rather than with a continuum delta function you did not represent.
Prediction: A source-free plane-wave fixture can pass its propagation check while a bad discrete operator still produces a magnetic-divergence residual.
List the four residuals you would log for a wave run. Predict which two should be near zero without sources, then explain why a visual animation cannot substitute for those numbers.Treat Maxwell’s equations as executable specifications. Name the fields and sources clearly, advance the curl rules, log each divergence and curl residual, and compare source-free and analytic fixtures before trusting a rendered electromagnetic field.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Maxwell’s Equations Symbolically, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Maxwell’s Equations and EM Waves, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Maxwell’s Equations Symbolically as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Use Maxwell constraints as named residuals and test oracles for field-array solvers.