A Program for a Machine That Didn't Exist
Zusammenfassung
In 1843, Ada Lovelace published notes on Charles Babbage’s Analytical Engine that included what is now recognized as the first computer program — an algorithm for computing Bernoulli numbers. She wrote it for a machine that had never been built and would not be built in her lifetime. The notes, translated from an Italian description of Babbage’s lectures, contained more original content than the paper they annotated. Lovelace died nine years later, aged 36. The machine she programmed for was never completed. Her algorithm was correct.
The Notes on Menabrea
In 1842, Italian mathematician Luigi Menabrea published a French-language paper summarizing lectures Charles Babbage had given in Turin about the Analytical Engine — his design for a mechanical general-purpose computing machine. The paper was a competent summary but not detailed enough for an English audience to fully evaluate the machine’s capabilities.
Ada Lovelace, working with Babbage’s guidance, translated Menabrea’s paper into English and added her own notes, which she labeled A through G. The notes are longer than the original paper. Note G — the most technically significant — contains what historians of computing now identify as the first algorithm designed to be executed by a machine: a procedure for computing Bernoulli numbers.
Bernoulli numbers are a sequence of rational numbers with deep connections to number theory. Computing them requires iterative arithmetic — calculating each from the previous ones according to a formula. Lovelace’s Note G described, using a table of operations on the Analytical Engine’s “variables” (its storage registers), precisely how the Engine would perform this iterative calculation.
What the Algorithm Demonstrates
The Bernoulli number algorithm in Note G demonstrates several concepts that would not be formally named for another century:
Looping: The algorithm uses a procedure that repeats with modified parameters — the essential concept of a loop. Lovelace noted that the Engine would need to return to earlier points in the operation sequence, advancing a counter each time.
Conditional branching: The algorithm’s loop terminates when a condition is met — the counter reaches a specified value. This is a conditional: do this until that.
Variable reuse: Lovelace carefully tracked which of the Engine’s variable columns held which values at each step, noting when a column’s value could be reused for a new intermediate result. This is register allocation.
Subroutines: She noted that a single set of operation cards could be used multiple times within a calculation — the concept of a reusable procedure.
Babbage himself had worked through some similar calculations, and historians have debated the extent to which the Bernoulli algorithm was Lovelace’s independent contribution versus a formalization of Babbage’s ideas. The correspondence between them shows Lovelace identifying and correcting an error in Babbage’s version — a fact that argues for significant independent intellectual contribution.
The Machine She Programmed For
Charles Babbage designed the Analytical Engine beginning in 1837. It was a purely mechanical design: gears, rods, and cams, driven by a steam engine, capable (in principle) of performing any computable arithmetic. It had a store (memory, implemented as columns of gear wheels), a mill (processor, where arithmetic was performed), input (punched cards, adapted from Jacquard looms), and output (printed results or punched cards).
The Analytical Engine was never built — not in Babbage’s lifetime, not in the 19th century. Babbage designed it in meticulous detail and built partial prototype sections, but lacked the manufacturing precision and the sustained funding required to complete the machine. The calculations Lovelace programmed for it could not be run. Her algorithm existed only on paper.
The full story of Ada Lovelace covers her life, her mathematical education under Mary Somerville, her correspondence with Babbage, and the biographical context behind the notes.
Vindication Through Emulation
The Analytical Engine was never built, so for more than a century Lovelace’s algorithm could not be executed on the machine it was written for. Software emulators of Babbage’s design — most notably the one John Walker built at Fourmilab in 1998 from Babbage’s plans — eventually made it possible to run Note G’s procedure. Translated faithfully (and correcting a known typographical slip in the printed table of operations), the Bernoulli-number algorithm produces correct results. The first computer program was sound: written for a machine that could not yet run it, by a mathematician who died decades before any machine could test it.
📚 Sources
- Lovelace, Ada A.: “Sketch of the Analytical Engine Invented by Charles Babbage, Esq. By L.F. Menabrea… with Notes by the Translator” — Scientific Memoirs, Vol. 3 (1843)
- Fuegi, John & Francis, Jo: “Lovelace & Babbage and the Creation of the 1843 ‘Notes’” — IEEE Annals of the History of Computing, Vol. 25, No. 4 (2003)
- Hollings, Christopher, Martin, Ursula & Rice, Adrian: Ada Lovelace: The Making of a Computer Scientist (2018), Bodleian Library
- Collier, Bruce: The Little Engines That Could’ve: The Calculating Machines of Charles Babbage (1990), Garland