Fig 4Difference Engine No. 2Hover · drag the crank · press a wheel · ← → · Spacen = 0 · f = 0 · Δ1 1 · turn 1 of 4: odd → even · 1 row printed
The wheels being turned: a receiving column counting up while its giver counts down, or the one wheel taking a carryFigure wheels, 8 columns × 31, digits 0–9 round each rim, read against the index bar; a tab at 9 → 0 warns the carry lever behindSector gears between the columns; a column rises or drops into mesh, so one sector column serves each additionThe printer: copy sectors and racks take column f off in turn 3 to a row of 31 type wheels; the platen prints the checking copy on the paper web behind, the anvil impresses the stereotype tray in frontPaletteBabbage designed Difference Engine No. 2 in 1846–1849; the Science Museum, London, built its calculating section in 1985–1991 under Doron Swade and its printing and stereotyping apparatus in 2002, and a second engine was completed for Nathan Myhrvold in 2008. It has 8 columns of 31 figure wheels, tabulates polynomials of the 7th order, has about 8,000 parts, weighs about 5 tons and measures 11 ft × 7 ft. This figure is the whole engine: the calculating section (stage A) with every one of the 8 × 31 wheels, 7 × 31 sector gears and 248 carry levers, and the printing and stereotyping apparatus (stage B) on its own bed at the left, bolted to the engine's bed and driven from the coupling flange on the main shaft. One cycle is one turn of the main shaft, four turns of the crank through the 4:1 gear: turn 1 adds the even columns into the odd (Δ1 → f, Δ3 → Δ2, Δ5 → Δ4, Δ7 → Δ6), the givers counting down to zero while the sector gears turn the receivers up; turn 2 performs the carries on f, Δ2, Δ4 and Δ6 one wheel after another from the units up, so a carry can run through a row of nines, and restores the givers; turn 3 adds the odd columns into the even (Δ2 → Δ1, Δ4 → Δ3, Δ6 → Δ5) and takes column f off as the table entry; turn 4 carries on Δ1, Δ3 and Δ5 and restores. Because the additions interleave, the initial setting is not the plain row of differences: each even difference is set one step behind the odd one above it (for n³: f 0, Δ1 1, Δ2 0, Δ3 6), which this page derives from the forward differences. The engine runs here at 30 crank rpm, the figure's own speed, not a historical one. The real engine's sector gears slide axially into mesh and its carry sweeps are helical arms on rotating shafts; here the columns themselves rise or drop half a pitch into mesh with sectors set above or below the tooth line, and the helices are turned by rack bars from two carry cams. The printer follows the sources as far as they go: the Science Museum completed it in 2002 to the design Babbage also intended for the Analytical Engine; its first purpose is stereotyping, pressing the result's digits into a tray of soft material (plaster of Paris) to make a flong from which plates for a table book can be cast, and its paper output is an inked checking copy; it typesets with user-alterable formatting, variable line height, number of columns and column margins (here the column-shift lever and the line-height nut on the tray slide). Column f is taken off in turn 3 by a sector gear, as Wikipedia describes: here f drops into mesh with thirty-one copy sectors and counts down to zero like any giver, each copy sector turning a copy wheel whose hub pinion moves a rack 1.335 cm per digit; the racks run through the left standard into the printer, turn vertical type spindles, and a face crown at each spindle's foot turns its type wheel 9° per digit. The type wheels then show the row, the ink roller has passed down their backs, and at the end of turn 3 the platen strikes the paper onto the type and the anvil lifts the tray against it in one stroke; in turn 4 f is restored and the copy wheels unwind to zero, the paper is fed one line (5.2 cm, so each printed row lies in a gap between the racks as seen from here) and the lead screw advances the tray one line (3.0 cm). The copy train is this figure's own mechanism: the sources name a sector gear and the printer's features, not the linkage, and a real printer would hold the type between strokes rather than unwind it; the ten digits are engraved four times round each type rim so the paper behind and the tray below take the same figure. Functions that are not polynomials (logarithms, sines, compound interest) are tabulated through a degree-7 least-squares fit over the table's range, with the fit's largest error stated, exactly as Babbage's tables were built from piecewise polynomial approximations; exact registers are BigInt, 31 digits, with ten's complements for negative values.