③ Enchanting Numbers▪On computers’ invention as mechanical calculators

Computing began long before the twentieth century. Mechanical calculators ran on cogs, wheels, and steam engines.

Padua, Sydney

The Thrilling Adventures of Lovelace and Babbage Book

2015.

Links | BibTeX

MechanicalComputing,

How the Pascaline works Online

2012.

Links | BibTeX

Scoble, Robert

A demo of Charles Babbage's Difference Engine Online

2010.

Links | BibTeX

How would you like a job as a computer? Not a programmer, not even a mathematician. A computer. Someone who makes calculations. By hand. All day, every day.

I guess that doesn’t sound appealing. Until well into the previous century, however, those jobs did exist. And so did the word computer. It referred to these people, who worked patiently in the back-office of every factory, bank, and government department. There they calculated everything, from mortgages to railroad bridges to government budgets.

In the decades after the Second World War, they were quickly being superseded, first by mechanical calculators and later by electronic computers. To us in the twenty-first century, the idea that those jobs ever existed seems utterly ridiculous. But it took centuries of increasingly complex inventions and visionary realizations before manual computing was finally a thing of the past.

Hello and welcome to A History of Science: Episode 3: Enchanting Numbers.

Introduction

Until the invention of the modern electronic computer in the 1940s, calculating had always been hard manual labor. In the sixteenth century already, Tycho Brahe, the astronomer who was renowned for the accuracy of his data, complained about it in the preface to one of his books. He strikingly reminded his readers that if they got tired of the many calculations in his writing, they’d better take pity on the author, who had had to do them all three times over.

The burden of calculating could be reduced somewhat using an abacus, but it remained tiring and mind-numbing work. During the Enlightenment, when the whole world was increasingly being interpreted in terms of math, the first attempts at mechanizing math itself were made. These early mechanical calculators marked the beginning of the long journey that culminated in the invention of the computer.

In this episode, we will explore the inventors of the mechanical computer. It is a story of men and women who lived centuries apart but were all ahead of their time. And who, in contrast to our heroes of our previous episodes, all applied science that was actually correct.

Blaise Pascal and the Pascaline

Let’s start off with a little thought experiment. Imagine a clock. But instead of twelve numbers, this one has ten. It starts at zero and counts up all the way to nine. And instead of just two arms, this clock has ten: one for each number. All arms move on the same wheel, so if one moves, they all move. And finally, the arms are all black, except for the one pointing to zero: that one is bright red. Congratulations, you have just invented a calculator.

Don’t see it yet? Let’s try a sum: three plus four. Imagine moving the red arm from the zero to the three. Now move the black arm that happens to point to the zero to the four. The red arm now points to seven: three plus four.

What I have just described is the Pascaline, the first ever mechanical calculator. It was invented in 1642 by the Frenchman Blaise Pascal. Pascal was something of a child prodigy, who would go on to become an influential mathematician and philosopher in his own time. When he was nineteen, however, he saw his father struggling with tax collection, and decided to invent a machine to help him with additions and subtractions.

Pascal’s machine was more advanced than the one you just imagined, even though the basic principles were the same. As you may have noticed, the clock-like calculator we discussed only works for sums under ten. Above that, you need some sort of mechanism to increment one digit at every ‘hour’ to a similar clock representing the tens. That way, a sum that passes nine will move on to zero on the same clock, but will add one digit to another clock on its left. Pascal designed an elegant lever for that operation, one that relied on its own weight to increment the clock to its left.

Blaise Pascal’s Pascaline turned out to be dependable and accurate, and it was the first blatant success for its young inventor. It never became a commercial success, however. It required more knobs and wheels than most contemporary clocks, and before the Industrial Revolution, these had to be hand-made by craftsmen. That made Pascal’s machine too expensive to mass-produce, and only twenty are known to be in existence. Among those who used the machine, however, it gained an excellent reputation. Rather than automate math, however, the Pascaline remained mostly a mechanical novelty.

Calculation in the 19th Century

In the centuries that followed, Blaise Pascal’s design served as an inspiration for many like-minded inventors. Most designers tried to build similar devices with additional abilities for multiplication and division, mostly with limited success. Some of these designs never left the drawing table, others were built but didn’t come close to the reliability of Pascal’s original. At the dawn of the nineteenth century, Blaise Pascal’s calculator had still not been surpassed.

The world had changed dramatically since its invention, however, and with it had the prominence of math. The Industrial Revolution was in full swing in 1800. Factories had split manufacturing processes into bite-sized chunks that no longer required experienced and skillful craftsmen. These tasks required no skill at all on the worker’s part, except for near mechanical precision. Products made from cotton, wool, or metal thus no longer depended on workers’ craftsmanship, but instead on calculations that described how raw materials should be combined into final products.

Factories were not the only places where calculations were at the forefront. Modern nation states kept expanding their branches of government throughout the nineteenth century. In the wake of the American and French revolutions, countries started becoming more democratic. With democratic governments, early forms of social security and public health programmes saw the light of day. Implementing these policies required unheard amounts of data in the form of censuses, measurements, and statistics. Whole armies of civil servants were occupied with counting votes, determining unemployment benefits, and calculating population growth.

The cry for automated calculation grew deafening. It was heard loud and clear by Charles Babbage.

Charles Babbage and the Difference Engine

Charles Babbage was a mathematician with more than a knack for mechanical engineering. He was born into a prominent London-based family in 1791, and went on to have a successful academic career as a professor in astronomy and mathematics.

While working at the Astronomical Society, Babbage experienced the problems of manual computing first-hand. The society’s most celebrated publication was the Nautical Almanac, a multi-volume book of nautical charts that was used by navigators at sea. While checking the numbers in their latest version, Babbage noticed discrepancies. Lots of them. And not just the odd typo, but worse: systematic errors.

Calculations in the almanac, as in many other fields of science and engineering, were done with the help of log tables: tables that listed the results of logarithmic functions for a huge number of integers. Log tables were invaluable when performing complex multiplications. But, like any other calculation, they were done by hand. And so, unavoidably, they contained mistakes. Any calculation based on a mistaken log table value was bound to be wrong as well.

Now, interestingly, the logic involved in calculating logarithms is relatively simple. The bottleneck is that the calculation of any row in a log table needs the result of the previous row as input. An error in any row, then, practically cripples the whole table. A nightmare for anyone whose calculations depend on it. Like Charles Babbage.

Babbage realized that the errors in these calculations were all caused by mundane reasons: calculators getting tired and sloppy, typesetters who couldn’t read the calculators’ notes. None of it was caused by the difficulty of the math; the calculations themselves were straightforward enough. A machine, he reasoned, did not get tired or sloppy, and should be able to generate flawless log tables. And the fewer people it required, the smaller the chance any errors would slip into its output. Babbage named his invention the Difference Engine, after the method of divided differences with which log tables were calculated.

Nothing like the Difference Engine had ever been imagined, let alone built. Sure, mechanical calculators had existed for centuries, but they still required the user to perform every step. On the Pascaline, the user had to input each number by hand, then crank a handle to reset the numbers before the next sum. A machine that would perform all these steps – reading input, manipulating data, printing output – without human intervention was unprecedented.

These days we remember Charles Babbage as a visionary genius, but not as a great project leader. He was the archetypical brilliant professor; full of ideas, but without the perseverance to realize them. Whenever he came up with a better idea, Babbage would take his machine apart and start from scratch. Even worse, when it came to dealing with people he was truly his own worst enemy. He was condescending to his subordinates, academic peers, and – worst of all – to his patrons. When any of them did not show enough enthusiasm to yet another rebuild of the engine to accommodate Babbage’s latest great idea, he didn’t hesitate to ridicule them for their short-sightedness.

This behavior did not make him many friends. After working on the Difference Engine for a decade, and spending a small fortune of government grants on it, Babbage could only show a small prototype to his investors. And instead of giving them every possible assurance that he was close to finishing it, he boldly proposed abandoning the machine altogether. Charles Babbage had had an even better idea.

The Analytical Engine

Now that he did. There is no doubt about it. But no matter how good it was, it did not get funded. Nor did it get built. It would linger in obscurity until the invention of the modern electronic computer, when – in hindsight – it turned out to be brilliant.

So what was this brilliant machine Charles Babbage invented? Well, the Difference Engine was great and all, but it was still specifically built to perform one kind of calculation: log tables. What if there was a machine that could handle any calculation, no matter its complexity, precision, number of variables, or conditionals? A calculator, in short, that did math regardless of its application in the real world?

Babbage had envisioned the general-purpose computer, or – as we know it – the pc. And as it was still the first half of the 1800s, he designed it as a steam-driven mechanical monster.

Now this ‘Analytical Engine’, as he called this new machine, has never been built. Even though Babbage described its workings in countless documents and letters, what exactly it would have looked like is anyone’s guess. Someone who made an inspired guess is Sydney Padua, who wrote a graphic novel on Charles Babbage and his machines. Her drawing of the Analytical Engine may help you get an understanding of what it looked like. A link to her interpretation is on the website: ahistoryof.science.

When you get past the first impression of the Analytical Engine as a seven meter long mechanical steam engine, it is remarkable how much its parts resemble those of modern computers. It has a processor, a memory bank, a card reader for input and a printer for output. In recent years, it has been estimated that the Analytical Engine ticks all the boxes that computer science pioneer Alan Turing proposed for computers. That means it is – conceptually – a complete computer.

So how did it work? Well, the ‘sequences of calculations’ – or as we would say, software – would be inserted into the machine on punched cards. Punched cards had been used with great success by Joseph Marie Jacquard in his automatic textile manufacturing machine, the Jacquard loom. The instructions on the cards would be executed on the numbers put into the ‘store’, the engine’s memory. The store made up the largest part of the engine, and consisted of thousands of columns that could each store a number of up to 50 decimals. Long rods would transfer the values in the store to the ‘mill’, the processor. There, the calculations would be performed and the output written to the printer. The whole process would be driven by a steam engine.

Now, as you can imagine, this giant machine cost a fortune to build. And there were no investors left who were eager to fund Charles Babbage, the man who hadn’t made good on his promise to build the much smaller Difference Engine. As the years passed him by, Babbage grew increasingly frustrated; why did nobody see the revolutionary impact his machine could have? Why did no one believe in him?

There was one person who believed in him, though. And no story about the Analytical Engine would be complete without her.

Ada Lovelace

Lady Ada Lovelace was born to the poet, womanizer, and all-around enfant terrible Lord Byron. She never met him, though. Byron and Ada’s mother separated shortly after her birth, and he died when she was just eight years old. Lord Byron was not remembered fondly in the household in which Ada grew up. Her mother painted him as a debauched layabout, and she was not even shown his portrait until her twentieth birthday.

Afraid that Ada shared her father’s red-hot passionate blood, her mother ensured she had a purely rational education. Unusual for a girl in her time, Ada was taught astronomy, physics, and math. Anything but poetry, really. Nonetheless, she was supposed to get married and play the role of aristocratic housewife, as was expected of any woman in British society. And while Ada did get married and raised a family – and became Lady Lovelace in the process – her interest in math was never far away.

During a society dinner in 1833, Lovelace met Babbage, and the two instantly connected. The socially inept professor and the young society lady may not seem like a perfect match, but they both spoke the language of math. Babbage invited her over for a demonstration of his prototype of the Difference Engine, and she was positively mesmerized. Over the years, the two would keep up an intense correspondence, and Lovelace grew to become Babbage’s closest intellectual peer and confidante. In time, Babbage would become so enamored with Lovelace that he admiringly called her ‘the enchantress of numbers’.

Besides her letters to Babbage, Ada Lovelace published only a single text on her work with him. Unlike Babbage, who has left countless documents, letters, and scribbles about the Analytical Engine, Lovelace set out her vision of the machine as supplementary material to an article she translated. This article, written by Italian mathematician Luigi Menabrea, was the first publication that tried to explain this general purpose calculator to a wider audience. Lovelace, knowing everything there was to know about the machine, kept adding so many translator notes, that her seven appendices ended up being three times longer than the original article.

Lovelace’s Notes from the Translator

Lovelace’s notes are very insightful; she explained clearly – albeit in verbose Victorian English – what the machine did, how it worked, and what it could be used for. She didn’t get bogged down in details, like Babbage often did, but instead painted a rather visionary image of this wonderful machine. One might even call it poetic.

Of the seven appendices, there are two that stand out. In the final note, she provides an example of how to write punched card instructions for the machine. She chops up an algorithm into separate logical expressions, and then describes its initial values, variables, and the conditions upon which specific calculations are performed. In other words, she writes code for the Analytical Engine. And even though it was never executed, she is rightfully recognized as the first ever computer programmer.

Impressive as that achievement may be, there is something else in her notes which I think is even more visionary. In the first appendix to the article, she talks about how the Analytical Engine could be applied to tasks other than math. As an example she describes how, if music were expressed numerically, ‘the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent’.

This statement reveals an understanding of the power of computing that went beyond what even Charles Babbage had envisioned. Babbage always talked about his machine in terms of math. In his mind, he had designed a calculator; granted, an extremely advanced calculator, one that worked automatically and could be used for any equation, but still: it was a calculator. Ada Lovelace seems to have realized that the Analytical Engine could perform any task, as long as it could be expressed numerically.

A phrase that is often mentioned regarding modern computers, is that they work with ones and zeros. And at a very low level, that is true. The smallest form in which computers store data is a bit, a value that is either true or false, one or zero, on or off. By itself, a bit has no meaning. Only when it is interpreted within a certain context can it represent meaningful information. Let me explain. Any data on your computer, whether it’s a text document, a picture, or a podcast, is stored as a long sequence of bits. From such a sequence alone, it is impossible to tell what kind of data is stored, let alone its content. The software you use to read that data interprets it as a collection of characters, a rectangle of colored pixels, or thirty minutes of audio. In theory, the same sequence of bits may represent the Bible, the Mona Lisa, and God Save the Queen. All at the same time.

Unlike Charles Babbage, Ada Lovelace appears to have understood this layer of abstraction. Her notes give a brief insight into what she imagined the Analytical Engine to be capable of. And had it been built, the digital age would have begun a hundred years before its time.

Conclusion

It is difficult to assess the impact of these early mechanical calculators. Pascal’s calculator was too expensive to mass-produce, and he shifted his attention to other projects. Charles Babbage grew increasingly erratic near the end of his life, and he and his machines became somewhat of a laughing stock in intellectual circles. Ada Lovelace, as a woman, was never really taken seriously as an intellectual, no matter what she did.

The Pascaline never became a commercial success, and it would be the 1850s before the first mechanical calculator became available on the market. They quickly became widespread, and were in use until the invention of the microchip made electronic pocket calculators possible in the 1980s.

A machine as innovative as the Analytical Engine would not be built until the 1940s. When Howard Aiken proposed his idea for an electromechanical calculator to IBM, however, it was rejected time and again. It was only after he had explicitly referenced Babbage’s work and his working prototypes, that he could convince his superiors of the feasibility of his machine.

The legacy of these early mechanical calculators lives on in computing in other ways, too: the first electronic computers still used punched cards for their input, just like the Jacquard loom had 150 years earlier. Until the 1960s, computers’ memory was referred to as their store, a term coined by Babbage for the Analytical Engine. And these days still, the command found in most programming languages to write output to the screen is print, as if computers still communicate with paper.

If you enjoyed this episode, check out the videos on the website; you can see working prototypes of the Pascaline and the Difference Engine there. For more on Babbage and Lovelace, be sure to check out the graphic novel by Sydney Padua. A link to her book – including its great picture of the Analytical Engine – is on the website: ahistoryof.science.

Thanks for listening. Hopefully until another History of Science.