Mr. Babbage, Meet Mr. Lego


Andrew Carol, a software developer for Apple Computer Inc., Cupertino, Calif., and a self-described "engineering fiend," had for years been enamored of the idea of building a 19th-century difference engine out of Lego pieces. One of the earliest conceptions of a mechanical computer, a difference engine is a machine for solving polynomial equations. (For those of you who have forgotten, those are equations such as f ( x ) = Ax2 + Bx + C .) Initially, he took the most famous example as inspiration, Charles Babbage's Difference Engine No. 2, which was sketched out in 1822 but finally built only in 1991, at the London Science Museum.

"That's what held me up," Carol says. Engine No. 2 relies on lots of vertical rods for translating information between the machine's components. The plastic Legos were too soft for the task. But Babbage's earlier design, No. 1, while more complex, works with gears, and Lego has gears aplenty. Once Carol had managed to get a key component working--a mechanical adder that retains the numbers being added--it took him three months to build his own, all-Lego, difference engine (

In the photo, Carol's engine has just calculated 121, or 11 2 [top row], and on the next turn of the gears, the 2 at the bottom will add to the 21 in the middle, and the result will add to the 121 at the top to yield 144, or 12 2.

Next up for Carol is a stab at a more programmable kind of 19th-century computer called an analytic engine.