A flash of light

The electric field of two pulses of opposite sign, some time after the flash: each has spread as a ring.

import sympy as sp
import pdemagic as pm

x, y, t = sp.symbols("x y t", real=True)
E = sp.Function("E")(x, y, t)
Hx = sp.Function("Hx")(x, y, t)
Hy = sp.Function("Hy")(x, y, t)
pulses = sp.exp(-(x**2 + (y - 1) ** 2)) - sp.exp(-(x**2 + (y + 1) ** 2))

light = pm.Problem(
    sp.Eq(E.diff(t), Hy.diff(x) - Hx.diff(y)),
    sp.Eq(Hx.diff(t), -E.diff(y)),
    sp.Eq(Hy.diff(t), E.diff(x)),
    domain=pm.FreeSpace(x, y),
    time=(t, 0.0, 4.0),
    initial={E: pulses, Hx: 0, Hy: 0},
)
pm.solve(light).plot(E)
The figure that the example above draws. The figure that the example above draws.

What it shows

Maxwell’s equations in vacuum, for a wave in the plane whose electric field points out of it: three coupled equations of first order for the electric field and the two parts of the magnetic field. The problem takes them as they stand. The two pulses spread as rings with the speed 1, and cancel along the line between them. The solution holds every unknown, and the plot draws the one that is named.

What pdemagic decided

The planner recognised that the three equations describe waves, and chose exact propagation in Fourier space (fourier_propagator): the state of every wave has three components, and is propagated by the exponential of a 3×3 matrix. The box holds everything the waves reach by the end of the time span, about \(\pm 9.3\) by \(\pm 10.3\), with 87 by 96 points.

More