Brass figure wheels tabulate a polynomial with nothing but addition and rippling carries.
Five columns of six brass figure wheels hold a table value and its first four differences, units at the bottom. Because a polynomial of degree four or less has a constant fourth difference, adding each column into the next produces the whole table. As in Babbage's Difference Engine No. 2, each crank turn has two halves, even columns first and then odd, so the columns start staggered at x minus floor(k/2). An addition turns every wheel of the receiving column forward by the digit facing it on the giving column, all at once; a wheel passing from 9 to 0 trips its warning lever, and then the carries ripple up from the units, each one able to trip the next. Negative numbers are held as ten's complements, which the carry lost off the top wheel makes work, and each finished turn prints the next value on the paper slip.
Try it. Start typing (or click the title) to enter your own polynomial in x up to degree 4, then press Enter to load its differences. Drag the crank wheel to turn the engine forward, click the engine to advance a quarter turn, or press the right arrow for a full turn. Tab, or a tap on the paper slip, cycles the examples; up and down change speed, Space pauses.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a model of Babbage's Difference Engine with JavaScript and the HTML canvas element: columns of brass number wheels that tabulate a polynomial using only addition. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Use a dark wooden background.
- Hold four columns: the table value T and differences D1, D2, D3, each as an array of decimal digits (units first).
- Load a polynomial such as x^2 + x + 41: set T = p(0), D1 = p(1) - p(0), D2 = the second difference, and so on.
- On each step, add D1 into T, then D2 into D1, then D3 into D2, digit by digit. When a digit passes 9, set a carry flag on that wheel, then propagate the carries from the units upward, one wheel at a time.
- Draw each digit as a brass wheel seen edge-on: a short horizontal band with the current digit centred and its neighbours squashed toward the edges with Math.cos, so turning the wheel slides the digits sideways.
- Print each new value of T in a list beside the engine.
Once that works, make it beautiful:
- Animate the wheels rolling forward during an addition and show a carry lever flipping up and then rippling the carry to the wheel above.
- Add a crank I can drag to turn the engine, and store negative numbers as ten's complements so the machine handles them with the same addition.
- Let me type my own polynomial and compute its starting differences.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as Babbage's two-phase timing (even columns, then odd), a typewritten paper slip, or marking which printed values are prime.