CHAPTER 10

Ingenious Mechanical Devices

One of the most illustrious figures in the history of Islamic mathematics is Abu’l Fath Umar ibn Ibrahim al-Khayyami (ca. 1048–ca. 1130). As his name indicates he was the son of Ibrahim al-Khayyami, whose last name means ‘the Tentmaker’. Thus in the West, where he is more famous as a poet than as a mathematician, he came to be known as Omar Khayyam, the ‘Tentmaker’.

Al-Khayyami was born in Nishapur soon after the Seljuk Turks conquered much of the ‘Abbasid empire, reaching the pinnacle of power by their capture of Baghdad in 1055. One of his teachers was the philosopher Bahmanyar, who had been a student of Ibn Sina. By his own testimony, al-Khayyami also studied the writings of Ibn al-Haytham, al-Khazin, al-Buzjani, al-Farabi, Ibn Sina and other renowned Islamic scholars, as well as the works of Aristotle, Archimedes, Euclid, Apollonius and Ptolemy.

But apparently the conditions under which al-Khayyami lived early in his career were so precarious that he had little time to study and do research, as he notes at the beginning of his Demonstration of Problems of Algebra: ‘I was unable to devote myself to the learning of this al-jabr [algebra] and the continued concentration upon it, because of obstacles in the vagaries of Time which hindered me; for we have been deprived of all the people of knowledge save for a group, small in number, with many troubles...’

Nevertheless, during this difficult early period of his life al-Khayyami was able to write two treatises on mathematics, one of them a treatise entitled Problems on Arithmetic, now lost, as well as a short work on the theory of music.

Around 1070 al-Khayyami settled in Samarkand, where under the patronage of the chief justice Abu Tahir he wrote his great treatise on the Demonstration of Problems of Algebra, which he had been planning for some time.

Then, at the invitation of the Seljuk sultan Jalal al-Din Malikshah and his vizier Nizam al-Mulk, al-Khayyami was invited to Isfahan, where in 1074 he was appointed court astrologer and director of the royal observatory. He remained in Isfahan for eighteen years, during which time he completed a supplement to his treatise on algebra, while he also directed a programme of calendar reform that included the compilation of a set of astronomical handbooks with tables called the Zij Malikshahi.

Malikshah’s third son Sanjar succeeded to the throne in 1118 and moved the capital of the Seljuk sultanate to Marw in Khorasan. Al-Khayyami moved from Isfahan to Marw and joined the sultan’s court, which became a centre of Islamic learning. During his years in Marw, al-Khayyami wrote a number of treatises in mathematics, philosophy and mechanics, the latter works done in collaboration with his disciple al-Khazini. His contemporary al-’Arudi al-Samarqandi says that he met al-Khayyami at Balkh in AH 506 (1112–13 AD).

Al-Samarqandi goes on to say that al-Khayyami died in his native Nishapur in AH 526 (1131 AD), when he would have been around eighty-three.

Al-Khayyami’s Demonstration of Problems of Algebra was for many years – until the publication of a work by Sharif al-Din Tusi, which went beyond al-Khayyam’s research – considered to be the culmination of Islamic research in this field, going beyond that of al-Khwarizmi to include cubic equations. He points out at the beginning of his treatise that he is breaking new ground in mathematics. ‘One of the mathematical notions needed in the part of philosophy known as mathematics is the art of Algebra, which has been invented in order to determine the numerical and the geometrical unknowns. And it contains species... whose solution has been impossible for most of those who examined them. As for the Ancients, no statement about these has come down to us from them.’

In his treatise on algebra al-Khayyami uses both arithmetic and geometric methods to solve quadratic equations, employing a scheme of intersecting conics to solve cubic equations, an approach first taken by Archimedes and later by Ibn al-Haytham. As al-Khayyami wrote in this regard: ‘Whoever thinks algebra is a trick in obtaining unknowns has thought it in vain. No attention should be paid to the fact that algebra and geometry are different in appearance. Algebras are geometric facts which are proved.’

Al-Khayyami refers to his lost work on arithmetic in his treatise on algebra, where he refers to what he calls the Hindu methods for finding fourth, fifth, sixth and higher powers of a binomial.

I have written a book to prove the validity of those methods and to show that they lead to the required solutions, and I have supplemented it in kind, that is, finding the square of the square, and the qudrato-cube, and the cubo-cube, however great they may be; and no one has done this before; and those proofs are only algebraic proofs based on the part of the book of the Elements.

Al-Khayyami is apparently referring to the triangular array of the binomial coefficients generally known as Pascal’s triangle, which was presented by al-Kharaji in the eleventh century, by al-Samaw’al in the twelfth century, by the Chinese mathematician Yang Hui in the thirteenth century, by Petrus Appianus and Niccolo Tartaglia in the sixteenth century and in 1655 by Blaise Pascal.

Another important mathematical thesis by al-Khayyami is his Commentary on the Difficulties of Certain Postulates of Euclid’s Work, which he completed toward the end of 1077. This is divided into three books, the first dealing with the theory of parallel lines, the second with the concepts of ratio and proportionality, and the third with the compounding of ratios.

Al-Khayyami’s plan for calendar reform is known only from references to it in the astronomical tables of Nasir al-Din al-Tusi. The system, known as the Jalali calendar, was presented to Sultan Malikshah ca. 1079 and was used throughout the Seljuk era, which ended in the thirteenth century. It was used in astronomical handbooks for centuries and then officially reintroduced in 1925 by Reza Shah Pahlavi as the calendar of Iran. It is still used in Iran and in the central Asian republics, as well as in the Kurdish areas of other countries in the region.

The Jalali calendar begins on the day after the vernal equinox and ends on the day of the next vernal equinox, except on leap years, when an intercalary day is added periodically to correct for accumulated error. There are eight leap years in every cycle of thirty-three years, with an extra day in years 4, 8, 12, 16, 20, 24, 28 and 33. This makes the average length of the year 365.2424 days, a difference of 0.0002 days from the astronomical calendar, amounting to an error of one day in 5,000 years. By way of comparison, the modern Gregorian calendar, which was first used in 1582, has an average year length of 365.2425 days, giving an error of one day every 3,333 years.

Al-Khayyami refers to his calendar in one of the quatrains of his Rubaiyat, first translated into English in 1859 by Edward Fitzgerald, perhaps the best evidence that these poems were actually written by him:

Ah, but my Computations, People say

Reduced the year to better reckoning? – Nay,

‘Twas only striking from the Calendar

Unborn Tomorrow, and dead Yesterday.

Al-Khayyami also wrote two treatises on mechanics, both of them concerned with the use of scale balances in weighing objects accurately. The first is entitled The Book of the Balance of Wisdoms, On the Art of Defining Quantities of Gold and Silver in a Body Consisting of Both, in which he determined the specific weights of the two substances by weighing them in both air and water, a method first used by Archimedes. The second is entitled On Right Balance, about the use of a scale balance with movable weights. Both of these treatises were included in a work by al-Khayyami’s follower Abu’l Fath ‘Abd al-Rahman al-Khazini entitled Kitab mizan al-hikma, or The Book of the Balance of Wisdom, completed in 1121–2, his best-known work, which has been described as ‘One of the most remarkable books on mechanics, hydrostatics, and physics of the Middle Ages’.

Al-Khazini flourished in Marw during the years ca. 1115–30. Originally a slave-boy of Byzantine origin, possibly a eunuch, he seems to have been a high government official under the Seljuk sultan Sanjar (r. 1118–57), during which time Marw became a centre of literary and scientific activity.

The word mizan in the title of al-Khazani’s book comes from the Arabic word for ‘justice’ in the sense of equipoise, as in the weights in equilibrium on a balance, described by al-Khazini in his introduction:

This just balance is founded upon geometrical principles and deduced from physical causes, in two aspects: 1) as regards centers of gravity, the most elevated and noble division of the mathematical sciences, which is knowledge that the weights of heavy things differ according to the distance they are placed from a fulcrum – the foundation of a steelyard; and 2) knowledge that the weights of heavy things differ according to the rarity or density of the fluids in which the thing weighed is immersed – the foundation of the mizan al-hikma.

The Book of the Balance of Wisdom is an encyclopedia of medieval mechanics and hydrostatics, including commentaries on the writings of earlier scholars from Euclid and Archimedes to Thabit b. Qurra al-Biruni and al-Khayyami. The topics covered in the encyclopedia include theories of the lever and the concept of centre of gravity; measurements of specific gravities of fifty substances, including both liquids and solids; determination of the constituents of alloys; the mechanisms of the steelyard and other balances, including that of al-Khayyami and one attributed to Archimedes, and the measurement of time using a clepsydra, or water-clock.

One of the water-clocks described by al-Khazini, known as the Universal Balance, had a steelyard balance in which the outflow clepsydra was suspended on the end of the short arm, while hanging from the graduated long arm there were two weights, one large and the other small. As the water flowed out the two weights were adjusted to maintain equilibrium, with the position of the large one giving the hour of day and the small one the minutes. The encyclopedia also establishes standards of measurement, discusses capillary action and describes ingenious mechanical automata.

Al-Khazini was also a distinguished astronomer. His most important work in this field was the Sanjar Zij, the astronomical tables he compiled for Sultan Sanjar, which also includes interesting information on various calendars as well as lists of religious holidays, fasts, rulers and prophets, concluding with tables of astrological quantities. Another of his writings on astronomy is a Treatise on Instruments. This is in seven parts, each devoted to an astronomical instrument, with instructions for its use as well as explanations of its geometrical basis.

Another Greek scientific tradition that flourished in late medieval Islam was the making of automata. Islamic work in this field culminated with the inventions of Badi al-Zaman Abu’l-Izz Ismail ibn al-Razzaz al-Jazari (fl. ca. 1200), following in the tradition of Ctesibus and Hero of Alexandria and Philo of Byzantium, as well as that of the Banu Musa. Badi al-Zaman means ‘Prodigy of the Age’, which he was indeed, while al-Jazari refers to his homeland, al-Jazira, or Mesopotamia.

Al-Jazari’s only extant work, The Book of Knowledge of Ingenious Mechanical Devices, translated and annotated by Donald R. Hill, was published in 1974. Hill’s introduction to Banu Musa’s work on automata, which he translated and annotated, gives a summary of the Banu Musa’s inventions, 100 in number. These include fountains, self-trimming oil-lamps, an automatic musical instrument, a ‘gas mask’ for use in polluted wells, a mechanical claw for excavating in river beds and trick vessels for dispensing liquids, the latter comprising eighty per cent of the total. According to Hill:

In design and operation these are very similar to the devices described by Philon and Heron, and are certainly derived from these. Use is made of pipes, jacketed siphons, cone-valves, taps and air-holes; many of the devices are quite ingenious. The main difference between the Banu Musa devices and those described by the Greek writers, apart from the greater complexity of the former, is that the Banu Musa make use of properly fitted cone-valves, whereas Philon and Heron mention only crude clack-valves and plate valves.

All that is known of the life of al-Jazari comes from his own statement in the introduction he wrote for his work. There he says that when he wrote the book he was in the service of Nasir al-Din, the ruler of the Turcoman Artukid emirate. He notes that he had been in the service of the emir’s family for twenty-five years, beginning in AH 577 (1181–2 AD), which means that his book was completed ca. 1206. He tells of how the emir asked him to write the book after he had presented him one of his mechanical devices:

I was in his presence one day and had brought him something which he had ordered me to make. He looked at me and what I had made and thought about it, without my noticing it. He guessed what I had been thinking about, and unveiled unerringly what I had concealed. He said ‘you have made peerless devices, and through strength have brought them forth as works; so do not lose what you have wearied yourself with and have plainly constructed. I wish you to compose me a book which assembles what you have created separately, and bring together a selection of individual items and pictures.’

Al-Jazari goes on to say that his book describes fifty devices, which he calls specimens, each of which makes up a separate chapter. These are divided into six categories, with ten chapters in each of the first four and five each in the fifth and sixth. The book has 173 illustrations, ranging from rough sketches and mechanical drawings to miniature paintings.

Category I is ‘On the construction of clocks from which can be told the passage of the constant and solar hours by means of water and candles.’ The ten devices in this category are the castle water-clock, the water-clock of the drummer, the water-clock of the boat, the elephant water-clock, the beaker water-clock, the water-clock of the peacocks, the candle-clock of the swordsman, the candle-clock of the scribe, the monkey candle-clock and the candle-clock of the doors.

Al-Jazari describes these clocks in minute detail, as for example in the chapter on the castle water-clock, which is divided into ten sections, the first of which, the Introduction, describes the appearance and operation of the device, in which he says he ‘followed the method of the excellent Archimedes’.

As al-Jazari describes the clock, which is in the form of a castle doorway: ‘Above the door, in a lateral straight line, are 12 doors, each of which has two leaves which are closed at the beginning of the day. Below these, and parallel to them are 12 [more] doors, each with one leaf, which all have the same colour at the beginning of the day. Below the second set of doors is a frieze projecting one fingerbreadth from the edge of the wall.’ He goes on to say that a crescent moon moves along the ledge in front of the doors. On either side of the wall below the ledge, a bird with outstretched wings stands in a niche, and below each of them is a vase containing a cymbal. Between the two niches are 12 glass globes arrayed around the arch of the castle doorway. Below there are the figures of two drummers, two trumpeters and a cymbalist. Above the castle doorway there is a semicircle whose periphery is decorated with 6 of the 12 zodiacal signs, those visible at any time, and below them are spheres representing the sun and moon.

At the beginning of the day the crescent moon moves along the frieze, and as it does so various figures appear in the upper doors while the lower doors change colour. At the same time each of the two birds drops a ball from its beak onto the cymbal in the vase below ‘and the sound is heard from afar’. He goes on to say that ‘This happens at the end of every hour until the sixth, at which time the drummers drum, the trumpeters blow and the cymbalist plays his cymbals for a while. This occurs also at the ninth and twelfth hour.’ Meanwhile the spheres representing the sun and moon show their positions among the signs of the zodiac, the lunar sphere also exhibiting the cyclical phases of the moon.

After the Introduction, the successive sections of Category I are entitled: The water-reservoir; Construction of the flow regulator; Installation of the instruments; Device of the circle for the outflow of water; On the place in which the apparatus is installed and the functioning of the instruments; On the means for imparting motion to all the things mentioned so far; On the means for imparting movements to the hands of the drummers and the cymbalist, and the sound for the trumpeters; Construction of the spheres of the zodiac, the sun and the moon.

Chapter 7 of Category I describes the candle-clock of the swordsman. Al-Jazari says in his introduction to this chapter that ‘I have never come across a work by anyone on candle-clocks and have never seen a completed [example of such a] clock.’ He then describes the appearance of his candle-clock, a tall brass candle-holder of fine workmanship, upon which is a brass sheath.’

Near its foot is a falcon erect up a perch. Its back and the back of its head are against the sheath and its wings are outspread. Towards the top of the sheath is a bracket projecting about the length of a finger from the sheath and on this is a black slave. His legs are hanging down and in his right hand is a sword, [held] against his chest. His left hand is on the bracket. On the candle, towards its tip, is a cap, hollow underneath, with the wick projecting from it.

He then goes on to describe how the clock marks the passage of the hours during the night:

The wick is lit at nightfall, and part of it is burned away, [another] rises to take its place. When a constant hour has passed the falcon lets fall a ball from its beak on to the floor of the pedestal of the candle-holder, and the slave strikes the wick with his sword, removing the portion that has burned away, and so for every hour till morning. The passage of the hours of the night can be told from the number of balls.

Category II is ‘On the construction of vessels and figures suitable for drinking sessions.’ The ten chapters in this category describe various trick vessels and automata designed to amuse the emir and his boon companions at their drinking sessions. The first of these is described by al-Jazari as ‘a goblet that arbitrates at drinking parties’, i.e., decides which of the guests will take the next drink, making sure that he finishes it.

As al-Jazari describes it, the goblet, made of silver or brass, stands on a tall pedestal and is covered by a fretted lid with a dome surmounted by a bird with an open beak. The steward brings the goblet into the dining-room and sets it down in the middle of the assembly. Then he pours the wine slowly on to the lid, letting it flow through the fretwork. As he does so the bird rotates and emits a shrill whistle until the vessel is nearly full, whereupon he stops pouring. The bird comes to rest and stops whistling: its head is pointed toward one of the party, to whom the steward hands the goblet. The guest drinks from the goblet and when he is finished he hands it back to the steward. But if there is any wine left in the goblet the bird whistles and the steward does not accept the glass but tells the guest to drink what is left. Only when all the wine is emptied does the bird remain silent, in which case the steward will take the goblet. Al-Jazari assures us that even ‘If a mere 5 dirhams remain in it the bird will whistle. This will happen even if a hundred sips are taken from the goblet without emptying it completely.’

Category III is ‘On the construction of pitchers and basins and other things for hand-washing and phlebotomy.’ Seven of the ten chapters in this category describe pitchers or basins used by the emir and his guests for washing their hands before dinner parties, while the other three are descriptions of basins used in phlebotomy, or blood-letting. The most famous of the first type is the Peacock Basin, which al-Jazari describes in chapter 9. The basin took its name from a mechanical peacock that spouted water from its beak when one of the emir’s guests stood before it to wash his hands, with the figure of a slave emerging to offer some powdered soap, after which another mechanical slave held out a towel so that he could dry his hands.

Chapter 5 of Category III is a description of one of the devices designed by al-Jazari for use in phlebotomy, in which the amount of blood taken from the patient is measured accurately and displayed on a graduated scale. The device is a deep circular basin with a flat rim. In the centre is a platform on which there is the figure of a monk holding a staff whose end rests on the rim of the basin whose periphery is marked with numbers ranging from zero to 120. As blood is taken from the patient it flows into the basin and raises the level of the platform. As it does so the platform rotates, causing the end of the monk’s rod to move along the graduated scale and measures the volume of blood. ‘And so on up to 20 dirhams and 30 dirhams up to 120 dirhams, according to the quantity to be extracted from the patient.’

Category IV is ‘On the construction in pools of fountains that change their shapes at known intervals, and of machines for the perpetual flute.’ Six of the ten chapters in this category deal with fountains that change their shape at regular intervals, such as varying the number and shape of their jets, while the other four describe devices in which a tube of water is made to play like a flute. All of these devices make use of so-called tipping-buckets, containers that tip over when they are full and discharge all of the water they contain into a tank.

Chapter 1 describes one example of the first type of fountain: ‘It is a fountain in a pool: the water shoots up from it in a single vertical jet for the space of one constant hour, then it changes and shoots up for the space of an hour in six curving jets. Then it changes and emits a single jet, and so on, for as long as the water flows into it.’

In Chapter 7 al-Jazari describes a flute-playing device: ‘It is an instrument for a perpetual flute with two spheres, one of whom is silent while the other blows, then the one who was blowing falls silent and the one that was silent blows. Also the flautist plays continuously on the pool, [where] there are figures of various types of musicians.’

Category V is ‘On the construction of machines for raising water from pools, and from wells which are not deep, and from running streams.’ One of these, described in Chapter 3 and illustrated with a miniature, shows the wooden figure of a cow, which moves around the periphery of a copper disk turning two sets of gears, one of which turns a wheel that has two ropes on it carrying jars. As al-Jazari describes it: ‘The ropes go over the back of the wheel and are immersed in the water of the pool in the usual manner. The water discharges from the jars into an irrigation channel inside the wheel, and the water runs there from wherever is desired.’ He goes on to say that the machine ‘is beautiful to behold, with upper wheels, splendid craftsmanship, elegant shapes, and handsome design. The ropes are silken, the jars delicate and painted with various colours, as are the wheels, the cow and the disc.’

Category VI is ‘On the construction of miscellaneous devices.’ One of the most interesting of these is in Chapter 3, which describes ‘A lock for locking a chest by means of 12 letters of the alphabet.’ This is the earliest-known example of a combination lock, which first appears in England early in the seventeenth century. As Donald R. Hill notes: ‘It is interesting to observe that the wheels in the Butterworth combination lock (about 1846 AD) are strikingly similar to the discs used by al-Jazari.’

Another interesting automata appears in Chapter 5, where al-Jazari describes the operation of an automata that may be the world’s first alarm clock. The device is in the form of a brass boat, in the middle of which there is the standing figure of a sailor holding an oar with his left hand while his right hand holds a flute to his lips. A hole in the bottom of the boat allows water to leak in so that in exactly one hour it will be submerged, at which point the sailor’s flute emits a loud whistle. This awakens the owner if he is sleeping, as al-Jazari explains: ‘If the observer forgets about it, it may sink without him noticing, so he does not know how much time is elapsed. So I made this device so that he will know from the pipe that the boat has sunk, and will wake from his doze at the sound.’

In the conclusion to his edition of The Book of Knowledge of Ingenious Mechanical Devices, Hill describes it as ‘one of the earliest manuals of engineering practice that has come down to us.’ He goes on to say of al-Jazari that ‘He was a master craftsman, fully conversant with all branches of his trade, consciously proud of his membership in the technical fraternity. More rarely, he was a master craftsman who could write, and who has left us an engineering document of the first importance.’

Some of his inventions later reappeared in the West, including his conical valve, mentioned by Leonardo da Vinci, and patented in England in 1784, more than five centuries after it had been made by al-Jazari as part of one of his ingenious mechanical devices.