|This is the paper that resulted from the talk I gave at the 1999 O’Reilly Open Source Conference. There is still much work to be done before I can release the Mayan abacus written in Python, but I felt that the anecdotes contained herein ought to be published along with the slides from the presentation.|
Once, in high school, I was foolish enough to give a party for some friends. One of those friends decided to stand on my foot, which he did for several minutes or so. My father noticed me limping a day or two later, and took me to the doctor. I had a broken bone in my foot. I was very pleased at this, because it meant that I didn’t have to play football in PE for the upcoming six weeks.
I gave my doctor’s note to the coach, who grinned evilly. “That’s fine. You can be the referee.”
For the next six weeks, I was the referee; for normal people, this wouldn’t have been a problem. I, on the other hand, detested sports of all kinds, and I hated football above all others. I knew nothing of the game, other than having seen parts of large bodies hauled off from time to time during play. I didn’t know rule one.
I did what I could, blowing my little whistle when it seemed like the right thing to do. But I was guessing. I continued to guess. Coach thought I was doing fine, and never complained, but all my football-loving friends hated me. At the end of the six weeks of football, my bone was healed and I had learned not one rule.
I’ve left well enough alone. It worked for me then,
and a lot of people out there claim that they learned everything they needed
to know in high school. I suppose, now that you mention it, that
it is reasonable to say that I learned everything I needed to know about
football in high school.
I spent November and December of 1970 in Củ Chi, Republic of Việt Nam, as a shipping clerk for Company B, 369th Signal Battalion, Củ Chi Detachment.
This had nothing to do with my real MOS2, but the fellow who had been our regular shipping clerk was bored with the job and had no intention of typing anything ever again in his life. Since the job we were performing was dismantling our entire compound—as we were living in it—and packing everything, including the fiberglass building insulation, into giant packing crates for shipment back to the world3, someone had to type up the packing lists. My real job had evaporated about 30 seconds after we pulled down the microwave antenna, which was the first thing to go, and I was looking at two months of hard labor before I could go home in January. I could type; I could count, after a fashion. Naturally, I volunteered. Anything was better than fiberglass. Everyone else would stuff things into these huge crates, I would run out and write down the contents, and then they would fill up the remaining spaces with yellow carcinogenic foam.
Along with listing each and every item in the crates in approved military format (“Insulation, fiberglass, pink: 612 Linear Feet, with staples” “Gecko, beige: 5 ea. [dead]4”), I had to measure the packing crates; these were built in the temporary wood shop put up for the purpose in the compound, and were sized as needed. That meant that no two crates had identical measurements. On the packing lists, I had to list the measurements to the closest inch and calculate the volume—in cubic inches—to two decimal places.
Despite the fact that our compound contained millions of dollars worth of precision electronic communications equipment, the supply depot refused to send us even the cheapest mechanical adding machine. We were told that we were lucky to get pencils and typewriter ribbons—and the ribbons could be iffy. I was forced to use a pencil to work out the volume of our packing crates; for someone who had flunked high-school algebra, this was hard. I struggled with non-deterministic volumes for three days, and found myself appallingly behind. The others had produced at least fifty cases, and I had completed only four packing lists. If I hadn’t already taken to drink, this would have driven me to do so.
Now, the reason we were taking everything apart and shipping it back to the States was that this was the beginning of what Nixon called “Vietnamizing the war.” We were supposed to turn conduct and operation of the war over to the South Vietnamese Army. Our contribution to Vietnamization was to level the compound and leave the ARVN5 forces with four concrete pads, a bedraggled hooch6 and a centipede-infested bunker.
One of the South Vietnamese Army regulars on site, Sergeant Ngai, heard me complaining that first night. “Oh,” he said. “You need an abacus.”
“But I can’t use one.”
“I’ll show you how. It’s easy. Besides, if you get these numbers wrong, what are they going to do to you? Send you to Việt Nam?”
The next day he showed up in my “office”—I had put the typewriter in my room in the hooch—with an abacus, and we went to work. He would click those little beads around for thirty seconds and produce an answer, I would rip holes in my scratch paper for an hour and then use his result. After all—how would I know if I got it right?
After a morning of this, I could see that there was no way I was going to master the abacus. Sergeant Ngai was wasting his time teaching a horse to sing. Ngai went off to lunch, but I stayed there looking at the abacus and my figures, waiting for inspiration.
Something hit. When Ngai came back, I was working out multiplication tables: 12, 144, 1728 times one through twelve. “Check these,” I said. He found mistakes using his abacus; I corrected them. We tried it out, with me using my lookup tables and him clicking merrily away. I got pretty good; it only took me two or three times as long to get the right answer as it took him. He took his abacus home that evening, and the next day I cranked out all the remaining packing crates. I was able to keep up quite easily over the next two months. Months after I came home, I ran into SFC7 Hutchinson, who had been in charge of the Củ Chi Detachment. “Hey,” he said. “I got a letter of commendation from the bean counters who had to check your packing lists. They found only four errors in all those crates.”
“Just in the first four boxes, I bet.”
“Yup.” Then he glared at me. “You’re lucky they didn’t count those goddamn geckoes as an error.”
I received a Bronze Star for my work in Vietnam, which included my time as a shipping clerk.
The Dresden Codex, one of the four surviving Mayan Codices, or books, is at once the most beautiful and the most scientifically useful document from before, or shortly after, the Spanish Conquest. It is a major resource for exploring the knowledge, abilities and cultural structure of the Classic and Post-Classic Mayan intellectual elite; it is perhaps the major resource for astronomical knowledge. It is also a symbol of the societal contradictions inherent in an age of theocratic imperialism, for it is quite possible that the priest who burned the Mayans’ books was the very man responsible for saving the Dresden from the flames. There is no question that Friar Diego de Landa is responsible for the decipherment of Mayan Hieroglyphic writing in recent years; without his efforts to record the culture of those whose souls he was saving, I wouldn’t have anything to say.
Because of him, we can read the Dresden and not merely make educated guesses. Many others, notably Sir J. Eric S. Thompson, have contributed to determining the meaning of the mathematical and astronomical tables and charts in the Dresden over the last hundred years, but de Landa’s “alphabet,” recorded in the 16th Century, turned out to be the Rosetta Stone of Mayan epigraphy.
Figure 1: Landa’s “Alphabet”
“Alphabet,” of course, is a misnomer; de Landa was a 16th Century Spaniard, and had never heard of a syllabary. Instead of alphabets, many languages use syllabaries, which are tables or charts showing all the legal consonant-vowel combinations in a language, such as “pa, pe, pi, po, pu.” de Landa also had a pretty bad ear: like most conquistadores who wrote down Native American languages, he was unable to hear critically important distinctions in the sounds of consonants (such as that between kin and k’in), thus frustrating future historical linguists endlessly.
Earlier, I described my first encounter with an abacus, and how I abandoned it in favor of pre-calculated multiplication tables. When I first encountered the multiplication tables in the Dresden Codex, I could see how they worked, and how useful they would be.
Figure 2: The Dresden Codex, page 32A
These tables would have been used extensively by Mayan mathematicians to perform difficult astronomical and calendrical calculations; one of the other important sections of the Dresden is a highly accurate—and still usable—solar eclipse table, which not only provides dates favorable for eclipses for a certain time, but also contains an algorithm that makes the calculator accurate over any given 11,960 day period. That is, it can be used today; reset the base of the eclipse table to any convenient beginning point, and it will tell you, with fairly reasonable accuracy, just when to expect eclipses. There are never any eclipse guarantees, of course, but the basic framework for prediction is there.
Thompson, undisputed king (and I use that gendered term deliberately) of Mayanists from the 1930s through the mid-60s, is also a study in contradictions. While de Landa burned books, Thompson threw the weight of his considerable reputation against the very idea that gave us hieroglyphic translation, i.e., the notion that Mayan hieroglyphic writing was syllabic in form. He maintained, until the year before his death, that Mayan writing, despite all evidence to the contrary, was something unique. Unlike every other language on the planet, Maya writing was not syllabic, not alphabetic and not ideographic. “Ideographic” is what Westerners usually think of when they see Chinese characters—arbitrary symbols standing for a complete word. Chinese writing is only faintly ideographic in this sense, but this simplistic description is sufficient for my purposes. Thompson believed that most Mayan hieroglyphic writing was “rebus-writing”—the kind of writing you’ve seen in the newspapers where a picture of something reminds you of the word for the thing. To write “I see a bee,” for example, you could draw a picture of an ice cube, followed by an eyeball, and then a picture of a honeybee. According to Thompson, discovery of the words pointed to by these rebuses was to be accomplished by consulting contemporary Mayans, close examination of the glyphs, and deep thought. Lots of deep thought. He actually did find a few examples of rebus glyphs, and not a few ideographic ones (nowadays, they’re called “logographs”), but never enough to prove his rule. He has been cast as “the person who single-handedly did more to hold back translation than anyone else,” and the characterization is not without basis.
Michael Coe, describing Thompson’s Maya Hieroglyphic Writing, says “I view it not as a kind of Summa Hieroglyphicae of the Maya script, as many do, but as a sort of gigantic, complex logjam which held back the decipherment among a whole generation of Western scholars, held in thrall by its sheer size and detail, and probably also by Thompson’s sharp tongue.” (Coe, 1992: 140)
At the same time, Thompson initiated and fostered many new ways of thinking about the Mayans and their writing system which have been crucial tools in the study and decipherment of the glyphs. He was the first to suggest and practice the study of contemporary Mayan languages as an indispensible aid to decipherment. He was also the first to suggest that ethnographic studies might reveal important clues, not only to the decipherment of individual glyphs, but also to the way the Classic Mayans thought. Only by immersing oneself in the Mayan world view at the deepest level, he said, could we ever hope to understand people a thousand years dead. Paraphrasing Churchill, he once said that “Maya astronomy is too important to be left to the astronomers.” If I’m not mistaken, he proclaimed this at a conference aimed at bringing together astronomers and Mayanists.
Not long after I encountered the multiplication tables in the Dresden, the local Asian food market, Ginza, went out of business.
Ginza was a remarkable hodge-podge of a store, with many small rooms containing everything from dried squid to fresh flowers; one room contained only spices, condiments and other ingredients for Indonesian cooking. While there was no separate room for Japanese items, there was a glass case near the cash register which held dolls, small screens, lacquer boxes—and a very strange abacus.
Figure 3: Lee’s Abacus
I suppose the abacus9 that I bought there could be described as a “scientific” abacus; according to the instruction manual (which I still have somewhere, even though I long ago lost the actual device), you could perform addition, subtraction, multiplication, division, the extraction of square and cubic roots—and probably calculus if you had the patience. I didn’t. “The Lee’s IMPROVED abacus may well claim to be the best of all kinds of existing arithmometer,” says the introduction.
I confined myself to the most elementary pages of the instructions. I worked with it for a few weeks, off and on, but never really got anywhere. I made use of the University of Illinois library, however, and tracked down some elementary texts aimed at teaching Westerners the basics of abacus calculation; practice, however, did not make perfect—or even presentable. I could add simple numbers, and sometimes subtract, very, very slowly, but anything beyond that completely flummoxed me.
I did what any self-respecting programmer would do when, in Pirsig’s words, “cultivating being stuck.” I wrote an abacus program for X windows. To do that, I had to write an abacus widget. Since I wasn’t very good at using an abacus, I made the widget automatically display the number it was set to. I added lots of features, to make it as configurable as possible, but confined myself to trying only the simplest of layouts: the Japanese style, or soroban, which contains no confusing extra beads.
Figure 4: A soroban, the Japanese abacus
Digging around in the library, however, had netted me a pretty interesting paper. Thompson’s 1941 “Maya Arithmetic.” (Thompson, 1941).10 In it, Thompson describes having heard of contemporary Mayans (contemporary in 1941) using a grooved board and cacao beans or pebbles to calculate day almanacs quickly. He also cites older references, nearer the time of the conquest, describing Mayan scribes using tracks scratched in the dirt or in a board, and again using beans or pebbles to keep track of days in the Calendar Round. There are a very few mentions of calculating aids the Mayan scribes might have used, with none of these descriptions being very helpful.
What we see from even a cursory study of the monuments the Mayans left us convinces most Mayanists that they must have had something to aid them in their calculations. You just can’t make flawless leaps over nonillions of years in the Mayan calendar and land on the correct day and month combination by guess, or luck, or happenstance. The sheer quantity of dates on Mayan monuments dictates that there will be some mistakes, but the number of those is infinitesimal compared to the dates that are correct.
What Thompson did was describe his educated best guess at one reconstruction of a possible Mayan abacus; a board with grooves in it, in which you could place cacao beans to represent Long Count places and tzolk’in and haab positions (the 260-day and 365-day cycles that make up the 18,980-day Calendar Round). According to him, memorizing a few simple rules made it possible to use this abacus to quickly and easily compute Calendar Round positions at any date in the future or past. I’d already had to build an abacus widget, for my soroban, so it was a small leap from there to a Mayan abacus.
Figure 5: A Mayan abacus for X Windows
I’d spent several months already drawing bitmaps of Mayan glyphs. We didn’t have scanners, so I just drew them, using xbitmap. Those of you who’ve used it know that in the early days, it was dumber than paint. In both senses. After you’ve drawn a few thousand, though, you get pretty good at it, even if the program is stupid. One of the glyphs was this one, the Ninth Lord of the Night.
My friend Pat Kane noticed me drawing it. “Huh. I didn’t know the Mayans had X Windows!”
“X Windows?” I looked at him.
“Sure. Look at the big X on the headdress. It must have been difficult getting good refresh rates on those stone monuments.”
For six months I had been without most of my tools and environment. The tapes I’d made at my last job when I left were unreadable on any drive available at the little robotics company I now worked for. One day, however, SGI brought in a demonstrator system in order to convince the cash-strapped management to buy one; I could have told them it was hopeless, but I’m glad I didn’t. The demo system arrived with the exact tape drive I needed.
The SGI people hooked the system into our network and gave us all a graphics tour that would have sold anyone but the most clueless. Afterwards, the reps went off to talk things over with our CEO. I slapped my tape in and dumped everything on it onto my workstation. Just as I pulled out the tape, the SGI reps came out looking miffed, packed up their system and left.
Like any sensible engineer, I spent the next three days compiling toys instead of working. My workstation gradually acquired the appearance of an eighth-century Classic Mayan monument. Even though working there was mostly unpleasant—paychecks had a tendency to bounce—it had its good points. One of those good points is that they weren’t in a position to hire engineers just like themselves, so we had Indian, Jamaican, African-American and Chinese developers. I dug out my old abacus code. It compiled with minimal fuss, and I grabbed one of the Chinese engineers. “Can you use an abacus?” I asked.
“Of course! In China, we are taught how in school. For a long time.”
“Ever use on one a computer?”
He was highly amused. “What good is an abacus on a computer? There’s no point to it!” I persuaded him to try it out anyway. Reluctantly, he agreed. “It’s wrong,” he said when he saw it. “That’s a Japanese abacus, a soroban. Chinese ones have two beads in the top row; they’re called hsüan-pan. Sorobans are too easy.”
Figure 6: Chinese hsüan-pan
“I can fix that,” I said. “Just let me twiddle the resources.” Since the rods on the abacus were X widgets, all it took to configure them correctly was some judicious editing of a text file. “OK. Now try it.”
He played with the Chinese-style abacus for 10 or 15 minutes. Finally he looked at me. “You need keyboard accelerators.”
“Yes, but is it correct otherwise? Does it behave properly?”
“Sure. It’s good.”
“Huh. You mean I got it right? Without knowing how to use one?”
“Yes. Completely useless, but right.”
“Well,” I said. “Isn’t that what computers are good at? Wrong or irrelevant answers very fast?”
When I built my Mayan abacus in C, with X Windows, understanding the rules of the abacus was irrelevant. I expended the most effort on the user interface. Even though I knew C better than anyone I knew, using the language properly required a sustained level of conscious effort. The best analogy I can think of is something like a woodworker using a set of new, very complicated power tools to build a cabinet. A router to put the lip on doors, a drill press to make sure the screws holding the hinges go in straight, a planer to smooth the wood dead flat. ... You spend all your time setting up the jigs and tearing them down. All your time goes into the tools. There’s little, if any, time left over to concentrate on what to do with the cabinet after it’s done. You may well end up with a perfect cabinet, but in the end, what have you accomplished? You’ve learned a lot about power tools.
Python, though, gives you a small set of very sharp, very accurate, hand tools. Just knives, say, and maybe a nice simple plane. You learn how they work very quickly, so quickly that you forget you’re learning. You can build a cabinet with them, and at the end you may have the same cabinet you would have had using the power tools. But at the end, you don’t even know you’re using tools at all; and you may end up with more than a perfect cabinet. What do I mean by that? What can be more than perfect?
A beautiful cabinet. It works like the other cabinet, and may even hold the same items; but what have you put into it? Less effort, because you’re not thinking about the tools. Less worry, because you’re not thinking about how awful it would be to slice off your thumb. More mindfullness, because you’re thinking about the cabinet, not the tools. In Zen, when you eat a strawberry, you must eat the strawberry. If you build a cabinet, build the cabinet. And if you build an abacus, build the abacus.
This is so simple it must be cheating. But think about an abacus. What does it do? It gives you a frame on which to calculate. How do you calculate? Not by moving beads or beans on the framework, no. The frame and the beads only structure your thoughts, they don’t do the work for you.
The way an abacus works, the way the frame holds together, has been refined over thousands of years of tradition; it does nothing for you. You do the work; the abacus just remembers what you do. Like I said, it’s so simple it must be cheating.
It doesn’t matter if you’re clicking beads or moving beans. You work, you think. The abacus remembers. If you put the abacus on the computer, and you’ve done it right, it doesn’t have to be on the computer. What really happens, though, is that you change it to fit the machine. You can’t resist. You move a bean, the computer tells you the answer before you can do what you’re supposed to do according to the rules. You end up either never knowing or always forgetting the rules.
This is what calculators do. You may know the rules before you start, but you forget them. Or, you may never have known the rules, but now you will never know because the machine remembers them for you.
Who is thinking here? Not you; you don’t know the rules. Not the machine. It only knows the rules. So the one who did the thinking was whoever it was who put the abacus on the computer, the one who learned the rules enough to tell the machine what they were; the computerized abacus is just counting beans.
You can’t see this, you know, if you’re using tools that occupy your whole mind. You can only see it when you can forget the tools, when you become the thing you make. When there is no archer, no bow, no arrow and no target. “It shoots,” is all you can say.
In 1941, Sir J. Eric S. Thompson wrote, “Little attention has been paid to the methods the Maya may have employed in calculating dates in their complicated calendar. ... A knowledge of the system is not a matter of merely academic interest, for if we are ever to achieve a comprehensive reconstruction of Maya culture, we must have some insight into Maya mental processes.”
The Python version of the Mayan abacus doesn’t even count beans anymore. It just moves. Like the bean counters say, you’ll never get ahead if you can’t count beans.
Figure 7: The Python Mayan abacus
Here are Thompson’s “few simple rules.” I’ll have you know that extracting these rules from the “Maya Arithmetic” paper wasn’t easy. I like the way he writes, but it could never be called direct by any stretch of the imagination.
To follow these rules, you need some
basic training in the Mayan Calendar. Go to http://www.pauahtun.org/basic.html
and come back when you’re done. You don’t need to follow every link,
just absorb that page on its own.
To count an interval of 91 days in
the tzolk’in only, advance or retreat horizontally one day in the
To count forward 91 days from Ok, move the counter to ’Imix. Subtracting
moves from Ok to Kawak. “Forward” is defined as “to the left.”
The day number, or position in the
trecena, which in the case of
the date shown in Figure 7 above is “4,“ does not change for any multiple
of 91. This is because 91 is a multiple of thirteen. Thus,
to advance 819 days, you would count forward 9 day names to Muluk, and
the day number would stay at 4. To go 91 days from Ak’bal (bottom
left cell), you would wrap to ’Ix (top right cell).
Since 364 is a multiple of 91, it is easy to see that to move 364 days, one counts forward or backward by four positions in the veintena. From Ok, we would go forward to ’Ix, backward to Kimi. Looking at the image of the abacus in Figure 7, above, however, we can see that there is an easier way still. To go forward (or subtract) by 364 days, drop down (or up) one level and wrap if necessary (that is, 364 days forward from Ak’bal puts you at Manik). To go 728 days, go up or down by two levels, and so on. You can leap forward in multiples of 5 * 364 (1820 days) very easily. You stay on the same veintena day: Ahaw + 1820 days is Ahaw. Again, any calculation involving multiples of thirteen, such as 91 and 364, cause no shift in the trecena. Thompson refers to the 364-day period as the “computing year.”
The following table shows the relationships of Rules One and Two. The arrangement here is drawn directly from the Dresden Codex (page 32A), and the arrangement is carried over into the Python abacus, above.
Thompson talks about page 32A in “Maya Arithmetic,” here. He also used a different arrangement of day glyphs, and that can be seen here. The mathematical relatiionships are the same, regardless of layout, but the one in Thompson’s version of the abacus board suits Western ideas of arrangement, in that the “first” glyph (Ahaw) is first. The right-to-left working arrangement, though, is characteristic of Mayan mathematical tables in the codices.
To advance or retreat one unit of 20 * 364 days (7280 days), or Maya 22.214.171.124, in the haab, simply subtract or add one month. From 2 Ok 8 Ch’en, adding 7280 days gets us to 2 Ok 8 Mol. Notice that Mol is the month immediately preceding Ch’en in the list of months in Figure 7.
Let us suppose that instead of 2 Ok 8 Ch’en, we were on 126.96.36.199.10 2 Ok 3 Wayeb (Monday, April 15, 1963). What happens when we go forward 7280 days from there? The answer is 188.8.131.52.10 2 Ok 3 Kumk’u—exactly what we expect, according to Rule Four. Calculating the same distance backward, however, gives a little glitch. The date then becomes 184.108.40.206.10 2 Ok 18 Pohp. Wayeb, remember, is only five days long. Adding twenty days (one month) to 3 Wayeb takes you to 18 Pohp. 5 - 3 is two days, which uses up all the days in Wayeb, putting you at 0 Pohp. The remainder, 18 days, takes you to 18 Pohp.
Rule Four, then, is not quite as easy as Thompson makes it sound. A more accurate formulation is to say, instead of add or subtract one month for each 7,280-day unit, add or subtract 20 days per unit. If the distance moved crosses the 5-day Wayeb, then you must account for that in your day calculation.
Fractions of 364 days in the haab, says Thompson, are harder to handle. To move 91 days in the tzolk’in is fairly simple—see Rules One and Two. To move 91 days in the haab—add 91 days to the haab. That is, you add the 80 days as months, if you can, and the add the remainder, which is 11 days. Thus, to add 91 days to our example date above, 2 Ok 8 Ch’en, we would first apply Rule one, setting the date to 2 ’Imix. In the haab, add 4 months (we don’t cross Wayeb, so this won’t get us into trouble) and arrive at the month Mak. We would add eleven (our remainder) to 8, arriving at 19, giving us the final date of 2 ’Imix 19 Mak.
Adjustments must be made when crossing Wayeb. For instance, 91 days from 3 Wayeb is 3 Ok 9 Sek. 2 days use up Wayeb; 11 - 2 is 9, so we add four months (80 days) to arrive at 0 Sek and add the nine remaining days. You can use these same procedures to move smaller distances—simply decompose into lumps of 20 days and the remainder, being, as always, mindful of Wayeb (as were the Mayans, who considered it an unlucky time of the year).
Figure 9: Thompson’s abacus, showing 220.127.116.11.0 13 Ahaw 18 Kankin
If we must take Wayeb into account every time for Rules Four and Five, wouldn’t we have to do so for Rule Three also? The answer is, yes, of course we do. We have already seen that adjustments are required when adding 91 days to the haab position, if the distance traversed crosses Wayeb. For Rule Three, adjustments also need to be made. Let us suppose that we begin a calculation on 18.104.22.168.12 4 ’Eb 0 Pohp. If we add 364 days to that, we arrive at 22.214.171.124.16 4 K’ib 4 Wayeb. While Rules One and Two, which concern themselves only with the tzolk’in, do apply in all situations, Rule Three needs to state, again, that crossing any month boundary requires caution, and crossing Wayeb more so.
At this point, we have covered Thompson’s five rules about as thoroughly as possible. Memorize the rules and try creating an abacus that you can use on paper. At some point, I’ll be able to release the abacus shown in Figure 7.
Main web site: http://www.pauahtun.org