The Science of Salah: Understanding Astronomical Calculations
In the late fourteenth century an astronomer named Shams al-Din al-Khalili sat in the Umayyad Mosque in Damascus and computed, entry by entry, tables of thousands of hand-calculated values. Their purpose was not navigation or astrology: they existed so that the people of Damascus — and, because al-Khalili built them to work at any latitude, the people of anywhere — would know when to pray and which way to face. He held a salaried mosque post for it: muwaqqit, the timekeeper. The number your phone shows for Fajr tomorrow is the last link in that chain.
Why Prayer Turned Muslims Into Astronomers
The obligation is unusually demanding as a piece of engineering. The Quran does not fix worship to clock readings but to moments in the sky:
"Indeed, prayer has been decreed upon the believers a decree of specified times." — Quran 4:103
The Sunnah defines those moments observationally — dawn's spreading whiteness, the sun's decline from its meridian, a shadow's growth to a stated multiple, the disappearance of the disk, the fading of the red twilight — and the Prophet ﷺ was taught the boundaries directly, Jibril leading him at the earliest and latest limit of each prayer on two successive days (Tirmidhi 149).
That specification is fine for one town with clear horizons. It becomes a mathematical problem the moment the community spreads from Andalusia to the Indus, because every marker depends on latitude, on the date, and on the sun's declination — three variables no rule of thumb handles well. Add the Qibla (a spherical-geometry problem in its own right, covered in how the Qibla direction is calculated) and the lunar calendar, and you have three permanent, empire-wide computational demands. Institutions grew to meet them.
Ninth Century: Tables Before Formulas
The earliest surviving Islamic prayer-time work is tabular rather than algebraic. Muhammad ibn Musa al-Khwarizmi (d. c. 850), whose Latinised name gave us algorithm and whose book al-Jabr gave us algebra, worked at Baghdad's House of Wisdom and produced a zij — an astronomical handbook of tables — along with treatises on the astrolabe and the sundial. His tables let a practitioner look up, rather than derive, the sun's position and the length of a gnomon's shadow.
That is the methodological signature of the whole tradition: for most of a millennium, "calculating prayer times" meant consulting a purpose-built table computed once by an expert, not solving an equation at the moment of need. What changed over the centuries was how accurate and how general those tables became.
Al-Battani and the Sharpening of Trigonometry
Al-Battani (d. 929), working from Raqqa in Syria, produced the Zij al-Sabi', a work later translated into Latin and used in Europe for centuries. He refined the value of the solar year and the obliquity of the ecliptic, and — decisively for prayer times — he worked with sines and tangents where Greek astronomy had worked with chords.
The shift matters more than it sounds. Ptolemy's chord tables made spherical problems clumsy. The sine, inherited from Indian astronomy (Sanskrit jya → Arabic jayb → Latin sinus), plus the tangent — which this tradition developed directly out of the shadow of a vertical gnomon, the zill, precisely the quantity Asr depends on — made them tractable. Asr's definition as a shadow ratio is not incidental to the history of the tangent function; it is one reason the function was tabulated so carefully.
Abu al-Wafa al-Buzjani (d. 998) then established results including the spherical law of sines, and Nasir al-Din al-Tusi (d. 1274) gave trigonometry its first treatment as a discipline independent of astronomy in his Treatise on the Quadrilateral. Historians of mathematics credit the maturing of spherical trigonometry to this lineage, centuries before it reached Renaissance Europe — and the applications motivating it were overwhelmingly religious.
Ibn Yunus and the Cairo School
Ibn Yunus (d. 1009), in Fatimid Cairo, compiled al-Zij al-Hakimi al-Kabir, notable for both the precision of its observations and the scale of its tables. He is associated with systematically tabulating the quantities a timekeeper actually needs — time elapsed since sunrise as a function of the sun's altitude, and the altitude corresponding to the start of each prayer — reducing a spherical-astronomy problem to a single lookup.
Al-Biruni (d. 1048) brought the other half of the discipline: measurement. He determined the Earth's radius from the dip of the horizon observed from a mountain in what is now Pakistan, and computed with his own geodetic data rather than inheriting numbers on authority — the same instinct behind a modern methodology page.
The Muwaqqit: Astronomy With a Payroll
By the thirteenth century, major mosques in Egypt, Syria and later the Ottoman lands employed a professional muwaqqit, distinct from the muezzin who called the adhan. The muwaqqit computed and maintained the times, checked the instruments, verified the Qibla, and advised on the lunar calendar.
This is a genuinely unusual arrangement in the history of science: a technical, mathematical office, embedded in a religious institution, salaried, and stable across centuries. It gave astronomers something research funding rarely provides — permanence. Three names show what that bought:
| Astronomer | Post | Contribution | |---|---|---| | Ibn al-Shatir (d. 1375) | Muwaqqit, Umayyad Mosque, Damascus | Built the mosque's great sundial; devised non-Ptolemaic planetary models whose geometry resurfaces in Copernicus | | Shams al-Din al-Khalili (d. c. 1397) | Muwaqqit, Umayyad Mosque, Damascus | Universal auxiliary tables solving timekeeping and Qibla problems for any latitude | | Al-Marrakushi (d. c. 1280) | Cairo | Comprehensive treatise on timekeeping instruments and gnomonics |
Ibn al-Shatir's day job was telling Damascus when to pray. His side effect was a planetary model that historians still argue about.
From Astrolabe to Algorithm
The instruments track the mathematics. The astrolabe — a flattened brass analogue computer of the sky — could be set for a date and latitude and read off to give the time from a single altitude measurement of the sun or a star. The sine quadrant (rub' al-mujayyab), a quarter-disc ruled with a trigonometric grid, was developed to make the timekeeper's daily computations fast. Sundials were cut with curves marking the onset of Dhuhr and Asr — not generic hour lines, but prayer lines.
Then came the observatories: Maragha in Iran (1259, under al-Tusi), Samarkand under Ulugh Beg in the 1420s, whose star catalogue was the most accurate produced before the telescope, and Istanbul under Taqi al-Din in 1577. Each refined the constants — the obliquity of the ecliptic, the solar year, the equation of time — that any prayer calculation depends on.
Modern implementations close the loop. Instead of an astrolabe you have a solar-position algorithm; instead of a zij, a numerical model of the sun's apparent motion. The quantities are the ones al-Khalili tabulated: solar declination, the equation of time, your latitude, the hour angle at which the sun sits at the required depression below the horizon. The surviving disagreements between methods — is Fajr at 18°, 17°, or 15°? — are not failures of astronomy but a genuine juristic and observational question, one that becomes acute at high latitudes where twilight never fully ends.
What Survived
The vocabulary is the receipt. Azimuth comes from as-sumut, zenith and nadir from samt and nazir, almanac from al-manakh; Aldebaran, Altair, Deneb and Betelgeuse carry Arabic names into modern star charts. Behind those loanwords sits a structural fact:
"It is He who made the sun a shining light and the moon a derived light and determined for it phases — that you may know the number of years and the account of time." — Quran 10:5
A religion that ties five daily obligations, a month of fasting and an annual pilgrimage to observable positions of the sun and moon cannot treat astronomy as optional. It has to build the discipline, staff it, and keep it honest for a thousand years. When you glance at a prayer time on a screen, you are reading the output of that project.