The Analytical Engine: The Greatest Mechanical Computer Never Built
The history of mechanical computers is a fascinating one, going all the way back to Stonehenge and any number of ancient structures that may or may not have been built to compute a calendar, zodiac, or any number of important events.
Then there is the Antikythera device from the 2nd-century BCE, a hand-powered, mechanical computer that could compute astronomical phenomena like lunar eclipses and even a countdown to the next Olympic Games in Athens.
That's all well and good, but there can't be a discussion of mechanical computers without coming to one of the most fantastic 'What-If?' moments in the 19th century: Charles Babbage's coming within a stone's throw of creating a Turing-complete computer using nothing but interlocking gears powered by a steam engine.
Subrata Dasgupta, in the book It Began with Babbage: The Genesis of Computer Science wrote:
The Analytical Engine has a startling place in the history of computing. To the best of our knowledge, no machine had ever before been conceived along its lines. More remarkably, some of its key principles of design would actually be reinvented a century later by people who were, apparently, ignorant of it. If imitation is the sincerest form of flattery, then so is reinvention or rediscovery, at least when born from ignorance. It tells us much about how ahead of one's time the original inventor was.
So what is the Analytical Engine, exactly? How did it work? And why was it never built?
The Difference Engine: Stepping Stone to the Computer Age—If You Can Build It
Charles Babbage is one of the 19th century's greatest inventors, though his most famous invention—the Analytical Engine—has yet to be built.
To be clear, Babbage didn't start out with a plan for building a fully-programmable mechanical computer. Instead, he set out to calculate and tabulate polynomial functions using something known as the finite difference method.
This method reduces multiplication and division to arithmetic addition operations, making them significantly easier to implement on a mechanical calculator. Babbage began designing what he would call the Difference Engine as a way to perform these calculations rapidly and produce useful tables as its output.
Because trigonometric and logarithmic functions can be easily approximated using polynomials, the tables the Difference Engine would have produced would be very valuable for engineering, science, and related work.
The British government was spending a fortune on mathematicians to compute these kinds of tables by hand for government administration or other purposes, so having an economical way of getting the same results was something the government was very interested in funding.
"Mechanizing the preparation of mathematical tables would not only free human mental labor for other less tedious tasks," Dasgupta wrote, "but also speed up the process and eliminate human fallibility and replace it with machine infallibility."
When Babbage published the design for his first Difference Engine (No. 0) in 1822 as well as producing a proof-of-concept prototype, it immediately garnered interest by the British government, who gave Babbage somewhere between £1,500 to £1,700 to develop a working engine—the modern equivalent of about £210,000.
Babbage ran into problems very early on, however. Part of the problem with being far ahead of your own time is that you are, technologically, far ahead of your own time. The Difference Engine required a level of machine precision that simply wasn't readily available.
The complexity of its interlocking gears, printing mechanism, all of it, would turn out to be far more costly to produce than anyone realized, least of all Babbage.
The British government continued to invest in the project for nearly a decade, spending around £20,000 (equal to about £2,350,000 today) on Babbage's engine, but by 1832, all Babbage was able to actually produce was one-seventh of the calculating section of Difference Engine No. 1, and that had to be scaled back from its original design of operating with 20-digit numbers and six-order differences, to just six-digits and second-order differences.
And even though this engine worked as it should, it couldn't yet produce the tables of calculations that the British government was ultimately interested in. It stopped funding the project in 1833, before finally cutting off any involvement in the project about a decade later.
By then though, Babbage had something else in mind than just calculating polynomials, he wanted to build a general-purpose machine that could compute anything that was computable, and he devoted the rest of his life to designing just such an engine.
Imagining the Analytical Engine
When we talk about the Analytical Engine, obviously, we have to talk about the concept of it, the plans for it, or someone else's efforts to actually build it, since Babbage himself would never see it completed at the time of his death in 1871.
But even as Babbage was trying to produce a working prototype of the Difference Engine for the British government, his mind had already settled on something far bigger, even finding inspiration in the criticism that the Difference Engine was too small.
Luigi Frederico Menabrea, an Italian military mathematician who would later go on to become the Prime Minister of Italy, criticized the Difference Engine as being restricted to a single problem or use case, namely that of calculating and tabulating polynomial functions.
It's great if you needed to calculate polynomial functions, Menabrea argued, but what if you needed it to do something else? Babbage's expensive machine was useless in every other case.
Menabrea's criticism helped spur Babbage to think bigger and conceive of a machine that could calculate any analytical function that could be expressed in mathematical notation.
He vastly expanded on the dozens of numbered wheels connected through interlocking gears and envisioned a machine, the Analytical Engine, that would have hundreds of columns of numbered wheels and gears, capable of representing numbers that were 40 digits long.
Unlike his Difference Engine, which could be hand-powered by a crank in some iterations of the design, this would be impossible for the hundreds of interlocking columns of wheels and gears.
The Analytical Engine would need to be powered by steam, in a similar way to a locomotive.
It would have to be as large as a locomotive, too, to contain all its numbered columns and associated machinery. If built, the Analytical Engine would be as large as any of the earliest electronic computers like the ENIAC, though it wouldn't have been nearly as fast.
The Analytical Engine's "clock speed", or the number of instructions per second it could perform, isn't known since complete documentation isn't available, but it is estimated that it would be around 10 to 20Hz at most.
For comparison, ENIAC had a clock speed of about 5,000Hz. But, it also had no real internal memory. It had 20 accumulators which could each hold one 10-digit signed decimal number, but that was it.
It didn't even have cache memory, much less RAM. The Analytical Engine, meanwhile, would have had a working memory of around 16.6KB, which is significantly more than the ENIAC.
There is also another important comparison with the ENIAC as well, namely its manner of input: punch cards.
Inspired by the recent invention of the Jacquard Loom, which used hole-punched cards to "program" a pattern to be woven into a textile automatically, Babbage saw that these same punched cards could be used to express mathematical notation and variables, and even instructions for how to carry out a calculation.
Using a punch card system, Babbage's Analytical Engine would be able to carry out a wide range of mathematical calculations, so long as they were based on arithmetic operations.
In designing the Analytical Engine, Babbage invented concepts that would be reinvented a century later in the form of "computer architecture", the design of the flow of information from memory to a processing unit and then output the results to a printing device or back into memory.
Babbage called the processing unit on his engine the Mill, and termed the mechanical memory the Store—an obvious analogy to the textile mills popping up all over England during the Industrial Revolution.
Just as a textile mill would fetch spun yarn from a nearby store or warehouse, fabricate a textile fabric in the mill from that yarn, and then return the finished product to the same store, so too would the Analytical Engine, only, its yarn would be numbers, and its textile fabric would be calculations.
From there, those results could be used again and again for different calculations, printed out as tables, or even saved for later use by punching new cards that contained the contents of the engine's Store.
The innovation of separating the arithmetic processing unit from the memory containing the values being operated on and even the instructions for those operations was a conceptual leap nearly a century ahead of its time.
It wasn't until John Von Neumann invented the stored program architecture used in the modern computer that something like this would even be imagined.
The innovations didn't stop there.
Building on the idea of Jacquard's punched card system, Babbage envisioned a machine where different control cards could be used to program more complicated operations, including looping through instructions and even conditional branching so that different instructions would be carried out based on different input values.
As the renowned "Enchantress of Numbers", Ada Lovelace, wrote in 1842:
We may say most aptly, that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves. Here, it seems to us, resides much more of originality than the Difference Engine can be fairly entitled to claim... We believe that it is the only proposal or attempt ever made to construct a calculating machine founded on the principle of successive orders of differences, and capable of printing off its own results; and that this engine surpasses its predecessors, both in the extent of the calculations which it can perform, in the facility, certainty, and accuracy with which it can affect them, and in the absence of all necessity for the intervention of human intelligence during the performance of its calculations.
To make her point, the wildly brilliant mathematician wrote a simple program for the Analytical Engine that would compute a series of Bernoulli Numbers, earning her the distinction as the world's first computer programmer.
Lovelace enjoys that distinction because of the essential defining feature of the Analytical Engine that makes it such a break with the mechanical calculators of the past: the Analytical Engine, were it ever built, would be Turing-complete.
In 1936, Alan Turing published "On Computable Numbers", a revolutionary work that laid the conceptual foundation of modern computing.
In essence, any machine that can read in a set of instructions and behave and manipulate data based on the rules laid out in those instructions can run any algorithm or program that is computable.
This sounds like a mouthful, but everything from generating a sequence of Bernoulli Numbers to cloud computing is the product of algorithms computing values that are represented in binary numbers.
Essentially, a big enough Analytical Engine could, in theory, run Doom (albeit without graphics), and it is the first machine ever devised that can make such a claim.
Impact and Influence of the Analytical Engine
Whatever his criticisms were of the Difference Engine, Menabrea saw that the Analytical Engine wasn't just brilliant, but that it was an entirely different kind of machine than some simple mechanical calculator:
The confidence which the genius of Mr. Babbage must inspire, affords legitimate ground for hope that this enterprise will be crowned with success; and while we render homage to the intelligence which directs it, let us breathe aspirations for the accomplishment of such an undertaking.
Unfortunately, if the Difference Engine proved to be too expensive to build, the Analytical Engine was a monumentally more expensive proposition.
Babbage worked on the Analytical Engine for more than a decade, starting in 1833, before turning his attention to an improved version of the Difference Engine (No. 2) in the late 1840s.
He returned to the Analytical Engine in the 1850s, though, and continued working on it until his death in 1871. Only small portions of the engine were ever actually built, but Babbage left a remarkable record for us to examine on this revolutionary machine, as computer scientist and writer Subrata Dasgupta notes:
[D]uring the first 16 years (1833-1849) that he devoted to the project and then again during the later period (1856 until his death), he was at it constantly, ideating, thinking, refining, elaborating, conceptualizing, obsessing. Where is something quite poignant in our imagined vision of this man, working in complete isolation, obsessed with an idea, the archetypal lonely inventor, the solitary scientist of Romantic lore, churning out drawing after drawing, in their hundreds, note after note, in their thousands, conceiving new ideas, designing new mechanisms, for a machine he must have realized would never get built in his lifetime.
There have been some recent efforts to try to construct the Analytical Engine, but none have actually produced a real working machine, though Babbage's plans are still there and have now been digitized.
Even with all of that, building the Analytical Engine in 2021 appears to be too expensive to secure sufficient funding at this stage. You can imagine how hard it would have been for Charles Babbage in 1834 to find the money to build his machine, then.
But still, what if? What if Babbage had the funds to build his steam-powered mechanical computer a century before ENIAC? What would the world look like today if he had?
All of the speculations around these questions go a long way to explaining why Charles Babbage's Analytical Engine so fascinates us today, and why so many people want to see it built, even if just to see if it would have worked.
"We could not have asked for more from InSight," Anna Harleston, co-lead of NASA InSight's Marsquake Service told IE.