Read an Excerpt
CHAPTER 1
Clock of Ages
December 1999. As the world spirals on toward 01-01-00, survivalists are hoarding cash, canned goods, and shotgun shells. It’s not the Rapture or the Revolution they await, but a technological apocalypse. Y2K! The lights are going out, they warn. Banks will fail. Airplanes may crash. Your VCR will go on the blink. Who could have foreseen such turmoil? Decades back, one might have predicted anxiety and unrest at the end of the millennium, but no one could have guessed that the cause would be an obscure shortcut written into computer software by unknown programmers of the 1960s and ’70s. To save a few bytes of computer memory, they left room for only the final two digits of the year.
We now know that civilization did not collapse on January 1, 2000. Y2K was a nonevent. Nevertheless, in hindsight those programmers do seem to have been pretty short on foresight. How could they have failed to look beyond year 99? But I give them the benefit of the doubt. All the evidence suggests they were neither stupid nor malicious. What led to the Y2K bug was not arrogant indifference to the future. ("I’ll be retired by then. Let the next shift fix it.") On the contrary, it was an excess of modesty. ("There’s no way my code will still be running thirty years from now.") The programmers could not envision that their hurried hacks and kludges would become the next generation’s "legacy systems."
Against this background of throwaway products that somebody forgot to throw away, it may be instructive to reflect on a computational device built in a much different spirit. This is a machine carefully crafted for Y2K compliance, even though it was manufactured at a time when the millennium was still a couple of lifetimes away. As a matter of fact, the computer is equipped to run through the year 9999, and perhaps even beyond with a simple Y10K patch. This achievement might serve as an object lesson to the software engineers of the present era. But I am not quite sure just what the lesson is.
A Glory of Gears
The machine I speak of is the astronomical clock of Strasbourg Cathedral, built and rebuilt several times over the past six hundred years. The present version is a nineteenth-century construction, still ticking along smartly at age 160-something.
The Strasbourg Cathedral clock is not a tower clock, like Big Ben in London, meant to broadcast the hours to the city. Although it does have a face on the exterior of the building—a rather undistinguished one that would look more at home on a train station—the main body of the clock is inside the cathedral. And yet it is certainly not a clock you would put on the mantel or hang on the wall. It has a case of carved stone and wood that stands fifty feet high and twenty-four feet wide, with three ornamented spires and a gigantic instrument panel of dials and globes, plus paintings, statuary, and a large cast of performing automata. Inside the clock is a glory of gears.
"Clock" is hardly an adequate description. More than a timepiece, it is an astronomical and calendrical computer. A celestial globe in front of the main cabinet tracks the positions of five thousand stars, while a device much like an orrery models the motions of the six inner planets. The current phase of the moon is indicated by a rotating globe, half-gilt and half-black.
If you want to know what time it is, the clock offers a choice of answers. A dial mounted on the celestial globe shows sidereal time, as measured by the earth’s rotation with respect to the fixed stars. A larger dial on the front of the clock indicates local solar time, which is essentially what a sundial provides; the prick of noon by this measure always comes when the sun is highest overhead. The pointer for local lunar time is similarly synchronized to the height of the moon. (When the solar and lunar pointers coincide, an eclipse is predicted.) Still another dial, with familiar-looking hour and minute hands, shows mean solar time, which averages out the seasonal variations in the earth’s orbit to make all days equal in length, exactly twenty-four hours. A second pair of hands on the same dial shows civil time, which in Strasbourg runs thirty minutes ahead of mean solar time. (The city is half a time zone west of the reference meridian for Central European time.)
To count the years there is an inconspicuous four-digit register that anyone from our age of automobiles will instantly recognize as an odometer. Each December 31 at midnight (that’s midnight mean solar time, and thus half an hour late by French official time), the counter rolls over to a new year. The transition from 1999 to 2000 went without a hitch.
There’s more. A golden wheel nine feet in diameter, marked off into 365 divisions, turns once a year, while Apollo stands at one side to point out today’s date. What about leap years? Presto: an extra day magically appears on the wheel when needed. Each daily slot on the calendar wheel is marked with the name of a saint or with some church occasion to be observed that day. Of particular importance, the occasions include Easter and the other "movable feasts" of the ecclesiastical calendar. Calculating the dates of those holidays, and displaying them correctly on the wheel of days, require impressive feats of mechanical trickery.
Wait! There’s even more! The clock is inhabited by enough animated figures to open a small theme park. The day of the week is marked by a slow procession of seven Greco-Roman gods in chariots. At noon each day the twelve apostles appear, saluting a figure of Christ, who blesses each in turn and at the end offers benediction to all present. Every half hour a putto overturns a sandglass, and on the quarter hours another strikes a chime. Still more chimes are sounded by figures representing the four ages of mankind, followed by a skeletal Death, who rings the hours. And a mechanical cock crows on cue, flapping its metal wings.
All of this apparatus is housed in a structure of unembarrassed eclecticism, both stylistic and intellectual. The central tower of the clock is topped with a froth of German-baroque frosting, whereas a smaller turret on the left (which houses the weights that drive the clockwork) has been given a more Frenchified treatment. A third tower, on the right, includes a stone spiral staircase that might have been salvaged from an Italian Renaissance belvedere. In the base of the cabinet, two glass panels allowing a view of brass gear trains are a distinctively nineteenth-century element; they look like the windows of an apothecary shop. The paintings and statues are mainly on religious themes—death and resurrection, fall and salvation—but they also include portraits of Urania (Muse of astronomy) and Copernicus. Another painting portrays Jean Baptiste-Sosimé Schwilgué, whose part in this story I shall return to presently.
Programming with Brass
It’s all done with gears. Also pinions, worms, snails, arbors; pawls and ratchets; cams and cam followers; cables, levers, bell cranks, and pivots.
The actual timekeeping mechanism—a pendulum and escapement much like those found in other clocks—drives the gear train for mean solar time. All the other astronomical and calendrical functions are derived from this basic, steady motion. For example, local solar time is calculated by applying two corrections to mean solar time. The first correction compensates for seasonal changes in day length, the second for variations in the earth’s orbital velocity as it follows its slightly elliptical path around the sun. The corrections are computed by a pair of "profile wheels" whose rims are machined to trace out a graph of the appropriate mathematical function. A roller, following the profile as the wheel turns, adjusts the speed of the local-solar-time pointer accordingly. The computation of lunar motion requires five correction terms and five profile wheels. They all have names: anomaly, evection, variation, annual equation, reduction.
The overall accuracy of the clock can be no better than the adjustment of the pendulum, which requires continual intervention, but for the subsidiary timekeeping functions there is another kind of error to be considered as well. Even if the mean time is exact, will all the solar and lunar and planetary indicators keep pace correctly? The answer depends on how well celestial motions can be approximated by the arithmetic of rational numbers, as embodied in gear ratios. The Strasbourg clock comes impressively close. For example, the true sidereal day is 23 hours, 56 minutes, 4.0905324 seconds, whereas the mean solar day is exactly 24 hours (by definition). The ratio of these intervals is 78,892,313 to 79,108,313, but grinding gears with nearly 80 million teeth is out of the question. The clock approximates the ratio as 1+(450/611 × 1/269), which works out to a sidereal day of 23 hours, 56 minutes, 4.0905533 seconds. The error is less than a second per century.
The most intricate calculations are those for leap years and the movable feasts of the church. The rule for leap years states that a year N has an extra day if N is divisible by 4, unless N is also divisible by 100, in which case the year is a common year, with only the usual 365 days; but if N is also divisible by 400, the year becomes a leap year again. Thus 1700, 1800, and 1900 were all common years (at least in those parts of the world that had adopted the Gregorian calendar), but 2000 had a February 29. How can you encode such a nest of if-then-else rules in a gear train? The clock has a wheel with twenty-four teeth and space for an omitted twenty-fifth. This wheel is driven at a rate of one turn per century, so that every four years a tooth comes into position to actuate the leap-year mechanism. The gap where the twenty-fifth tooth would be takes care of the divisible-by-100 exception. For the divisible-by-400 exception to the divisible-by-100 exception, a further adjustment is needed. The key is a second wheel that turns once every 400 years. It carries the missing twenty-fifth tooth and slides it into place on every fourth revolution of the century wheel, just in time to trigger the quadricentennial leap year.
The display of leap years calls for as much ingenuity as their calculation. On the large calendar ring, an open space between December 31 and January 1 bears the legend "Commencement de l’année commune" ("Start of common year"). Shortly before midnight on each December 31 when a leap year is about to begin, a sliding flange that carries the first sixty days of the year ratchets backward by the space of one day, covering up the word "commune" at one end of the flange and at the same time exposing February 29 at the other end. The flange remains in this position throughout the year, then shifts forward again to cover up the 29 and reveal "commune" just as the following year begins.
The rules for finding the date of Easter are even more intricate than the leap-year rule. Donald Knuth, in his Art of Computer Programming, remarks: "There are many indications that the sole important application of arithmetic in Europe during the Middle Ages was the calculation of Easter date." Knuth’s version of a sixteenth-century algorithm for this calculation has eight major steps, some of which are fairly complex. Here’s step five:
Set E <–– (11G + 20 + Z – X) mod 30. If E = 25 and the golden number G is greater than 11, or if E = 24, then increase E by 1. (E is the so-called "epact," which specifies when a full moon occurs.)
Programming a modern computer to perform the Easter calculation requires some care; programming a box of brass gears to do the arithmetic is truly a tour de force. I have stared at diagrams of the gears and linkages and tried to trace out their action, but I still don’t fully understand how it all fits together.
In the abstract, it’s not too hard to see how a mechanical linkage could carry out the basic steps of the epact calculation given above. A wheel with 30 teeth or cogs would ratchet 11G notches clockwise, then it would add 20 steps more in the same direction, then another Z steps; finally it would turn X steps counterclockwise. The "mod 30" part of the program—reducing the sum modulo 30 (so that 30 becomes 0, 31 becomes 1, and so forth)—would be taken care of automatically by doing the arithmetic on a circle with 30 divisions. So far so good. The 30-tooth wheel does exist in the Strasbourg clock, and it is even helpfully labeled "Epacte." Where I get lost is in trying to understand the various lever arms and rack-and-pinion assemblies that drive the epact wheel, and the cam followers that communicate its state to the rest of the system. There appear to be a number of optimizations in the gear works, which doubtless save a little brass but make the operation more obscure. Perhaps if I had a model I could take apart and put together again . . .
But never mind my failures of spatiotemporal reasoning. The mechanism does work. Each New Year’s Eve a metal tag that marks the date of Easter slides along the circumference of the calendar ring and takes up a position over the correct Sunday for the coming year. (The date of Easter can range from March 22 to April 25.) All the other movable feasts of the church are a fixed number of days before or after Easter, so the indicators of their dates are rigidly linked to the Easter tag and move along with it.
Making It Go
The present Strasbourg clock is the third in a series. The first was built in the middle of the fourteenth century, just as the cathedral itself was being completed with the addition of a spire that made it the tallest structure in Europe. That original clock had animated figures of the three Magi who bowed down before the Virgin and Child every hour on the hour. Little else is known of it, and all that survives is a mechanical rooster, ancestor of the current cock of the clock.
By the middle of the sixteenth century, the Clock of the Three Kings was no longer running and no longer at the leading edge of horological technology. To supervise an upgrade, the Strasbourgeois hired Conrad Dasypodius, the professor of mathematics at Strasbourg, as well as the clockmaker Isaac Habrecht and the artist Tobias Stimmer. These three laid out the basic plan of the instrument still seen today, including the three-turreted case and most of the paintings and sculptures. A curiosity surviving from this era is the portrait of Copernicus—a curiosity because the planetary display on the Dasypodius clock portrayed not the sun-centered Copernican system but the earth-centered Ptolemaic one. The second clock lasted another two hundred years, give or take.
The story of the third clock starts with an anecdote so charming that I can’t bear to look too closely into its authenticity. Early in the nineteenth century, the story goes, a beadle was giving a tour of the cathedral, and mentioned that the clock had been stopped for twenty years and no one knew how to fix it. A small voice piped up: "I will make it go!" The boy who made this declaration was Jean Baptiste-Sosimé Schwilgué, who made good on his promise forty years later.
There was mild conflict over the terms of Schwilgué’s commission. He wanted to build a wholly new clock; the cathedral administration wanted to repair the old one. They compromised: he gutted the works, but kept the case, and built his new indicators and automata to fit the old design. The new mechanism was first started up on October 2, 1842.
Schwilgué was clearly thinking long-term when he undertook the project. As I have already noted, the leap-year mechanism includes components that engage only once every four hundred years—parts that were tested for the first time in 2000 and will lie dormant again until 2400. Such very rare events might have been left for manual correction. It would have been only a small imposition on the clock’s maintainers to ask that the hands be reset every four centuries. But Schwilgué evidently took pride and pleasure in getting the details right. He couldn’t know if the clock would still be running in 2000 or 2400, but he could build it in such a way that if it did survive, it would not perpetrate error.
The contrast with recent practice in computer hardware and software could hardly be more stark. Many computer systems—even those that survived the Y2K scare—are explicitly limited to dates between 1901 and 2099. The reason for choosing this particular span is that it makes the leap-year rule extremely simple: it’s just a test of divisibility by four. Under the circumstances, this design choice seems pretty wimpy. If Schwilgué could take the trouble to fabricate wheels that make one revolution every one hundred and four hundred years, surely a programmer could write the extra line of code needed to check for the century exceptions. The line might never be needed, but there’s the satisfaction of knowing it’s there.
Other parts of Schwilgué’s clock look even further into the future. There is a gear deep in the works of the ecclesiastical computer that turns once every 2,500 years. And the celestial sphere out in front of the clock has a still-slower motion. In addition to the sphere’s daily rotation, it pirouettes slowly on another axis to reflect the precession of the equinoxes of the earth’s orbit through the constellations of the zodiac. In the real solar system, this stately motion is what has lately brought us to the dawning of the age of Aquarius. In the clock, the once-per-sidereal-day spinning of the globe is geared down at a ratio of 9,451,512 to 1, so that the equinoxes will complete one full precessional cycle after the passage of 25,806 years. (The actual period is now thought to be 25,784 years.) At that point we’ll be back to the cusp of Aquarius again, and no doubt paisley bell-bottoms will be back in fashion.
Excerpted from Group Theory in the Bedroom, and Other Mathematical Diversions by Brian Hayes.
Copyright 2008 by Brian Hayes.
Published in 2008 by Hill and Wang.
All rights reserved. This work is protected under copyright laws and reproduction is strictly prohibited. Permission to reproduce the material in any manner or medium must be secured from the Publisher.