#003 | Babbage, Lovelace, and the Analytical Engine (Part 1)

In this episode, we begin an exploration of the work of Charles Babbage and his designs for the Difference Engine and Analytical Engine, and computer science visionary Ada Lovelace. Also discussed are the Jacquard Loom, the interesting intersection of 19th century poetry and literature and earliest years of computer science.

This week’s recommended book:

Mentioned in this episode: Broad Band: The Untold Story of the Women Who Made the Internet, by Claire L. Evans. The image above links to this book on Amazon.

Episode Transcription

Hi, This is Wes Doyle. Welcome back to another episode of The Bitwise Podcast, where we explore the history of computer science, the discipline of software development, and the implications of an increasingly digital world. A few things before we get started - The first is that I'd like to say thank you for listening to the podcast. I really appreciate your feedback and I’m happy you’re listening. The next is to mention that I've posted transcriptions for the first two episodes available on the podcast website at bitwisepodcast.com. I'll continue to do this moving forward, posting transcriptions shortly after the podcast goes live. Finally, whenever possible, I'm going to try to start each new episode with a book recommendation or an article related to the episode. I’ll also put links to any of the resources I mentioned on the website.

So, today, I’d like to recommend a book by Claire L. Evans, called “Broad Band: The Untold Story of the Women Who Made the Internet.” This is a new book, at the time of this recording, published in 2018.  It’s really entertaining and insightful; It tells the story of many of the women who played a crucial role in the history of computer science and the tech industry, including people like Grace Hopper, who will certainly come up again in this podcast, and others - Jake Feinler, one of only a few women who worked on ARPANET, Radia Perlman, who invented the Spanning Tree algorithm used in networking while working at Digital.  I love Evan’s writing style - and I’m sure I’ll return to it again, as the podcast continues.

In this episode, we'll explore two fascinating figures whose work intertwines in the mid nineteenth century. We'll talk about Charles Babbage, who conceptualized the first general purpose programmable computer and whose ideas are still reflected in the architecture of modern computer design. We'll also talk about Ada Lovelace, who fervently studied Babbage’s designs and was perhaps the first person to envision the true potential that machines would have more than one hundred years before anything like them would exist.

I want to start this exploration with a quick detour - a personal memory related to the first time I heard of Charles Babbage. This was while I was in college sometime around two 2006, I was walking with my friend Dan, and we were talking about books. He told me about this novel by William Gibson and Bruce Sterling called “The Difference Engine.” He said it was a story written as a sort of alternate history featuring Charles Babbage and how history might have unfolded if the computer had been invented and mass produced in Victorian Britain and a technological revolution taking place at that time.

It would be a few years before I picked up a copy of that book, but, I have to thank Dan, at the very least, for introducing me to William Gibson, the man who coined the term cyber space and the author of books like Neuromancer and a collection of short stories called Burning Chrome. These were stories about hackers, mega corporations and runaway artificial intelligence.

As a side note, this brings to mind another memory of a conversation with Dan. I distinctly remember walking into a bookstore one afternoon, probably a year later, and he asked me if I wanted to learn Rails, which was probably only two or three years old at the time. I think DHH open source, the framework around 2004 so it was probably really taking off at that time. I assume I said no, unfortunately, since that's about all I can recall from that conversation, and I've still never built anything substantial on Rails. But, maybe I would have become a software developer earlier had I taken him up on the suggestion.

It's the year 1812. The Hungarian composer Franz Liszt is just one year old, as is the American abolitionist Harriet Beecher Stowe, born in Connecticut. James Madison has just asked the U. S. Congress to declare war on the United Kingdom, starting the War of 1812. Charles Dickens has just been born in Portsmouth, Southeast England, and just a few hours north in Cambridge, Charles Babbage, at that time a student at Trinity College, is, according to his memoirs, dozing off in front of a table of logarithms. He writes about this in his 1864 memoir, Passages from the Life of a Philosopher. When another student notices that he's drifting in and out of sleep, and asks him what he was dreaming about. He responds that he was thinking about how the table of logarithms could be calculated by a machine.

in 1819, about seven years after Babbage’s supposed dream of a machine that would tabulate such mathematical tables, he began seriously work on his first major project, the Difference Engine, a device that would automatically compute mathematical tables using a technique called the method of finite differences. This method is what gives the machine it's name and which is based on Isaac Newton's divided differences algorithm. Babbage’s goal was to eliminate the tedium and the human error that inevitably crept into generating these sorts of tables. Tables of trigonometric functions and logarithms were widely in use before digital calculators became ubiquitous. As you might imagine, it's much easier to quickly look up a value than it is to calculate it by hand.

You might say that the innovation of mathematical tables, in the case of things like log and trig functions, help reduce the runtime of these types of calculations to constant time [O(1)]. That's a bit tongue-in-cheek, but you get the idea why recalculate a value when you can memoize it?

Anyway, logarithm tables, in particular, make it much easier to perform multiplication and division because they can be quickly used to convert them into addition or subtraction problems. This is because of the property log(A) + log(B) is equal to log(AB), so you can just quickly multiply two numbers A and B by looking up their log values in one of these tables, summing them and then taking the antilog to get the product. The antilog, of course, is also provided by a separate table. Additionally, the common logarithm of numbers greater than one that differ only by a factor of a power of ten have the same fractional part. This is called the mantissa. Thus the tables of law algorithms that you would find in books typically only included the mantissas. So the imager part of the logarithm - the part before the decimal point, if you will - is called the characteristic and can be determined simply by counting digits in the original number. The fractional part of the common log of numbers between zero and one is just one minus the mantissa of that number, with the decimal point shifted to the right of the first non zero digit. I realize this sounds a little complicated in audio format, but it's really pretty easy to get the hang of using these tables, even with just a few minutes of practice, and you can quickly begin to appreciate their usefulness.

So, Babbage set out to build his machine. That would make generating these types of tables much easier and with fewer calculation errors. But in 1822, Babbage had completed a prototype difference engine that could be operated using a hand crank. And in 1823, the Royal Society helped him secure grant from the British government to start working on a full scale version of his engine. Due to the exceptional cost of machine parts to the precision required to build out the design and a falling out with the lead engineer that Babbage had hired to help build the device, the industrialist Joseph Clement, the engine was never fully completed. There was small working model was completed sometime around 1833. Over budget and behind schedule, funding for his project dried up in 1842. By that time, Babbage was already very much at work on his second big idea, which he had thought of while working on the Difference Engine. This was the much more ambitious Analytical Engine, whereas the Difference Engine was a special purpose machine, built essentially to tabulate logarithms and triggered a metric functions, the Analytical Engine was conceived of as a true general purpose computer.

The name for the new machine - Analytical rather than Difference - signaled Babbage is vision of a machine that would be designed to perform general sorts of computation rather than one that relied on a single algorithm for solving polynomial equations. The Analytical Engine incorporated and arithmetic logic unit control flow in the form of conditional branching and loops and integrated memory at a very high level. Its logical structure and architecture closely resembles that of computers being built today. It would have been operable using three different types of punchcards. Nearly 40 years before Herman Hollerith would invent a method for data storage using punch cards. In a century before innovators like Konrad Zuse from Germany would construct early electromechanical computing machines, his Z3, or George Stibitz from Pennsylvania, who worked at Bell labs would build the relay based computing machine Model K, which calculated using binary edition or perhaps most famously, Howard Aiken, would present the concept for his Harvard Mark I to IBM.

The detail about the evolution of punch cards is interesting, and perhaps we'll revisit Hollerith in a future episode. His machine used punch cards is a primitive form of memory to store data, while computing the U. S census.

Of his new idea, this Analytical Engine, Babbage wrote to a friend:

“I have been working on a machine that is more powerful than the first. I am myself surprised at the power that can be conferred on this new mechanism just one year ago, I should never have imagined that such result was possible.”

In my reading. one of the most fascinating aspects about the Analytical Engine was its ability to handle conditional logic. Keep in mind, this is like the mid-19th century, and everything was purely high-level mechanical. It's said that an Italian mathematician with whom Babbage was discussing his idea came to him with the question of “…how the machine could perform the act of judgment sometimes required during an analytical inquiry, when two or more different courses presented themselves, especially as the proper course to be adopted cannot be known, in many cases, until the previous portion had been gone through.” Babbage’s idea for solving this problem - devising a means of conditional branching - was ingenious. It relied on the fact that two courses of action could depend on the outcome of some calculation to be a negative or a positive number.

For negative numbers to be represented in bandages, machine all of the numbers to the left of the significant digits of the output were output as the number nine, and would go on for as many registers were available. Babbage thought to design the machine in such a way that if the final register, the one at the farthest left, were to trip, signifying a negative number, then the machine would advance or roll back a series of the punch cards to a location determined by register punched in one of the variable cards. So, he would use this property of his mechanism to essentially skip over or loop through a routine as many times as were required by the instruction set.

When I read about this, it made me smile because it immediately brought to mind the familiar cartoon illustration of the motion of tape, if you will, in a Turing Machine model.

Regarding the use of the paper punch card in Babbage is designed for the analytical engine - as you're probably aware, punch cards were used much later in electrical computers - we actually find the ancestor of the computer punch card in the Jacquard loom, invented by Joseph Marie Jacquard in 1804, which was controlled by a number of punchcards tethered together in a sequence. This idea of using punched cards in a loom for generating different patterns existed sometime before Jacquard, but he kind of brought a few different ideas together to form this more automated loom.

The cards allowed looms to produce intricate patterns in woven fabrics. So in Jacquard’s loom, the paper cards allowed looms to produce intricate patterns in woven fabric in an automatic fashion.

An interesting segue way here is the origin of the term Luddite. Today, we use the word Luddite to describe someone who is opposed to new technology or industrialization. The term actually refers to a group of early 19th century English textile workers who damaged or destroyed automated machinery - machinery like Jacquard looms - in protest of the fact that the new automation was replacing skilled labor.

In 1812, the same year that Babbage was dreaming up his initial design of the difference engine, the British parliament passed the Destruction of Stocking Frames Act of 1812, which increased the penalties for such acts. During the time that that statute was enforced, between sixty and seventy Luddites were actually hanged, and more sent to penal colonies in places like Australia, though other pre-existing laws were actually used to justify those punishments.

I was actually able to find a copy of this lawn Google Books. A section of that law reads [reads from the law].

So the English government at that time was taking the matter of these Luddites very seriously. One of the most prominent advocates of the Luddites at that time, someone who was publicly opposed to the Frame Breaking Act, was Lord Byron. You may be familiar with Lord Byron as being a famous English poet. He was actually the father of the next prominent figure will discuss Ada Lovelace.

A very brief and final thought about George Gordon Byron: I'm reminded of a satirical article I once read in The Onion entitled Cool Dad, Horrible Father. It's interesting, perhaps just from a strictly narrative perspective, to see this leading figure of the romantic movement having part even if only as a footnote in the history of computer science.

As mentioned, he was the father of Ada Lovelace, who will return to in a moment. He also famously spent the summer of 1816 with Mary Shelley and her husband, Percy Shelley, and Mary's stepsister, Claire Claymont, who was pregnant at the time after having an affair with Lord Byron. The story of Byron and Claire and their child Allegra is quite tragic. However, it's worth noting that it was during this summer at the age of 18 that Mary Shelley wrote Frankenstein or The Modern Prometheus. Frankenstein is a rich and moving novel, and, among many other themes, explores the potentially unforeseen consequences of blind ambition in the name of scientific progress.