I will assume anyone reading this knows the general history of the Difference Engine. In brief, a 19th century mechanical calculator that was never built at the time, but has since been proved to be quite practical. Mostly notable because Babbage went on to design the Analytical Engine, also never built, which would have been a general purpose computer in every modern sense of the term. This is as close to real steampunk as the world ever got.
The principle behind the Difference Engine is actually pretty simple. If you take any expression f(), you can create a list of output values. f(0) = a, f(1) = b, etc. You can then look at the differences between the output values, and the differences between the differences, and so on. At some point, if f() is a polynomial, these differences will become constant. For an example, let's look at f(x) = x^2 - 5x + 10.
x | f(x) | f(x)' | f(x)'' |
---|---|---|---|
0 | 10 | ||
1 | 6 | 4 | |
2 | 4 | 2 | 2 |
3 | 4 | 0 | 2 |
4 | 6 | 2 | 2 |
5 | 10 | 4 | 2 |
Once we're looking at the difference of the difference (or the second derivative) we're looking at a constant value of 2 (which is what we'd expect, as f(x) is a second order polynomial). Neat, but so what? Well, now that we've worked this out, we can calculate further values of f(x) just using addition. We can now work right to left, adding f(5)'' to f(5)', and then adding that to f(5) and we get f(6)!
x | f(x) | f(x)' | f(x)'' |
---|---|---|---|
0 | 10 | ||
1 | 6 | 4 | |
2 | 4 | 2 | 2 |
3 | 4 | 0 | 2 |
4 | 6 | 2 | 2 |
5 | 10 | 4 | 2 |
6 | 16 | 6 | 2 |
So that's pretty cool. And that's exactly what the Difference Engine does.
Each of those columns is a 31 digit number. There are 9 columns, allowing 9th order polynomials to be calculated. Adding is a very simple operation mechanically -- gears turning gears at a 1:1 ratio. The complication comes from carry operations, which is what the helices on the columns in this picture do. (This is the rear of the machine.)
With the mechanism so far, you can calculate some fairly complicated expressions with a high degree of reliability. But this is the 19th century. You're not calculating them for use in a ray tracing or something, you want to generate a big book of trig tables. Which means that all these values have to be typeset. By hand. Backwords. Needless to say, this can introduce a lot of errors. If you're obsessive enough to build a Difference Engine in order to generate accurate values, this situation simply will not do. Obviously you need to design a printer as well, which is exactly what Babbage did.
It isn't enough just to print onto paper (though it does do that), because then the values would still need to be transfered to type. So it also printed into a soft plaster sheet, creating a stereotype mold from which an entire page can be cast. No chance for human error.
Now, this is all stuff that anyone slightly obsessed with the history of the Difference Engine would know. What is particularly exciting about there being real working Engines in the world is that one can talk to the people who really use them and have real working knowledge of the things. Which is absolutely what I did.
This is the base of the printer. That crank wasn't on the original plans -- it turns out that the printer jams fairly easily, at which point you need to run it backwards separate from the main Engine. So they added a crank at that end, and a little clutch to disengage the printer.
Also, notice the little cable at the bottom? That gets pulled when the printer hits the end of the page, at which point a lot of stuff needs to be reset. The cable runs the length of the machine...
...finally coming out at the main crank, where it attaches to a clutch on the bevel gear. Thus, when the printer ends a page, the crank is disengaged and the person turning it knows to stop. (This was in the original design!) What wasn't in the original design was the 4:1 reduction gear on the crank itself. It just takes too much effort to turn otherwise, not something Babbage would have been able to tell in the design phase.
Speaking of the main crank, it turns out that turning it requires a lot of training, because the Engine requires very different amounts of force at different phases of a calculation cycle. And it jams fairly easily, so you need to know when to apply a lot of force, and when it shouldn't need much force so stop immediately.
Back at the printer, it has these escapement wheels and adjustment cranks. The left escapement defines how many columns are on a page, and the one of the right sets spacing between lines -- you can just see the short-short-short-short-long spacing in the wheels, which puts a larger space between every fifth line, which is what you'd want in a table of numbers to make lookup easier. The crank adjusts the overall spacing between lines.
Other cool stuff lacking in specific pictures:
Most of the bolts worked loose while it was on the cargo plane being delivered. It was built only with mid-19th century technology, so no lock-washers or Loctite was used. Because of this they have been fighting jams and problems ever since. They recently made a series of adjustments to the angular position of the take-off gears from the main drive shaft, which determines the relative timing of various operations in a computational cycle. They managed to do this because one of the museum employees happened to be visiting London and could stop by the other Difference Engine there and take some measurements.
The printer works, but they do not normally have it set up with ink or plaster. This is mostly because period ink is water based, and would have to be cleaned off immediately to prevent corrosion. The one thing that is not rigorously period is the lubricants used. Original ones would be horrible animal-based ones and just not worth it. Originally this Engine used petroleum lubricants, with an associated machine smell. Upon encountering it, the wife of the owner (who will eventually have it installed in his living room) said that it was not acceptable. Ever since, they have used FDA-approved food equipment lubricants, which are silicone based and have no smell at all.
The thing that impressed me most of all was finding out that the 31 computational digits can be split up into multiple calculations happening in parallel, with correspondingly fewer digits of precision. The Engine as it is set up at the museum is running in a 27/4 configuration. The larger set is calculating a 7th-order polynomial for demonstration purposes. The smaller set is set up with just a 1 in the first column. Which means that the output column is incremented by 1 every cycle. In modern terms: printf("%d", ++i); It's a debug statement! A convenient little printout that helps the operators keep track of what is going on! I was utterly charmed by it -- I bet Babbage never thought about doing that. This is the kind of thing that only gets discovered when you're actually using a system. It's a delightful little look into a parallel world where Babbage didn't get quite so perfectionistic and actually got the damn thing built.
Finally, here are some videos I took:
There have been a number of Meccano implementations of the Difference Engine but not with 31 columns.
ReplyDeletehttp://www.meccano.us/difference_engines/rde_2/index.html
There's a UK-based project to build an Analytical Engine looking for sponsorship.
http://www.bbc.co.uk/news/technology-11530905