How do you determine the optimal placement for a wifi router? For most people, this could be an exercise in design, or in outlet location and cable length, or maybe where it's most convenient to frequently reset. For a physicist, it involves solving the Helmholtz equation.

Jason Cole is a PhD physics student in London. He researches laser-wakefield acceleration at the John Adams Institute for Accelerator Science at the Imperial College of London. The field sounds like downright evil villainy: not content with conventional particle accelerators, he fires ultra high-powered lasers into tenuous plasmas, generating strong electric fields that accelerate electrons thousands of times faster. I'm certain there's no chance at all that's going to be the inspiration for a doomsday machine... When escaping the frustration of dealing with inevitably malfunctioning equipment, he dabbles in numerical methods. That's where today's story starts.

Instead of snaking LAN cables throughout his new flat, he switched his desktop computer to a wifi card. Alas, the signal was wonky, dropping out far more often than can be politely tolerated. Undaunted by the initial lackluster performance, he sketched up a layout of his new apartment, and set MatLab to ray-tracing to see how the signal was bouncing around the space.

Only a few lonely rays were reaching the concrete corner where the computer was located, explaining why signal was less than sufficient. A bit more tweaking, and Cole was able to adjust the router's position within the model, visually observing the signal flux map to decide if reorganization would solve the problem.

A flux map with 2,000 rays tracing out wifi signal throughout the flat. Image credit: Jason Cole

Yet, Cole was dissatisfied. Ray tracing was quick and simple, but not particularly rigorous. A little over a month later, he returned to the problem, this time using two-dimensional Helmholtz equation, using the walls as boundary conditions. The Helmholtz equation is used to model how electromagnet waves propagate through time and space; the two-dimensional version leaves out pesky things like room height and allows Cole to check out wifi signal propagation using the apartment layout he already sketched for the ray path tracing.

Writing math and equations without LaTeX is too obnoxious for me to tackle here, but Cole does this often enough to have a visually elegant layout on his blog. Head over to the Helmhurts entry to follow along with the working through the Helmholtz equation, using dispersion and refraction of the electromagnetic wave to solve for the electric field within his flat. He peppers in some excellent visualizations to reward you for slogging through the equations — the animated gif of electric node null points is particularly hypnotizing and worth a click all by itself. Finally, Cole reaches the point where he can produce electromagnetic intensity maps of his flat, where warmer colours indicate a stronger field, and black zones are null areas.

Electromagnetic intensity map with the router "hidden away somewhat uselessly in the corner." Image credit: Jason Cole

The result was unexpected. Cole writes:

I would have expected to see some region of 'brightness' around the electromagnetic source, fading away into the distance perhaps with some funky diffraction effects going on. Instead we get a wispy structure with filaments of strong field strength snaking their way around. There are noticeable black spots too, recognisable to anyone who's shifted position in a chair and having their phone conversation dropped.

He started moving the router around the flat. His analysis of how different locations impact the intensity maps are entertainingly practical ("Tendrils of internet goodness can get everywhere, even into the bathroom where no one at all occasionally reads BBC News with numb legs."), but the math still didn't seem entirely reflective of the reality he was experiencing within his flat.

That's when a handy commenter piped up, pointing out that expanding the math to allow for imaginary components would more accurately reflect the concrete walls partially absorbing signals, instead of idealized perfect reflections that were causing destructive interference and frequently nullifying the signal. Consider this as further proof that just because it's imaginary doesn't mean it isn't important!

Cole's solutions were getting downright plausible, but he was still leaning on one hand-wavy assumption to simplify the problem: that aside from the wave's sinusoidal oscillation, the problem was time-independent. Intuitively, this seems like a fair approximation — surely radiation moving at the speed of light will so quickly bounce around an apartment that it may as well be instantaneous! Yet, that kind of assumption is so easy to make in physics, and not always justified.

In a final surge of dedicated geekery, Cole abandoned the simplification of Helmholtz equations, pulled up the full suite of Maxwell's equations of electromagnetic waves, and applied the Finite Difference Time Domain technique to numerically crunch through the problem.

After the initial wave propagation at the start of the model, the results quickly line up with the Helmholtz solution from before, nicely justifying the time independent simplification.