Posted in *computing* errors, Uncategorized

A fronte praecipitium a tergo lupi , Piece I: Charles Babbage


” A Precipice in front, wolves behind.”



Babbage showed an enthusiasm for mathematics since an early age. Because of his ill health, he changed schools and even home fairly often when he was a young child. In the periods when he did not attend any school, Charles studied mathematics at home on his own. He entered the University of Cambridge in 1810, when he was 19, but was not happy with the amount of mathematics that he studied there – in fact he complained that he knew mathematics of much higher degree by that time, having studied on his own, the original works of such mathematicians as Newton, Leibniz, Lagrange and Euler.

As early as 1822, Babbage was writing on the possibility of inventing a machine which could be able to do more tedious calculations instead of people. He was by that time inventing machinery which was doing computation of astronomical and mathematical tables. For example, his machine from 1822 was capable of producing the terms of the sequence such as

at a rate of 60 terms every 5 minutes.

Babbage’s life was not easy. He suffered great many personal tragedies, which slowed his scientific progress. His wife and two children died in 1827.

However, he continued working on his difference engine for the rest of his life and received great amounts of help and money from the government. Although Babbage never completed his calculating engine, his drawings and designs (both mathematical and mechanical) helped in the later development of the computer.

It is therefore not unreasonable to suppose that some portion of the neglect of science in England, may be attributed to the system of education we pursue.

The Engines

Charles Babbage (1791-1871), computer pioneer, designed two classes of engine, Difference Engines, and Analytical Engines. Difference engines are so called because of the mathematical principle on which they are based, namely, the method of finite differences. The beauty of the method is that it uses only arithmetical addition and removes the need for multiplication and division which are more difficult to implement mechanically.

Difference engines are strictly calculators. They crunch numbers the only way they know how – by repeated addition according to the method of finite differences. They cannot be used for general arithmetical calculation. The Analytical Engine is much more than a calculator and marks the progression from the mechanized arithmetic of calculation to fully-fledged general-purpose computation. There were at least three designs at different stages of the evolution of his ideas. So it is strictly correct to refer to the Analytical Engines in the plural.

Binary, Decimal and Error Detection

Babbage’s calculating engines are decimal digital machines. They are decimal in that they use the familiar ten numbers ‘0’ to ‘9’ and they are digital in the sense that only whole numbers are recognized as valid. Number values are represented by gear wheels and each digit of a number has its own wheel. If a wheel comes to rest in a position intermediate between whole number values, the value is regarded as indeterminate and the engine is designed to jam to indicate that the integrity of the calculation has been compromised. Jamming is a form of error-detection.

Babbage considered using number systems other than decimal including binary as well as number bases 3, 4, 5, 12, 16 and 100. He settled for decimal out of engineering efficiency – to reduce the number of moving parts – as well as for their everyday familiarity.

Difference Engine No. 1

Babbage began in 1821 with Difference Engine No. 1, designed to calculate and tabulate polynomial functions. The design describes a machine to calculate a series of values and print results automatically in a table. Integral to the concept of the design is a printing apparatus mechanically coupled to the calculating section and integral to it. Difference Engine No. 1 is the first complete design for an automatic calculating engine.

From time to time Babbage changed the capacity of the Engine. The 1830 design shows a machine calculating with sixteen digits and six orders of difference. The Engine called for some 25,000 parts shared equally between the calculating section and the printer. Had it been built it would have weighed an estimated fifteen tons and stood about eight feet high. Work was halted on the construction of the Engine in 1832 following a dispute with the engineer, Joseph Clement. Government funding was finally axed in 1842.

The Analytical Engine

With the construction project stalled, and freed from the nuts and bolts of detailed construction, Babbage conceived, in 1834, a more ambitious machine, later called Analytical Engine, a general-purpose programmable computing engine.

The Analytical Engine has many essential features found in the modern digital computer. It was programmable using punched cards, an idea borrowed from the Jacquard loom used for weaving complex patterns in textiles. The Engine had a ‘Store’ where numbers and intermediate results could be held, and a separate ‘Mill’ where the arithmetic processing was performed. It had an internal repertoire of the four arithmetical functions and could perform direct multiplication and division. It was also capable of functions for which we have modern names: conditional branching, looping (iteration), microprogramming, parallel processing, iteration, latching, polling, and pulse-shaping, amongst others, though Babbage nowhere used these terms. It had a variety of outputs including hardcopy printout, punched cards, graph plotting and the automatic production of stereotypes – trays of soft material into which results were impressed that could be used as molds for making printing plates.

The logical structure of the Analytical Engine was essentially the same as that which has dominated computer design in the electronic era – the separation of the memory (the ‘Store’) from the central processor (the ‘Mill’), serial operation using a ‘fetch-execute cycle’, and facilities for inputting and outputting data and instructions. Calling Babbage ‘the first computer pioneer’ is not a casual tribute.

A New Difference Engine

With the groundbreaking work on the Analytical Engine largely complete by 1840, Babbage began to consider a new difference engine. Between 1847 and 1849 he completed the design of Difference Engine No. 2, an improved version of the original. This Engine calculates with numbers thirty-one digits long and can tabulate any polynomial up to the seventh order. The design was elegantly simple and required only approximately a third of the parts called for in Difference Engine No. 1, while providing similar computing power.

Difference Engine No. 2 and the Analytical Engine share the same design for the printer – an output device with remarkable features. It not only produces hardcopy inked printout on paper as a checking copy, but also automatically stereotypes results, that is, impresses the results on soft material, Plaster of Paris for example, which could be used as a mold from which a printing plate could be made. The apparatus typesets results automatically and allows programmable formatting i.e. allows the operator to preset the layout of results on the page. User-alterable features include variable line height, variable numbers of columns, variable column margins, automatic line wrapping or column wrapping, and leaving blank lines every several lines for ease of reading.

Physical Legacy

Aside from a few partially complete mechanical assemblies and test models of small working sections, none of Babbage’s designs was physically realized in its entirety in his lifetime. The major assembly he did complete was one-seventh of Difference Engine No. 1, a demonstration piece consisting of about 2,000 parts assembled in 1832. This works impeccably to this day and is the first successful automatic calculating device to embody mathematical rule in mechanism. A small experimental piece of the Analytical Engine was under construction at the time of Babbage’s death in 1871. Many of the small experimental assemblies survived, as does a comprehensive archive of his drawings and notebooks.

Difference Engines and how they work

Diagram showing method of differences

Principle of the Difference Engines

Difference engines are so called because of the mathematical principle on which they are based, namely, the method of finite differences. In general, calculating the value of a polynomial can require any or all of addition, subtraction, multiplication and division.

An advantage of the method of finite differences is that it eliminates the need for multiplication and division, and allows the values of a polynomial to be calculated using simple addition only. Adding two numbers using gearwheels is easier to implement than multiplication or division and so the method simplifies an otherwise complex mechanism.

If the first few values of a polynomial are known, the rest may be calculated using simple repeated addition. The method is illustrated in the diagram above for the function F(x) = x2 + 4. The values of x are shown in the first column incrementing by 1 each time (x = 1, 2, 3, 4 . . .). The values of the function x2 + 4 are shown in the second column with the first four values calculated by mental arithmetic or by hand (5, 8, 13, 20).

The next step is to calculate the first and second differences. The first differences are shown in the third column and are calculated by subtracting successive values from the previous column as shown by the solid arrows flowing from left to right (8-5=3, 13-8=5 etc.). The second differences are calculated by subtracting first difference pairs and these are shown in the last column.

With these initial values calculated the rest of the values of the function can be calculated by reversing the process. The values we wish to calculate are shown below the upper dotted line. For this polynomial, the second difference is a constant (2). To calculate the value of the function for x=5 the constant difference (2) is added to the first difference (7) to obtain the next first difference (9) (red arrow), which can then be added to the last function value (blue arrow) to yield F(5) = 29. This is the desired result, achieved without performing multiplication.

The process can then be repeated to yield the next first difference (11) which may be added to the last function value to get F(6) = 40, etc. Using this method, any second-degree polynomial can be computed this way and, more generally any nth degree polynomial can be computed, using only addition, starting with the nth difference.

Babbage’s Difference Engine No. 2 has ‘registers’ to hold one number from each of the columns in the table (for example 20, 7, 2). It would add the second difference to the first, then add that result to the function value to compute the next entry in the table. There were enough ‘registers’ for seven differences, allowing it to compute 31-digit values for polynomials with terms up to x7.


that nothing is credible which is contradictory to experience, or at variance with the laws of nature,”