I thought how to mathematically compute prayer times? Then I found that calculations of prayers times are more complex than I imagined.

Do you think that Douhr at 1 JAN 2005 is at the same time of 1 JAN 2008 for the same location?

Do you think that prayer times are the same for locations of the same longitude for the same date?

Are there any parameters other than date and location that could be taken into account when calculating prayers times?

What about prayers times for locations near poles where day can be as long as months?

Let's start by Douhr:

Douhr starts after midday. Computation of Douhr time depends on the location and the date:

L is longitude of the location in degrees.

EQT is equation of time.

Z is Douhr time in hours.

Since Time zone and L are constant over time i.e. depends only on location, the only time varying element is EQT equation of time which is defined as the difference between Local Apparent Time and Mean Solar Time in minutes. Time measured from sundial is the Local Apparent time while Mean Solar time is that of a clock. This difference arose from the fact that the earth's orbit around sun isn't a circle, but an ellipse. Other reason is the angle of obliquity which is the angle between that the plane of the Equator and the plane of the Earth's orbit around the sun.

You can notice that there are 4 days of zero EQT Apr 15, Jun 14, Sep 2 and Dec 25.

Accurate calculation of EQT depends on the Julian day which a count of days since Jan 1 4713 BC. Some EQT graphs are inverted, simply add EQT to equation of Z instead of subtraction.

A good approximation of Equation of time:

EQT = 229.18*(0.000075+0.001868*cos(rads) - 0.032077*sin(rads) - 0.014615*cos(2*rads) - 0.040849*sin(2*rads))

Fajr and Isha:

Fajr and Isha depend on Duhr as follows:

Fajr = Duhr – Tw(Ө)

Isha = Duhr + Tw(Ө)

Tw(Ө) is the period from noon till a twilight angle Ө.

Twilight: earth's atmosphere scatters sun light. In the absence of atmosphere on earth there would be no sunlight after sunset and before sunrise. So, Twilight causes gradual decrease of sunlight.

Twilight angle is the angle between line reaching sun's center and the horizon. Sun's center must be below it.

Greater twilight angle leads to earlier Fajr and later Isha.

This table represents conventions used to choose twilight angle

Convention | Fajr Angle | Isha Angle |

Leva Research Institute, Qom, Iran | 16 | 14 |

University of Islamic Sciences, Karachi | 18 | 18 |

Islamic Society of North America (ISNA), USA | 15 | 15 |

Muslim World League (MWL) | 18 | 17 |

Umm al-Qura, Makkah, Saudi Arabia | 19 | 90 mins after Maghrib |

Egyptian General Authority of Survey | 19.5 | 17.5 |

To imagine twilight go to seaside at sunset and observe the sun gradually disappears , when you see the center of the sun at the horizon level , then the twilight angle is just near 0. Now the sun disappears and still sunlight is observable, that's twilight. Twilight ends when no sunlight is seen. The same can be done at sunrise.

Tw(Ө) is the period from noon till a twilight angle Ө:

Where lat is latitude of the position.

D is declination angle.

Calculation of D depends on location and Julian date.

Other approximation for Declination angle is:

D = 0.006918 - 0.399912*cos(rads) + 0.070257*sin(rads) - 0.006758*cos(2*rads) + 0.000907*sin(2*rads) - 0.002697*cos(3*rads) + 0.00148*sin(3*rads)

Sunrise (Shrook) and Sunset (Maghrib):

Similar to Fajr and Isha but with twilight angle of 0.8333.

Sunrise = Duhr – Tw(0.8333)

Sunset = Duhr + Tw(0.8333)

Sometimes more accurate measures can be obtained by taking into account height above sea level.

Where H is height above sea level in meters.

Asr:

According to Shafii, Hanbaly and Maliky mathab Asr starts when the length of an object's shadow equals the its length plus the length of its shadow at noon. While to Hanafi mathab Asr starts when the length of an object's shadow equals twice its length plus the length of its shadow at noon.

So ,

Asr = Z + offset

Where Mathab = 1 for Shafaii and 2 for Hanafi.

Summary:

To compute prayer times we need:

- Know the location (latitude - longitude), time zone and date.
- Compute Julian day, equation of time and declination angle.
- Start by Douhr.
- Then, compute Maghrib and sunrise.
- After that, compute Fajr and Isha using appropriate convention.
- Finally, compute Asr according to desired mathab.

References:

Some astronomical facts:

http://www.astronomicalfacts.com/article.html

The real helpful and correct source about prayer times.

http://www.ummah.net/astronomy/saltime/

Julian day and Equation of time calculator Javascript! Get its source to know method of calculation!

http://www.go.ednet.ns.ca/~larry/orbits/jsjdetst.html

Declination angle, sunrise, sunset PHP calculations step by step!

http://users.electromagnetic.net/bu/astro/iyf-calc.php