# Constructing Difference Engines

When I was in college, several decades ago, I relied heavily on a computational device called a slide rule and on a little, paperbound handbook of mathematical and scientific tables. I occasionally enjoyed simply browsing the handbook’s many tables, formulas, and other data. The table of random digits, by itself, presented intriguing mysteries.

I also wondered at times about the sources of all this information. Mathematicians and many others have relied on tables of logarithms, trigonometric functions, and other mathematical formulas for a very long time. Carl Friedrich Gauss (1777–1855), for one, pondered such tables in formulating ideas about the distribution of prime numbers (see Gauss’ Prime Tables at http://blog.sciencenews.org/2006/03/gauss_prime_tables_1.html).

Computing mathematical tables itself has a long history, often tied closely to astronomical and navigational requirements. In the 18th and 19th centuries, in particular, there arose a great need for large tables of numerical values of a wide variety of mathematical functions.

Newton’s method of differences is the basis of one technique for computing values of polynomial functions. Consider, for example, the quadratic polynomial p(x) = x2 – 4x + 3. Suppose that you want to compute the values of p(x) when x = 0, 0.1, 0.2, 0.3, 0.4, and so on.

In the table below, the first column contains the value of the polynomial, the second column contains the differences of two neighbors in the first column, and the third column contains the differences of two neighbors in the second column.

 p(0) = 3 3 – 2.61 = 0.39 p(0.1) = 2.61 0.39 – 0.37 =0.02 2.61 – 2.24 =0.37 p(0.2) = 2.24 0.37 – 0.35 =0.02 2.24 – 1.89 =0.35 p(0.3) = 1.89 0.35 – 0.33 =0.02 1.89 – 1.56 =0.33 p(0.4) = 1.56

Note that the values in the third column are constant. In general, if you start with any polynomial of degree n, the number in column n + 1 will always be constant.

With such a start, you can readily compute p(0.5). Starting from the right with the value 0.02, you subtract it from the value in the second column, 0.33 – 0.02, to get 0.31. Subtracting this result from the value for p(0.4), 1.56 – 0.31, gives the value p(0.5) = 1.25.

So, it’s possible to generate successive values of a polynomial without having to multiply.

This process can be automated in a mechanical device. In the 18th century, J.H. Mueller designed such a mechanism—a difference machine—but it was never built. Charles Babbage (1791–1871) revived the idea in 1821 when he proposed a design for a decimal-based difference engine operated by a hand crank. He designed a second, improved version between 1847 and 1849. However, Babbage made little progress in building either machine.

In 1985, the Science Museum in London launched a project to build a complete, working version of Babbage’s second difference engine. This model was completed and working in November 1991, 1 month before the anniversary of Babbage’s birth. See http://www.sciencemuseum.org.uk/on-line/babbage/index.asp.

Babbage’s second difference engine could hold seven numbers of 31 decimal digits each, allowing it to tabulate seventh-degree polynomials to high precision.

The challenge of reconstructing Babbage’s difference engines has also attracted others. In 2003, Tim Robinson constructed small-scale, working models of both of Babbage’s difference engines entirely from standard Meccano parts (see http://www.meccano.us/difference_engines/).

Andrew Carol, a software developer for Apple, recently built a working difference engine out of Lego pieces (see http://acarol.woz.org/LegoDifferenceEngine.html).

Although none of these models matches the complexity and intricacy of Babbage’s original designs, they are still mechanical calculators that do the same job that Babbage’s machines were supposed to do. They’re remarkable tributes to mechanical ingenuity—and patience.

Check out Ivars Peterson’s MathTrek blog at http://blog.sciencenews.org/.