---
title: Difference engine
slug: difference-engine
qid: 
snapshot: enwiki-001378320435
content_hash: 
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1378320435
tags: [107141658, 20175386, 2050623, 23004968, 23118434, 23603337, 24043274, 24549072, 24623845, 28269686, 29264781, 29265278, 34851913, 37885175, 49773490, 63697623, 7692542, 7765068, 78238099, 99437042]
---

# Difference engine

> [!note] Provenance
> Snapshot `enwiki-001378320435` · content root `…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1378320435> · Licensed CC BY-SA 4.0

's difference engine, the first one built from Babbage's design. It has the same precision on all columns, except in calculating polynomials, the precision on the higher-order columns could be lower. A difference engine is an automatic mechanical calculator designed to tabulate polynomial functions. It was designed in the 1820s, and was created by Charles Babbage. The name difference engine is derived from the method of finite differences, a way to interpolate or tabulate functions by using a small set of polynomial co-efficients. Some of the most common mathematical functions used in engineering, science and navigation are built from logarithmic and trigonometric functions, which can be approximated by polynomials, so a difference engine can compute many useful tables.

's difference engine, the first one built from Babbage's design. It has the same precision on all columns, except in calculating polynomials, the precision on the higher-order columns could be lower. A difference engine is an automatic mechanical calculator designed to tabulate polynomial functions. It was designed in the 1820s, and was created by Charles Babbage. The name difference engine is derived from the method of finite differences, a way to interpolate or tabulate functions by using a small set of polynomial co-efficients. Some of the most common mathematical functions used in engineering, science and navigation are built from logarithmic and trigonometric functions, which can be approximated by polynomials, so a difference engine can compute many useful tables. ===Charles Babbage's difference engines=== Charles Babbage began to construct a small difference engine in and had completed it by 1822 (Difference Engine 0). He announced his invention on 14 June 1822, in a paper to the Royal Astronomical Society, entitled "Note on the application of machinery to the computation of astronomical and mathematical tables". This machine used the decimal number system and was powered by cranking a handle. The British government was interested, since producing tables was time-consuming and expensive and they hoped the difference engine would make the task more economical. In 1823, the British government gave Babbage £1700 to start work on the project. Although Babbage's design was feasible, the metalworking techniques of the era could not economically make parts in the precision and quantity required. Thus the implementation proved to be much more expensive and doubtful of success than the government's initial estimate. According to the 1830 design for Difference Engine No. 1, it would have about 25,000 parts, weigh 4 tons, and operate on 20-digit numbers by sixth-order differences. In 1832, Babbage and Joseph Clement produced a small working model (one-seventh of the plan), which operated on 6-digit numbers by second-order differences. Lady Byron described seeing the working prototype in 1833: "We both went to see the thinking machine (or so it seems) last Monday. It raised several Nos. to the 2nd and 3rd powers, and extracted the root of a Quadratic equation." Lady Byron's daughter Ada Lovelace would later become fascinated with and work on creating the first computer program intended to solve Bernoulli's equation utilizing the difference engine. Work on the larger engine was suspended in 1833. By the time the government abandoned the project in 1842, Babbage had received and spent over £17,000 on development, which still fell short of achieving a working engine. The government valued only the machine's output (economically produced tables), not the development (at unpredictable cost) of the machine itself. Babbage refused to recognize that predicament. Meanwhile, Babbage's attention had moved on to developing an analytical engine, further undermining the government's confidence in the eventual success of the difference engine. By improving the concept as an analytical engine, Babbage had made the difference engine concept obsolete, and the project to implement it an utter failure in the view of the government. The incomplete Difference Engine No. 1 was put on display to the public at the 1862 International Exhibition in South Kensington, London. Babbage went on to design his much more general analytical engine, but later designed an improved "Difference Engine No. 2" design (31-digit numbers and seventh-order differences), between 1846 and 1849. Babbage was able to take advantage of ideas developed for the analytical engine to make the new difference engine calculate more quickly while using fewer parts. ===Construction of two working No. 2 difference engines=== During the 1980s, Allan G. Bromley, an associate professor at the University of Sydney, Australia, studied Babbage's original drawings for the Difference and Analytical Engines at the Science Museum library in London. This work led the Science Museum to construct a working calculating section of difference engine No. 2 from 1985 to 1991, under Doron Swade, the then Curator of Computing. This was to celebrate the 200th anniversary of Babbage's birth in 1991. In 2002, the printer which Babbage originally designed for the difference engine was also completed. The conversion of the original design drawings into drawings suitable for engineering manufacturers' use revealed some minor errors in Babbage's design (possibly introduced as a protection in case the plans were stolen), which had to be corrected. The difference engine and printer were constructed to tolerances achievable with 19th-century technology, resolving a long-standing debate as to whether Babbage's design could have worked using Georgian-era engineering methods. The machine contains 8,000 parts and weighs about 5 tons. The printer's primary purpose is to produce stereotype plates for use in printing presses, which it does by pressing type into soft plaster to create a flong. Babbage intended that the Engine's results be conveyed directly to mass printing, having recognized that many errors in previous tables were not the result of human calculating mistakes but from slips in the manual typesetting process. The printer's paper output is mainly a means of checking the engine's performance. In addition to funding the construction of the output mechanism for the Science Museum's difference engine, Nathan Myhrvold commissioned the construction of a second complete Difference Engine No. 2, which was on exhibit at the Computer History Museum in Mountain View, California, from May 2008 to January 2016. It has since been transferred to Intellectual Ventures in Seattle where it is on display just outside the main lobby. p(x) = 2x^2 - 3x + 2 \, with the goal of tabulating the values p(0), p(1), p(2), p(3), p(4), and so forth. The table below is constructed as follows: the second column contains the values of the polynomial, the third column contains the differences of the two left neighbors in the second column, and the fourth column contains the differences of the two neighbors in the third column: The numbers in the third values-column are constant. In fact, by starting with any polynomial of degree n, the column number n&nbsp;+&nbsp;1 will always be constant. This is the crucial fact behind the success of the method. This table was built from left to right, but it is possible to continue building it from right to left down a diagonal in order to compute more values. To calculate p(5) use the values from the lowest diagonal. Start with the fourth column constant value of 4 and copy it down the column. Then continue the third column by adding 4 to 11 to get 15. Next continue the second column by taking its previous value, 22 and adding the 15 from the third column. Thus p(5) is 22&nbsp;+&nbsp;15&nbsp;=&nbsp;37. In order to compute p(6), we iterate the same algorithm on the p(5) values: take 4 from the fourth column, add that to the third column's value 15 to get 19, then add that to the second column's value 37 to get 56, which is p(6). This process may be continued ad infinitum. The values of the polynomial are produced without ever having to multiply. A difference engine only needs to be able to add. From one loop to the next, it needs to store 2 numbers—in this example (the last elements in the first and second columns). To tabulate polynomials of degree n, one needs sufficient storage to hold n numbers. Babbage's difference engine No. 2, finally built in 1991, can hold 8 numbers of 31 decimal digits each and can thus tabulate 7th degree polynomials to that precision. The best machines from Scheutz could store 4 numbers with 15 digits each. f(x) = a_n x^n + a_{n-1} x^{n-1} + \cdots + a_2 x^2 + a_1 x + a_0 \, the initial values can be calculated directly from the constant coefficients a 0 , a 1 ,a 2 , ..., a n without calculating any data points. The initial values are thus: Col 1_0 = a 0 Col 2_0 = a 1 + a 2 + a 3 + a 4 + ... + a n Col 3_0 = 2a 2 + 6a 3 + 14a 4 + 30a 5 + ... Col 4_0 = 6a 3 + 36a 4 + 150a 5 + ... Col 5_0 = 24a 4 + 240a 5 + ... Col 6_0 = 120a 5 + ... ... \sum_{n=0}^{\infin} \frac{f^{(n)}(0)}{n!}\ x^{n} The same method of calculating the initial values from the coefficients can be used as for polynomial functions. The polynomial constant coefficients will now have the value a_n \equiv \frac{f^{(n)}(0)}{n!} Difference Engine No1 specimen piece at the Powerhouse Museum, Sydney Gigapixel Image of the Difference Engine No2 Scheutz Difference Engine in action video. Purchased by the Dudley Observatory's first director, Benjamin Apthorp Gould, in 1856. Gould was an acquaintance of Babbage. The Difference Engine performed astronomical calculations for the Observatory for many years, and is now part of the national collection at the Smithsonian. Links to videos about Babbage DE 2 and its construction:
