infsup

by Zinan Huang 🌸

From Railway Relays to Chemical Reaction Networks: Analog Computing Through the Ages

2026-03-26


The most beautiful thing about analog computers is that the physics is the computation.

The Train Problem

How do you make sure two trains never collide?

This spring I’m planning to visit the Monticello Railway Museum in central Illinois. They have a restored interlocking tower β€” a replica of the kind that once stood at every busy junction on the American rail network. Inside: lever machines, relay banks, semaphore signals, and a model board showing the track layout. All of it mechanical and electrical. No software.

The problem these towers solved is deceptively simple. A junction has multiple tracks converging. Trains approach from different directions. You must guarantee: if train A is cleared to cross, no conflicting route is open. Ever. A single mistake kills people.

The solution, dating back to John Saxby in 1856, is interlocking: a mechanical system that physically prevents conflicting configurations. Pull the lever for Route 1, and the levers for conflicting Route 2 are locked in place. You literally cannot pull them. The machine enforces safety through geometry β€” metal bars and cams arranged so that only safe combinations of lever positions are reachable.

This is a finite state automaton built in steel.

Electricity as Logic

By the 1920s, mechanical interlocking gave way to relay interlocking. The same logic β€” “if this route is set, that switch must be locked” β€” but implemented with electromagnetic relays instead of lever bars.

A relay is a switch controlled by an electromagnet. Current flows through a coil, creates a magnetic field, pulls a contact closed. No current, contact opens. Two states: on and off. True and false.

Chain enough relays together and you get Boolean logic. AND: two relays in series (both must be energized for current to pass). OR: two relays in parallel. NOT: a normally-closed contact that opens when energized.

The first all-relay interlocking went live in Lincoln, Nebraska in 1929. By 1936, GRS introduced the NX (Entrance-Exit) system: an operator pushes an entrance button and an exit button, and the relay network automatically sets all switches, locks all conflicting routes, and clears the signal. Hundreds of relays computing safety constraints in real time. No processor. No clock cycle. Just current flowing through circuits, finding the right path or being blocked.

Here’s what strikes me: these relay networks are computing. They take inputs (track occupancy, lever positions, route requests) and produce outputs (signal aspects, switch positions, route locks). The computation is embedded in the physics of current flow. There is no abstraction layer between the logic and the mechanism β€” the mechanism is the logic.

From Discrete to Continuous

Relay interlocking is discrete: each relay is on or off, each route is locked or free. The computation has finitely many states.

But not all physical computation is discrete. Consider a different railway problem: regulating steam pressure in a locomotive boiler. The fireman adjusts the fire, water level changes, pressure rises or falls β€” all continuously. A governor mechanism (a feedback loop of weights, springs, and valves) keeps pressure in the safe range. The governor is computing a control function, but with continuous variables, not Boolean ones.

This is the leap from discrete to analog. And it was formalized by Claude Shannon.

GPAC: The Mathematical Framework

In 1941, Shannon β€” then a graduate student at MIT working on Vannevar Bush’s differential analyzer β€” published a paper defining the General Purpose Analog Computer (GPAC).

The GPAC is an idealized circuit built from five components: adders, multipliers, integrators, constants, and constant multipliers. Wire them together, and you can compute any function that satisfies a system of polynomial ordinary differential equations:

$$\frac{dy_i}{dt} = p_i(y_1, \ldots, y_n), \quad i = 1, \ldots, n,$$

where each $p_i$ is a polynomial.

Shannon proved that the functions computable by the GPAC are precisely the differentially algebraic functions β€” those satisfying some algebraic differential equation. This was believed to be strictly weaker than Turing computation (the Gamma function, for instance, is not differentially algebraic). But in 2007, Bournez, Campagnolo, GraΓ§a, and Hainry showed that a suitable formalization of the GPAC is actually Turing-complete β€” and later, polynomially equivalent to Turing machines.

The polynomial ODE is the key. It turns out that polynomial vector fields are universal: they can simulate any computation, given enough variables and enough time.

Chemistry as Computer

Now replace “voltage” with “concentration” and “circuit” with “reaction network.”

A chemical reaction network (CRN) is a set of reactions like $A + B \to C + D$, each with a rate proportional to the product of reactant concentrations (mass-action kinetics). The resulting ODE for each species is a polynomial β€” exactly the type Shannon’s framework describes.

This is not a metaphor. CRNs literally implement polynomial ODEs. The species concentrations evolve according to the same mathematical structure as a GPAC. Chemistry is analog computation.

The field of molecular programming takes this literally: design a CRN that computes a desired function, then implement those reactions with DNA strand displacement or enzyme catalysis. The reactions do the math. No processor needed.

And here’s a result I find beautiful: Anderson, Banerjee, Gomez, Huang, and Murawski (2023) showed that in CRNs, subtraction is no slower than addition. In digital arithmetic, subtraction requires a borrow chain that can propagate across all digits. In a CRN, subtraction is just another reaction β€” there is no carry propagation, because concentrations are real numbers, not bit strings. The analog representation eliminates a bottleneck that is inherent to the digital one.

The Common Thread

From the relay banks of a 1929 interlocking tower to a 2025 DNA strand displacement circuit, the same principle runs through:

Let the physics do the computation.

A relay network computes route safety by letting current flow through the only safe paths. A governor computes pressure control by letting mechanical forces find equilibrium. A CRN computes a polynomial by letting concentrations evolve under mass-action kinetics.

In each case, there is no separation between the computer and the computation. The medium is the message. The physics is the math.

Digital computers achieve universality by abstracting away the physics β€” the same transistor logic can simulate any system. Analog computers achieve efficiency by embracing the physics β€” letting the natural dynamics of the medium do the work directly.

Looking Forward

I study chemical reaction networks as models of computation. Specifically: how hard is it for a CRN to compute a given function? Not in the Turing sense (what’s computable) but in the complexity sense (how many species, how many reactions, how much time).

This is the question of bounded analog complexity. The GPAC tells us that polynomial ODEs are universal. But universality says nothing about efficiency. Can a 10-species CRN compute square roots? Can a 50-species CRN compute the Lotka-Volterra equilibrium? What’s the minimum number of reactions needed to approximate $\pi$ to $n$ digits?

These questions connect back to the railway tower in a way I find satisfying. The interlocking engineers of the 1920s weren’t asking “can relays compute?” β€” they knew they could. They were asking “how many relays do I need for this junction?” That’s a complexity question. The same question, translated to chemistry, is what I work on.

I’ll have more to say after I visit the Monticello museum in May. I want to see those relay banks up close β€” count the relays, trace the circuits, understand how many physical components it takes to guarantee that two trains never meet where they shouldn’t.

And then I’ll come home and think about how many molecular species it takes to guarantee that a concentration converges where it should.


This is a draft. The museum visit is planned for May 2026. I’ll update with photos, observations, and hopefully a much better understanding of relay interlocking. For now, the history and the math will have to do.

References