back

ideas

I Wrote a Physics Paper Using AI

#physics#simulation#software-architecture#AI

I've been using AI a lot recently for my job and for my hobby projects. I have been a professional software engineer for going on 20 years, with a stint at Apple and numerous startups in Silicon Valley. Using AI to code is like getting a new a nail gun, after a career of using a hammer; fast and dangerous. But it has also opened the doors to a world of possibilities that would have simply taken too much time and effort previously. It also seems to be just as good at science is it is at code. This makes sense given that code is the most powerful lever of scientific and mathematical inquiry. But now that code is fast and easy to write, science and engineering applications that used to be pipe dreams are now possible.

When I was in college working on my undergraduate thesis in physics. I had this idea about electro-magnetism and gravity. I was fascinated by the story of how Maxwell and Faraday, together unified the electric and magnetic fields into Maxwells Field Equations, by first carefully describing how the electric and magnetic fields interacted, and then building a mathematical framework around those observations.

Being young and having only just begun my decent down the curve of Dunning-Krugger's confident ignorance, I had the idea that if Maxwell's equations came about by a careful description of where the electric and magnetic fields interacted with one another, maybe the same could be done with the EM field and Gravity. Lo and behold, there is exactly one specific place these forces interact: the Gravitational Lensing Effect.

My undergrad physics thesis covered the equations of general relativity, and described the effect well enough to look impressive, but I never really got anywhere near the idea that led me to that topic. Now years later, with the power of AI promising to augment my analytical abilities beyond what I could have ever hope to achieve on my own, had me thinking back to this old idea. So I started a collaboration with the machine starting with trying to describe a situation where light waves could interact with themselves, and we came up with this paper:

Quantitative diagnostics of wave-wave electromagnetic coupling channels (PDF).

Light Light interaction in QED

Imagine two beams of light crossing paths. In everyday experience, they pass right through each other. Light generally doesn't interact with light. But quantum electrodynamics predicts that at extreme field strengths, the vacuum itself becomes a nonlinear medium. Photons scatter off photons through virtual electron-positron pairs. This effect is vanishingly small in a lab, but near a magnetar -- a neutron star with surface magnetic fields 10 billion times stronger than anything we can produce on Earth -- it becomes significant.

The core problem I tackled: how do you cleanly isolate and measure the signal of two waves interacting with each other, separated from each wave's self-interaction with the medium?

Existing approaches conflate the two. My solution is a diagnostic I call the linearity residual: run three simulations (wave A alone, wave B alone, both together), then measure how much the combined result deviates from simple superposition. By construction, this quantity is exactly zero in linear media and captures only the terms that depend on both waves simultaneously.

The engineering underneath

The paper presents a unified 2D finite-difference time-domain (FDTD) simulation framework that supports four distinct physics regimes through a single modular interface:

  • Linear vacuum -- the validation baseline
  • Kerr media -- the nonlinear optics of fiber optics and lasers
  • Cold relativistic plasma -- relevant to fusion research and particle accelerators
  • Heisenberg-Euler QED vacuum -- quantum electrodynamics at extreme field strengths

This is fundamentally a software architecture problem. Each physics regime plugs into the same simulation engine through a clean material interface. Two hooks per timestep plus an optional auxiliary state.

The numerical methods required real engineering:

  • A relativistic Boris pusher for the plasma module that conserves energy to machine precision (10^-14 relative error), replacing a naive integrator that blew up by 40x over the same time window
  • A predictor-corrector scheme for the QED constitutive relation that reduces self-action artifacts by 8.4x
  • Convolutional perfectly-matched-layer absorbers for clean boundary conditions

The headline result

Sweeping the background magnetic field strength in a simulated magnetar magnetosphere, the wave-wave coupling signal follows a three-channel polynomial with a cubic term that exceeds what leading-order QED predicts. Whether that cubic contribution is a genuine two-loop quantum correction or a numerical artifact of the implicit solver near its stability boundary is an open question.

I also found that cross-polarized wave configurations produce coupling 6.8 times stronger than same-polarization setups in the QED vacuum channel, combining a theoretical factor of 7/4 from the Lagrangian with a geometric factor of ~4 from the field configuration.

The full paper is available as a PDF: Download the paper.

The simulation code is written in Python with NumPy as the only runtime dependency. If you're interested in the implementation details or want to reproduce the results, I've posted the project code to Github: em-wave-coupling