# Babbage and Lovelace

#### Share

- Details
- Transcript
- Audio
- Downloads
- Extra Reading

The central figure of 19th-century computing was Charles Babbage (1791-1871), who may be said to have pioneered the modern computer age with his 'difference engines' and his 'analytical engine', although his influence on subsequent generations is hard to assess. Ada, Countess of Lovelace (1815-1852), daughter of Lord Byron and a close friend of Babbage, produced a perceptive commentary on the powers and potential of the analytical engine; this was essentially an introduction to what we now call programming.

#### Download Transcript

19 January 2016

Babbage and Lovelace

Professor Raymond Flood

Thank you for coming to my lecture today. I will be speaking about the mathematicians and computer pioneers Charles Babbage and Ada Lovelace.

The central figure of 19th-century computing was Charles Babbage, who may be said to have pioneered the modern computer age with his 'difference engines' which mechanized arithmetic and his 'analytical engine' which created automatic computing. His amazing designs had however limited influence on succeeding generations.

Ada, Countess of Lovelace, daughter of Lord Byron and a close friend of Babbage, produced a perceptive and clear commentary on the powers and potential of the analytical engine; this was essentially an introduction to what we now call programming.

Babbage and Lovelace

Charles Babbage was born on Boxing Day, 1791. His parents were from well-established Devonshire families and his father was a London banker. Charles went to Cambridge in 1810 and graduated in 1814.

While at Cambridge he and other undergraduates formed the Analytical Society which was devoted to the study and promotion of continental mathematics with its more analytical style and its use of the notation created by Leibniz, co-creator of the calculus. At Cambridge the style was still more geometrical and followed the notation of the other creator of the calculus, Isaac Newton. The Society did not long survive its founders having to sit their final examinations but its formation marked a turning point in British mathematical life with a shift to Leibnizian notation and the French approach to the calculus. Three of the founders including Babbage published translations of French calculus textbooks.

But there was an even more important French influence on Babbage's life work and this was to do with the construction of mathematical tables.

At that time there were many types of mathematical tables for many uses: tables of squares and square roots, ready reckoners, logarithmic and trigonometric tables, tables of interest due, astronomical tables, navigational tables, tables giving the tides at different ports and life tables.

De Prony and Page of his Tables

In post-revolutionary France there was a project to prepare a detailed map of the country to help the accurate measurement of property to be used as the basis for property taxation. In connection with this it was necessary to produce a large set of logarithmic and trigonometric tables. At the time this was the largest and most complete mathematical table making project ever undertaken. The project was led by Gaspard de Prony, a French engineer and mathematician. The final manuscript filled 19 volumes, the first 8 containing logarithms of numbers from 1 to 200,000 calculated to 14 decimal places. These ambitious tables were too large and expensive for publication. A much reduced version was eventually published over fifty years after his death and on the slide we see a page giving values of the logarithm of the sine and cosine.

De Prony draws inspiration from Adam Smith

De Prony devised his project explicitly following the principles of the division of labour which had been laid down by Adam Smith in A treatise on the Wealth of Nations of 1776. In this celebrated treatise Smith describes how much more efficient it is if in pin manufacture different workers take on different component tasks rather than each worker do all the tasks necessary to make a complete pin.

As de Prony later recalled,

I came across the chapter where the author treats of the division of work; citing, as an example of the great advantages of this method, the manufacture of pins. I conceived all of a sudden the idea of applying the same method to the immense work with which I had been burdened, and to manufacture logarithms as one manufactures pins. I have reason to believe that I had already been prepared for this conception by certain parts of mathematical analysis, on which I was then lecturing at the Ecole Polytechnique.

Division of labour – De Prony's computation factory

De Prony divided his workers into three teams. The first team contained a few first rate mathematicians who selected the formulae to be used for calculation and for checking, and choosing the number of decimal places in the calculation.

The second team of eight calculators did the calculation for certain pivotal values, calculated the differences and prepared a template to be filled in by the third section that only had to know how to do simple arithmetic. The last section was the largest with between sixty and eighty people called computers (a computer was then the word used for a human who did routine calculations by hand according to a fixed procedure).

Hairdressers

Many of the computers were unemployed hairdressers. Since the French Revolution the work available to hairdressers had decreased dramatically. Indeed the elaborate hairstyles were a hated symbol of the supplanted regime and many hairdressers turned their hand to addition and subtraction. De Prony trained them in elementary arithmetic and set them to work as production line labourers in his table-making factory.

We might say the hairdressers had a brush with mathematics!

But let me go back to Babbage. Babbage realised he could mechanise the activities of the third team. He was going to make the hairdressers redundant for a second time!

The origins of Babbage's idea to build a machine to perform the calculations do not seem to be very clear. In his autobiography written towards the end of his life he says that in 1812 or 1813:

One evening I was sitting in the rooms of the Analytical Society, at Cambridge, my head leaning forward on the table in a kind of dreamy mood, with a table of logarithms laying open before me. Another member, coming into the room, and seeing me half asleep, called out, 'Well Babbage, what are you dreaming about?' to which I replied, 'I am thinking that all these tables (pointing to the logarithms) might be calculated by machinery.

Babbage himself says that he could not subsequently remember the event but that his friend John Herschel told him about it. Herschel was also involved with another famous story about Babbage's motivation. Babbage and Herschel had been asked by the Royal Astronomical Society to produce new mathematical tables. They were checking the results of the calculations in the summer of 1821 and were discovering one error after another when Babbage, becoming increasingly annoyed is reported to have exclaimed;

I wish to God these calculations had been executed by steam!

Above quote and method of differences

To remove errors and obtain reliable mathematical tables Babbage designed and built a small model of what he called a Difference Engine. This machine was highly specialized and designed to calculate tables by the method of differences.

The formula that Babbage used for his early demonstrations of the Difference Engine was x2 + x + 41. When you substitute the numbers x = 0, 1, 2, 3, 4 … the formula takes the values 41, 43, 47, 53, 61 and so on. Note that calculating each value needs you to multiply the value of x by itself and then perform two additions, first adding the value of x and then the number 41. Babbage chose this formula for historical reasons. The mathematician Euler had pointed out that it generates unexpectedly many prime numbers. In fact all values of x from 0 to 39 give a prime result.

x

x2 + x + 41

first

differences

second

differences

0

41

1

43

2

2

47

4

2

3

53

6

2

4

61

8

2

5

71

10

2

6

83

12

2

7

97

14

2

Now let us calculate the differences between successive terms of the formula. These are called the first differences.

Now let us calculate the differences between these differences which are called the second differences.

We see that the second differences are constant. They each have the value 2.

Let us now use this constant second difference to reverse the process.

We start with just this information in the table. We are not going to use the fact that the formula is x2 + x + 41. We are just going to use the facts that the formula has first value 41, first difference 2 and constant second differences all with value 2.

The first difference is added to 41 to get 43. The next first difference is always 2 more than the last first difference so the next first difference is 4. Then the next value is 47. The next first difference is 6 so the next value is 53. And so on.

Because the method of differences only involves addition using a straightforward and repetitive method it is in the long run much faster than the direct method of calculating a large number of values of x2 + x + 41. It also lends itself to mechanization.

Although this is a straightforward example to illustrate the method of differences it shows an approach to evaluation that turns out to be very powerful for a further two reasons.

The first reason is that if we keep taking differences of differences for a polynomial we will eventually come to a constant difference. For example:

•A cubic will have the third differences constant

Below I show the difference table for the cubic x3 + x2 + x + 1 which has a constant third difference of 6.

x

x3 + x2 + x + 1

first

differences

second

differences

third

differences

0

1

1

4

3

2

15

11

8

3

40

25

14

6

4

85

45

20

6

5

156

71

26

6

6

259

103

32

6

7

400

141

38

6

•A quartic will have the fourth differences constant

•A quintic will have the fifth differences constant

•And so on

So the method of differences can be used to calculate the values of any polynomial just using addition. I have been taking values for x that are one unit apart but the result still holds if the values taken for x are the same distance apart e.g. 0.1, 0.2, 0.3, …

The second reason is that polynomials can be used to approximate other functions of interest, for example, the trigonometric functions, the logarithmic function and the exponential function.

The approximation

by the polynomial of degree 7 is very good over the range of the period of the sine function from -p to +p centred on the origin. In fact over the interval form -1 to +1 the error is no more than 0.000003.

If a function is well enough behaved then we can approximate it using polynomials but we might have to use different polynomials for different intervals where it is defined.

A polynomial approximation of a function over an interval can obtained using a result called Taylor's theorem which also gives an expression for the error. That is what I used to get the approximation for sin (x) and an estimate for the error.

Lagrange form of the remainder = for some t between a and a + x

This gives an approximation for a function about the point a.

For the approximation to be good the function needs to be "well behaved".

Babbage wanted to design and make difference engines, machines using the method of differences to evaluate polynomials and as we have seen approximations to a wider class of functions.

By 1822 he had a working model of a difference engine which could evaluate any quadratic to six figures of accuracy. With this machine to show he then went after finance from the Government to build a full sized machine. The Government sought the opinion of the Royal Society and then agreed to fund it, initially with £1500, in the summer of 1823 to begin the work. The Government provided further support at different times but the construction of the Difference Engine is an unhappy story.

Apart from the intrinsic intellectual and mechanical difficulties of the project Babbage had problems with his workmen and with the Government. Babbage hired Joseph Clements, probably the finest mechanic in London at the time to help him with the construction. Clements was a perfectionist, producing exquisite drawings and manufacturing parts to an accuracy beyond what was required. Babbage had some of the same characteristics so progress was slow. They wanted to do it well rather than do it quickly. The Government of course wanted the opposite and became dilatory in providing further funding. Eventually Babbage and Clements fell out and parted company. Clements, as he was apparently entitled to, kept his tools and the drawings. The project had cost the Government £17,500 which is apparently what twenty-two steam locomotives from Robert Stephenson would have cost.

The only parts that were assembled were in 1833 as a demonstration piece for the Government and can be seen on the slide and are now in the Science Museum in London.

In this superb demonstration piece we see at the front vertical columns each of which carry brass wheels each with the digits 0 to 9. Each column is to be thought of as carrying a single number to as many digits as there are wheels on the column. Maybe the bottom wheel on a column carries the units digit of a number, the one above it the tens digit and so on. Other axles behind would perform the adding of the number on one column to the number on an adjacent column, say the one to its left.

A way of using the engine to implement the example I have shown you – it is also on the slide - could be as follows:

The engine is set up with one column holding the constant difference. This column does not change – in our example it keeps the value 2. Other columns might hold numbers obtained from the remaining starting differences and value of the function. In our example they were 2 and 41. The engine operates by repeated addition as we did in the example.

Well, Clements eventually returned the drawings but by that time Babbage was thinking about his Analytical Engine which we will soon come to. It seems that when thinking about the Analytical Engine he had thought of simpler ways to design the mechanisms, especially the carry mechanisms, and he applied that to the design of what is known as Difference Engine No. 2. He may also have wished to deliver his end of the arrangement with the Government. Between 1846 and 1849 Babbage designed Difference Engine No. 2 and for once he left a complete set of drawings.

He never built this Engine but Doron Swade at the Science Museum in London led a team to construct it to mark the bicentennial year of Babbage's birth.

Here is Doran Swade operating Difference Engine Number 2. The engine was built by the Science Museum and the main part was completed in June 1991. It is over two metres high, over 3 metres long and half a metre wide. An important source of errors in the production of mathematical tables occurred when they were being printed.

Babbage's design for Difference Engine No. 2 included automatic printing.

The final Engine including the printing mechanism was completed in 2002. The printer is on the left with some of its output shown below.

The whole machine weighed five tonnes and had 8000 parts. Doron Swade described the operation of the Difference Engine as follows:

The engine is operated by turning the crank handle. The handle drives, via bevel gears, a set of cams arranged in a vertical stack. [A cam converts rotary motion into linear motion and vice versa]

…

The stack of cams control the lifting, turning, and sliding motions required to execute the repeated additions for the method of finite differences. The crank handle also drives the printer and stereotype apparatus from a long shaft that runs the length of the underside of the machine.

…

The engine automatically calculates and tabulates any seventh-order polynomial to 31 decimal places using the method of finite differences, prints the result to 30 places on a paper roll, and impresses the same results on soft material to produce stereotype moulds from which printing plates can be made.

A beautiful machine and as Doron comments:

The successful construction of the machine closes an anguished chapter in computer pre-history: The Science Museum is a government institution funded from the Treasury, and the original deal between the Government and Babbage to fund his machine to completion has finally been fulfilled.

Let me return now to Charles Babbage and his other amazing design, that of the Analytical Engine and also bring in Ada Lovelace.

Doron Swade has written that:

The conception and design of the Analytical Engine ranks as one of the most startling intellectual achievements of the nineteenth century.

One of the problems with the Difference Engines was that the polynomial used to approximate the function would usually only give a good approximation over a limited range of values and when you went outside this range you had to use a different polynomial and this meant resetting the machine by hand. This was prone to error, the very thing the machine was designed to avoid. Babbage realised that the resetting could be avoided if he could feed the output back to the input by arranging the axes of the engine circularly. He referred to this as "the Engine eating its own tail".

As he later wrote:

The circular arrangement of the axes of the Difference Engine round large central wheels led to the most extended prospects. The whole of arithmetic now appeared within the grasp of mechanism. A vague glimpse even of an Analytical Engine at length opened out, I pursued with enthusiasm the shadowy vision.

He now developed mechanisms for multiplication and division using for control of these operations drums similar in nature to those used in a music box or barrel organ.

The next major development was to separate the machine into two parts. One, which he called the store, held the numbers. Numbers in the store were transferred to the other section, called the mill, where they were processed i.e. the arithmetical operations were performed. Then the results were returned to the store where they could be printed or used as input for further calculation.

To control the order in which operations were performed he needed a control mechanism and he chose punched cards similar to those used in a Jacquard loom to automatically control the pattern of a weave.

The portrait of Jacquard on the left seated at a table with a model of his loom was woven in silk on a Jacquard loom and required 24,000 punched cards to create. Each card had over 1000 hole positions. On the right is an Austrian Jacquard handloom from the end of 19th century. Babbage owned one of these portraits and used it to help in explanations of his Analytical Engine.

The analytical engine was never built but we can obtain an idea of what it might have looked like from this lovely book, The Thrilling Adventures of Lovelace and Babbage, by Sydney Padua.

The book is the winner of the 2015 British Society for the History of Mathematics Neumann Prize and was published last year. In it Padua has a visualization of the Analytical Engine constructed from Babbage's plans, with the help of papers of the Babbage scholar, Allan Bromley.

This coloured version appeared in the Observer last year. We see Babbage and Lovelace and a labelling of the parts of the Analytical Engine with their modern computing equivalent terms.

1.The Store (hard disk or memory) 2.The Mill (Central Processing Unit) 3.Steam Engine (power) 4.Printer (printer, around the other side) 5.Operation Cards (the program) 6.Variable Cards (addressing system) 7.Number Cards (for entering numbers) 8.The Barrel Controllers (microprograms)The correspondence with modern general purpose computing architecture is amazing and it is due to Ada Lovelace that we know most about the Analytical Engine.

Ada was the daughter of the poet Lord Byron and his wife Annabella. They married in January 1815 and Ada was born in December that year. The marriage was not a happy one, to put it mildly, and they separated a month after Ada's birth. Lord Byron was described by one of his mistresses as "mad, bad and dangerous to know". He died when Ada was eight years old and apparently father and daughter never met.

Last year, 2015, was the bicentenary of Ada's birth and there were many events – newspaper articles, books, conferences, lectures, and radio and television programmes – to mark the anniversary. Gresham College had a lecture on her last October by Professor Ursula Martin of Oxford University and that is available on the Gresham College website and I've put the URL in the handout.

http://www.gresham.ac.uk/professors-and-speakers/professor-ursula-martin

In 1835, aged 19, she married William King, Earl of Ockham, later Lord Lovelace. They had three children and she died at the age of 36 in 1852.

From a young age Ada showed an enthusiasm for and ability in mathematics. Her mother, a noted educational reformer, took her on factory visits and organised a number of private tutors. Ada and her mother regularly attended Babbage's soirées where he would demonstrate models of his difference engine. After the birth of her children she returned to studying mathematics through correspondence with Augustus De Morgan, one of England's most distinguished mathematicians and Professor at University College London.

The Clay Mathematics Institute is going to enable this correspondence to be put online. As it says on its website:

The Bodleian Library at Oxford holds on deposit a remarkable archive of papers of Lord Byron and his daughter, Ada Lovelace, who is celebrated for her pioneering work on programming Charles Babbage's Analytical Engine. To mark her 200th birthday on 10 December 2015, the Clay Mathematics Institute is undertaking a project to digitise her mathematical papers in the archive, which includes both sides of her extensive correspondence with Augustus de Morgan as well as other material that gives a fascinating insight into her journey into mathematics.

High resolution images will be available through the Library. In the new year, access to quality images will be made freely available on CMI's website. CMI is very grateful to Ada's descendant, the Earl of Lytton, for his family's permission to undertake this project.

The study of this correspondence is being undertaken by Christopher Hollings, Ursula Martin and Adrian Rice and will be a fascinating resource to be available online at:

http://www.claymath.org/events/news/ada-lovelace-archive

Babbage went to Turin in Italy in 1840 to lecture on the Analytical Engine and his seminars led to a report by Luigi Menabrea.

Menabrea was a young engineer at the time of Babbage's visit. He became a general in the Italian army and eventually became Prime Minister of the newly united Italy in 1867. His report was in French and Ada Lovelace translated it into English.

But she did not just translate it she added seven appendices nearly tripling its length and produced a perceptive and clear commentary on the powers and potential of the Analytical Engine. It is on this translation and commentary that her scientific reputation rests.

Babbage and Lovelace were in correspondence over the paper that appeared in Taylors Scientific Memoirs in 1843.

There is a striking feature of the paper. It takes and particularly in Lovelace's appendices a high level logical view of the Analytical engine essentially describing it as an abstract machine. As she says in her first appendix:

In studying the action of the Analytical Engine, we find that the peculiar and independent nature of the considerations which in all mathematical analysis belong to operations, as distinguished from the objects operated upon and from the results of the operations performed upon those objects, is very strikingly defined and separated.

She is saying that "the Analytical Engine is an embodying of the science of operations".

She gives an example of this to music saying that if the fundamental relations of pitched sounds in the science of harmony and of musical composition could be represented mathematically then "the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent".

She then identifies a core distinction between the Analytical and Difference Engine.

The distinctive characteristic of the Analytical Engine … is the introduction into it of the principle which Jacquard devised for regulating, by means of punched cards, the most complicated patterns in the fabrication of brocaded stuffs. It is in this that the distinction between the two engines lies. Nothing of the sort exists in the Difference Engine. We may say most aptly that the Analytical Engine weaves algebraical patterns just as the Jacquard loom weaves flowers and leaves.

In her fourth appendix she presents a table showing how to solve two linear simultaneous equations in two unknowns.

The equations are at the top of the slide and are written

The solutions then are – note the denominators for x and y are the same:

In the table the first column holds the number of the operation to be performed and the second its nature, add, subtract, multiply or divide. The next six columns hold the variables for the data, m, n, d, .

The middle columns (called working variables) hold the results of intermediate steps such as the products , , and so on and then the differences of some of these products.

Finally in the results columns we have the quotients of the appropriate differences of products. This gives the solution.

She is using this example just to introduce her table notation and warm up the reader because she has not yet used iteration or looping. She does that in her final example in the last appendix, the calculation of the Bernoulli numbers.

In the entire history of science and mathematics it is hard to find a more prominent family than the Bernoullis. Eight members of the family devoted themselves to the mathematical sciences. Here is part of the Bernoulli family tree with the eight mathematical scientists in bold type. All but one of them were born in Basel, Switzerland. Basel was also a centre for their mathematical life. For over a century from 1687 to 1790 the mathematics chair there was held by members of the family. The first distinguished member of the family was Jacob Bernoulli. He investigated infinite series, the cycloid, transcendental curves, the logarithmic spiral and the catenary, and introduced the term integral. His posthumous text on probability contained the celebrated law of large numbers as well as what are now known as the Bernoulli numbers.

•Jacob Bernoulli first discovered them when he was investigating the sum of powers of the first n natural numbers which for any positive integer, c, is

1c + 2c + 3c + … + nc

e.g. 15 + 25 + 35 + … + n5

•They arise frequently in number theory and analysis

•Lovelace used an iterative approach to calculating them. She first arranged to calculate the first Bernoulli number then the next and then used the first two to get the third and then these three to get the fourth and so on up to the seventh.

This is the table showing the working of the machine through the computation of the Bernoulli numbers. We can see the headings of the columns which are similar to the simultaneous equations example.

But I want to point out the line towards the bottom which says:

Here follows a repetition of Operations thirteen to twenty-three

So she is introducing a loop.

She remarks that the table "presents a complete simultaneous view of all the successive changes which these columns then severally pass through in order to perform the computation".

This is often described as the first computer programme and I can see the justification for that.

In the paper Lovelace also addresses topics such as verification, optimization and complexity which are still very much of concern to computer scientists.

It is an exceptional piece of work by a remarkable person.

In the remaining decade of her life she continued to follow her mathematical and other interests, including applications to agriculture and crop growing as well as wondering if there could be mathematical laws for the operation of the brain, a kind of "calculus of the nervous system".

Let me finish with an assessment of the influence of the work of Babbage and Lovelace. Almost all histories of computing mention them but their work appears to have had little influence on subsequent generations and indeed many of those working on computers in the 1930s and 1940s don't seem to have known of them. In the near 100 years from their time there were developed many types of computational machines each responding to a particular specific need. It was only in the 1940s that general purpose computers were developed by mathematicians such as John von Neumann and Alan Turing. They had very different underlying technology but it is amazing that their logical architecture and programming was similar to the Analytical Engine as created by Charles Babbage and Ada Lovelace.

Thank you.

My next lecture is on the mathematicians Carl Friedrich Gauss and Sophie Germain on Tuesday 16 February.

© Professor Raymond Flood, 2016

#### This event was on Tue, 19 Jan 2016

## Professor Raymond Flood

### Professor of Geometry

Raymond Flood has spent most of his academic life promoting mathematics and computing to adult audiences, mainly through his position as University Lecturer at Oxford University, in the Continuing Education Department and at Kellogg College.

Find out more## Support Gresham

Gresham College has offered an outstanding education to the public free of charge for over 400 years. Today, Gresham plays an important role in fostering a love of learning and a greater understanding of ourselves and the world around us. Your donation will help to widen our reach and to broaden our audience, allowing more people to benefit from a high-quality education from some of the brightest minds.