Research shelf / Software & languages / Babbage · Antikythera · TDC

Software & languages

Three mechanical computers, re-derived as modern algorithms

Mechanical computers were designed under constraints that modern software has quietly rediscovered: no random access, no allocation, no division, and a hard limit on how much state you can hold. The papers here take that seriously enough to benchmark it — and find that the nineteenth-century memory pattern is the cache-friendly one.

Result-bearing AGPL-3.0+ / commercial
Evidence level

Experiments were run and the numbers are reported here.

FolderElectromechnical Inspired Algorithms
FieldSoftware & languages
StatusResult-bearing. C, Python/NumPy implementations; FPGA treatment conceptual.
What it is

Babbage’s difference engine, the Antikythera mechanism’s epicyclic gearing, and the WWII Torpedo Data Computer — each reconstructed as a benchmarked algorithm rather than a museum piece.

Babbage’s method of finite differences is rebuilt as a family of algorithms from a cascade reference implementation up to a loop-unrolled variant, using only integer addition. The finding is not nostalgic: the cascaded, addition-only, in-place pattern that a gear train forces on you is exactly the cache-friendly access pattern, and it beats naive implementations through reduced allocation and better locality. The binomial-coefficient structure underlying all difference orders lets coefficients be generated with no table at all.

The Military-Grade Antikythera Algorithm extracts three engines from a 2,100-year-old bronze calculator: epicyclic interpolation via Fourier-mode reconstruction, prime-factor optimisation via continued fractions, and nested circular processing for multi-frequency decomposition. The original device encoded astronomical periods as rational fractions using the prime factors 7, 17, 19, 53, 127 and 223 — chosen to hit celestial cycles with the fewest gear teeth, which is the same problem as rational approximation under a cost budget.

The Torpedo Data Computer paper reimplements the US Navy’s 1932 fire-control system — the first continuous, real-time, submarine-based integrated fire-control computer. The Position Keeper digitally simulates wheel-and-disc mechanical integration including momentum and friction coefficients, preserving the temporal smoothing the analogue mechanism provided, rather than replacing it with an idealised integrator.

The finding worth keeping. Babbage could not allocate memory, could not multiply cheaply, and could not access an arbitrary element. Those three constraints forced a cascaded, in-place, addition-only design. Two centuries later, those are the same three properties that make code fast on a machine with a cache hierarchy. The mechanical constraint and the modern optimisation are the same constraint.
Claims ledger

Every number, and what stands behind it

A claim is only worth the evidence attached to it. Each row below carries its basis: measured on the author’s own hardware, derived from the construction, measured on synthetic data, projected from literature, or simply cited.

Breakdown of this page’s claims by what stands behind each one
scroll to see the whole chart →
Every claim, weighted by its evidence. The table below is the same data row by row.
ClaimFigureBasisContext
Difference-engine speedup3–6× over naiveMeasuredProfiled across 32–2048 points
Difference-engine memory reduction50–80%MeasuredIn-place cascade vs naive allocation
Antikythera engine speedup386× over naive PythonMeasured5,000-point datasets, fully optimised path
Antikythera prime factors[7, 17, 19, 53, 127, 223]CitedFrom the mechanism itself — Nature, 2006
TDC solution rate>1,000,000 solutions/secMeasuredDigital reimplementation
TDC accuracy±0.015°Measured10× better than the legacy Mark 117 reference
TDC memory over 24 h5.3 MB boundedMeasuredContinuous operation
Gyro-angle envelope±80° → ±180°DerivedExtension of the original mechanical limit

Measured — author-run experiment on the stated setup. Synthetic — measured, but on synthetic rather than real data. Derived — follows from the stated construction or proof. Projected — paper-stated projection, not an author-run benchmark. Cited — taken from external literature.

Methods

How it works

  • Cascaded addition-only differencing. No multiplication, no division, in-place — the constraint the gear train imposed, which turns out to be the locality-friendly one.
  • Continued-fraction rational approximation. The Antikythera’s gear-tooth minimisation problem, solved the way the ancients solved it.
  • Fourier-mode epicyclic reconstruction. Vectorised trigonometry replacing the epicyclic gear train, for signal interpolation.
  • Wheel-and-disc integrator simulation. Momentum and friction modelled explicitly so the digital Position Keeper keeps the analogue smoothing behaviour.
Stated limitations

What it does not do

Taken from the folder’s own README. Nothing here has been softened.

  • All speedups are against naive implementations in the same language, not against optimised library baselines (BLAS, FFTW, or a tuned C polynomial evaluator).
  • 386× over naive Python is largely a statement about naive Python.
  • The TDC accuracy comparison is against a historical system, on the author’s reimplementation of both sides.
  • The FPGA implementations are described as conceptual; no synthesis results or timing closure.
  • Fire-control and ballistic content is a historical reconstruction exercise, not an operational system.
Use it

Free under AGPL-3.0+ for almost everyone

Personal use, charities, education and organisations under AUD 50,000 a year pay nothing. A tiered commercial licence covers everyone else.