December 10, 2015 marks the 200th anniversary of the birth of Ada Byron, later Countess of Lovelace, most famous for her 1843 description of Charles Babbage’s Analytical Engine.

Beginning around 1822, English mathematician Charles Babbage designed a series of mechanical calculating machines, or as he called them Engines. Of these, the Analytical Engine is recognized today as an (unrealized) general-purpose digital computer. Amid all the current interest in Ada, I would like in this blog post to tilt the scales a little back towards Babbage, and take a look at the origins of some of the key ideas which he later embodied in the Analytical Engine.

The Analytical Engine was always a work in progress as Babbage came up with new ideas. He constantly went back to revisit old ideas and make improvements. It was a clear case of the perfect being the enemy of the good, because he never managed to fully flesh out the highest levels of his designs or actually build any version of his machine. For instance, the closest we have to a “user instruction set” for the Analytical Engine are simple lists of operations sketched out informally in a couple of places in his working notebooks (or “Scribbling Books” as he called them).

The Engine went through many iterations. A particularly well-known one was called “Plan 25,” dating from August 1840. In Babbage’s drawings, the “plan” sheets show a top view of all the columns in the machine, and serve the role of micro-architecture diagrams. Plan 25 is well-known because Babbage had it engraved for printing and this is the state of the Engine at the time he presented it in Turin where Menabrea wrote his famous account–which Ada, more famously, translated and then embellished with her Notes.

In Ada’s Notes, for whatever reason, she went to some length to point out that there was no essential link between the conception of the Difference Engine and that of the Analytical Engine. They were separate and each could have been conceived independently of the other. Why Ada went to such lengths to stress this is unclear, because what is clear is that for Babbage himself the machines were inseparably linked, with ideas from the Difference Engine influencing and being reused in the Analytical Engine, and the Analytical Engine ultimately spawning a complete and quite distinct design for the second Difference Engine.

To find the beginnings of some of the key ideas then, we must go back to the original Difference Engine, because many of the essential features of the Analytical Engine were first explored and developed there by Babbage.

Babbage’s goal with the Difference Engine was the complete automation of the production of stereotype printing plates for pages in books of mathematical tables, so he had not only to automate the calculation of the numbers in those tables using the method of finite differences, but also to automate the formatting of the stereotype plates which recorded the results as they were produced.

In this page (shown right) from Babbage’s own table of logarithms, notice the complexity of the layout, with all but the first column reduced to four digits for compactness, recognizing that the leading digits change very slowly through the table. Note also that even in the first column, for clarity, the leading three digits are only printed on rows where they have changed. The Difference Engine No. 1 stereotype apparatus had conditional control mechanisms to make details like these possible (though admittedly some post processing would have been needed to add headers, footers and dividing lines). So right here is where Babbage first explored conditional mechanical control logic. In the Analytical Engine, Babbage showed complete mastery of conditional control, both at the microcode level where he used sophisticated interacting state machines, and at the user level.

In the calculating section of the Difference Engine, a series of additions were needed, and originally Babbage thought these had to be done sequentially (as they would have been by a human computer), and this required complex sequencing. Later he made a huge simplification by exploiting what today we call pipelining (Babbage did not use that term) to overlap several cycles of the computations and, contrary to what might be expected, this greatly simplified the control problem. But Babbage retained the full generality he had already designed in, making the machine in principle capable of much more than the basic method of differences. The control consisted of a series of barrels around which studs could be screwed to move sprung control levers at appropriate times, similar to methods in use at the time in automatic music playing machines such as the bell tower carillon.

Barrels would later show up as a major component of the Analytical Engine in a somewhat more sophisticated form, where they stored what today we would call microcode–sequences of instructions which together make up more complex operations such as multiplication and division. The first concept of the Analytical Engine used a hierarchical system of barrels in which the top level stored the user program. But re-programming this for each new problem by screwing in thousands of studs would have been difficult and time consuming, and the limited size of the barrel would have severely limited the size of programs. In 1836 Babbage hit on the idea of using Jacquard’s system of punched cards to replace this top level barrel, simultaneously removing limitations on program size and making a clear separation between hardware and software (though again I use modern terms that were unknown to Babbage).

Another early idea was a system of feedback, or as Babbage called it “the Engine eating it’s own tail”. Babbage, thinking as a mathematician, was always looking for generalization and ways to remove limitations. A particular limitation of the Difference Engine is that the highest order difference is a constant, which limits the machine to tabulating polynomials of an order equal to the number of difference columns. Babbage explored ways of allowing the results produced to reach back and modify one or more of the higher order differences. This was actually a very early area of exploration, around 1822, before he had even begun construction of the Difference Engine, and he discovered here that he had opened up a whole new area of numerical mathematics in the form of series for which there was no analytical way to express the general term of the series. The only way to find it was to laboriously grind through the whole series term by term, something that would be quite impractical without a machine. Although these early experiments were a dead end mathematically, they did lead Babbage to speculate on the nature of possibly hidden physical laws which may explain such phenomena as the Biblical miracles! Even the “Beautiful Fragment,” the only part of the first Difference Engine actually constructed, included a version of this feedback mechanism which can be seen partially obscuring the figure wheels in this picture (shown above left).

In Babbage’s day this was seen as miraculous: “The wonderous pulp and fibre of the brain had been substituted by brass and iron; he had taught the wheelwork to think,” the contemporary Harry Wilmot Buxton wrote. Demonstrating the possibilities with this mechanism was one of Babbage’s favorite party tricks at his well attended Saturday evening soirées. Of course from our modern perspective we can see there is no miracle here; all that is going on is that state is being retained in the mechanism over a long period of time, and is later being used to direct future actions – essential features of both the Analytical Engine and modern computers.

After Ada published her Notes, Babbage continued to explore the design space, and between 1843 and 1847 he refined a new version of the Analytical Engine, culminating in Plan 28. It took a new approach mechanically which resulted in a dramatic simplification, but in exchange for giving up some performance. Then, based largely on this work, he was able, very quickly, to produce the complete design for Difference Engine No. 2, which as we now know was logically sound, and can be witnessed in operation every day at the Computer History Museum. So, contrary to Ada’s assertion that the Difference Engine and the Analytical Engine were separate and independent concepts, for Babbage at least, they were intimately intertwined, and subject to a constant process of evolution.

—

To learn more about Ada’s writing on the Babbage Engines, see this related blog post by eminent mathematician and computer scientist Stephen Wolfram.