From the Abacus to Wintermute

Fragments from a History of Computing


Mr. Babbage's Difference Engine No. I

Sir David Brewster: Letters On Natural Magic London, 1868

"Great as the power of mechanism is known to be, yet we venture to say that many of the most intelligent of our readers will scarcely admit it to be possible that astronomical and navigation tables can be accurately computed by machinery; that the machine can itself correct the errors which it may commit; and that the results of its calculations, when absolutely free from error, can be printed off, without the aid of human hands, or the operation of human intelligence. All this however, Mr. Babbage's machine can do..." [Brewster, p341]

"Impression from a woodcut of a small portion of Mr. Babbage's Difference Engine No.1, the property of Government, at present deposited in the Museum at South Kensington.

It was commenced 1823.
This portion put together 1833.
The construction abandoned 1842.
This plate was printed June, 1853.
This portion was in the Exhibition 1862."

[frontispiece from
Passages from the Life of a Philosopher ]

Charles Babbage, Esq.: Passages of the Life of a Philosopher, London, 1864

"I considered that a machine to execute the mere isolated operations of arithmetic, would be comparatively of little value, unless it were very easily set to do its work, and unless it executed not only accurately, but with great rapidity, whatever it was required to do."

"On the other hand, the method of differences supplied a general principle by which all Tables might be computed through limited intervals, by one uniform process. Again, the method of differences required the use of mechanism for Addition only. In order, however, to insure accuracy in the printed tables, it was necessary that the machine which computed Tables should also set them up in type, or else supply a mould in which stereotype plates of those Tables could be cast." [Passages... p42-3 referring to his reccollections of 1819]

The calculating machine should engage in two processes: that of addition and that of carrying the tens value to the next digit. Adding each of the values sequentially would be too slow a process for large numbers. A quicker approach would be (an early kind of parallel process) "to add all the digits of the two numbers each to each at the same instant, but reserving a certain mechanical memorandum, wherever a carriage became due. These carriages were then to be executed successively."

In order to minimise the errors caused by the clerical process of recording the numbers of any table and making up type to print those tables the printing part of the engine should be directly driven from the results of the calculating engine.

On error checking and the reason for using the Method of Differences:


The first "small portion" of
Difference Engine No.1 (as in the frontispiece above).
Still in the Science Museum, South Kensington.

In the approach to computation which involved calculating the value of each term directly an unpredictable array of errors may be generated through various means, perhaps incorrect calculation, the choosing of a wrong number, or some error in setting up the type for printing the tables. Finding these errors is a matter of checking every result again by making the same calculation, whch is further prone to error. In the method of differences, [a fixed algorithm is used at each stage and thus] if the last tabular number agrees with a directly calculated version then the table may be safely believed to be correct. Error detection is thus reduced to a single calculation, rather than the reproduction of the hundreds of calculations necessary for any practical table.

On the Method of Differences:

The first point to recognise is that the function of this algorithm is to produce Tables of numbers generated in series, starting with some arbitrarily low number, say 0, and from thence incrementing the table number. At each row (count) of the table the result of the performance of whatever function the table exemplifies should be available. Thus in a table of logarithms, the first row of the table will provide the logarithm of the first value to be expressed: either '0' which has no logarithm or '1' which has a logarithm of '0'. The rows of the table then incrementing as far as is considered necessary by its producer.

The Method of Differences then proceeds as follows, (using as an example the table of squares):

Referring to the table at right:

For each row nof the table, the number f(n)appropriate to that row, according to the series being developed, is inserted into the tabular value column f(n),
in this example
"f(n) = n^2".

Then the difference between that number and its succeeding is inserted into the column of 1st Differences D1, proceeding row by row.

This column having been completed the next column, the column of 2nd Differences D2, is similarly generated from the column of 1st Differences, and so on for each succeeding column until a column with constant difference is generated (in the example here this is D2 the column of 2nd Differences).

The next step is to add to the tabular value of any particular row n the values in D1 and D2 and any further columns of Differences in that row, thus yielding the next tabular value f(n+1).

n f(n)
f(n) = n^2
D1 D2 f(n+1) =
D1(
n) + D2(n) + f(n)
1 1 1 2 2+1+1=4
2 4 3 2 2+3+4=9
3 9 5 2 2+5+9=16
4 16 7 2 2+7+16=25
5 25 9 2 2+9+25=36
6 36 11 2 2+11+36=49
7 49 13 2 2+13+49=64
8 64 15    

Where column

  • "n" = row number
  • "f(n) = n^2" = value in table at that row number
  • "D1" = 1st Difference between numbers at row n and row n+1, placed in row n+1
  • "D2" = 2nd Difference between number in D1 at row n and row n+1, placed in row n+1
  • final column shows the additions

The task of the programmer is to generate the sets of differences which form the rules for each function f that one might wish to execute as a Table.

On the mechanical process of Addition

Babbage:
"The process of Addition includes two distinct parts - 1st. The first consists of the addition of any one digit to another digit; 2nd. The second consists in carrying the tens to the next digit above." [Babbage, p58]

So, two numbers may be added together by taking the first digit of the first number and adding it to the first digit of the second number. If this sum is greater than 9, then a ten value must carry forth to the addition of the second pair of digits. If the sum of the second pair plus the carry also exceeds ten then a further carry is issued to the third (the hundreds) pair of digits. And so forth until all digits in each number are accounted for.


Detail of the digit wheels of
Difference Engine No.1

"The mechanical means I employed to make these carriages bears some slight analogy to the operation of the faculty of memory. A toothed wheel had the ten digits marked upon its edge; between the nine and the zero a projecting tooth was placed. Whenever any wheel, in receiving addition, passed from nine to zero, the projecting tooth pushed over a certain lever. Thus ... every carriage which had become due was indicated by the altered position of its lever. An arm now went round, which was so contrived that the act of replacing that lever caused the carriage which its position indicated to be made to the next figure above. But this figure might be a nine, in which case, in passing to zero, it would put over its lever, and so on. By placing the arms spirally around an axis, these successive carriages were accomplished." [Babbage, p62]


Detail of the addition wheels from the frontispiece above.

Babbage's engine used a wide word of decimal values, ie. decimal numbers of a largeish number of digits. Each digit is represented on a wheel so that by rotation the wheel may be stepped from zero to nine. Stacks of these wheels are placed on an "axis", one above the other. Each axis then represents a column in the table of differences. The values of the 2nd Difference are placed on the first axis, the values of the 1st Difference are placed on the next axis and the current tabular value is on the third axis.

In Babbage's "small portion" of the engine (in the frontispiece and photos above) there are three axis stacks. In the operation of the engine, the 2nd Difference axis is added into the 1st Difference axis, which may or may not then generate a carry. The value now on the 1st Difference axis plus the carry, if any, is then added into the tabular value (or result) axis. Thus each digit is acted upon in the same addition cycle.

Explicitly:

Using the table of squares above, the value 2 is placed on the D2 axis, the value 1 is placed on the D1 axis and the value 1 is placed on the results, f(n), axis. As the D2 axis is rotated the digit wheels then rotate the adjacent digit wheels of axis D1. Since the D1 axis already has a number on it, the D2 axis rotating in the appropriate direction will rotate the D1 digit wheel for the number of counts (steps) necessary to bring the value on the D2 digit wheel to zero, thus adding 2 to the number on the D1 wheel.

With the value 2 on D2 and the value 1 on D1, there will be no carry, as the D1 digit wheel has not rotated from 9 to zero. The value now on the D1 digit wheel will be rotated similarly, adding its value to the number on the results axis. There being no carry due the first result is 4 which is then sent to the printing (output) mechanism.

To produce the second result, the values of the D2 and D1 wheels are set to the difference values in row n = 2, so D2 is set to 2 again, and D1 becomes 3, Performing the same rotation (addition) sequence again yields a 5 on the D1 axis and a 9 on the result axis. No carries became due.

On the third sequence, D2 = 2 and D1 = 5. After the first rotation (addition) D1 becomes 7. When this is added to the value of 9 in the results axis, the results axis passes through zero, thus raising a carry, and counts on to 6. Now that there is a carry due, the carry processing arm swings around and adds a 1 onto the next higher order digit of the results axis, in this case the tens digit. This process continues for as long as is required for production of the target table.

a fragment of the Difference Engine No.1 now in the History of Science Museum, Broad Street, Oxford donated, along with several manuscripts relating to Charles Babbage in 1939 by the estate of Dr L. H. Dudley Buxton.
Difference Engine No.1 fragment in the PowerHouse Museum, Sydney

Assembled from the original parts of the Difference Engine No.I manufactured by Babbage and his engineer, Joseph Clement, around 1830. All the parts were inherited by Charles' son Henry Prevost Babbage, who assembled about six fragments around 1879.

Pieces were deposited at University College, London, the Whipple Museum in Cambridge, U.K. and Harvard University, Cambridge, USA. This piece in the PowerHouse Museum, Sydney was purchased from Charles Whitmore Babbage of New Zealand, who would have received it from Henry P.


References:

Babbage, Charles, Passages of the Life of a Philosopher. Longman, et alia, London, 1864.

Brewster, Sir David, Letters on Natural Magic. William Tegg, London, 1868.

Bromley, Alan G., "Difference and Analytical Engines" in Asprey, W. (ed) Computing Before Computers, Iowa State University Press, Ames, Iowa, 1990.

Swade, Doron, Charles Babbage and his Calculating Engines. Science Museum, London, 1991.

all photos by Stephen Jones

Text and images Copyright: Stephen Jones, 1997.



return to Top Index