Wednesday, January 23, 2008

Calculating Muslims' Prayers Times

Calculating Muslims' Prayers Times

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.

Variation of EQT over the year

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))
This computation depends only on the day of year thus it's accurate only near 2005.

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.

Twilight before 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)

Variation of declination angle over the year

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:
  1. Know the location (latitude - longitude), time zone and date.
  2. Compute Julian day, equation of time and declination angle.
  3. Start by Douhr.
  4. Then, compute Maghrib and sunrise.
  5. After that, compute Fajr and Isha using appropriate convention.
  6. Finally, compute Asr according to desired mathab.
Try to work out these calculations by hand.


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

Tuesday, January 1, 2008

100 things we didn't know last year

100 things we didn't know last year



The bbc has a weekly tradition called "10 things we didn't know last week" to highlight some interesting and unexpected news and posts every week. Also other annually "100 things we didn't know last year" to highlight 100 things from the weekly ones.

The weekly 10 things can be always viewed at:

http://www.bbc.co.uk/blogs/magazinemonitor/10_things/


The 100 things we didn't know last year 2007 at:

http://www.bbc.co.uk/blogs/magazinemonitor/2008/01/100_things_we_didnt_know_last_3.shtml

These are some highlights of the last year:

  1. Saddam Hussein's codename while in US custody in 2004/5 was "Victor".
  2. Only about half of China's population can speak the national language, Mandarin.
  3. Serving anything more than tea and biscuits at a political meeting is an offence called "treating" and punishable by a year in prison or an unlimited fine, under the the Representation of the People Act 1893.
  4. Denmark is the happiest country in Europe; Italy the unhappiest. (The UK was 9th out of 15.)
  5. The secret to happiness is accepting misery.
  6. Nearly seven out of 10 (69%) of adults are still in touch with at least one childhood friend.
  7. CDs were nearly called mini-racks.
  8. The brain can turn down its ability to see in order to listen to complex sounds like music.
  9. Adults use maths skills 14 times daily on average and literacy skills 23 times a day.
  10. In Ethiopia the start of the year 2000 was celebrated in September.

And these are some shots from last years:

  1. The = sign was invented by 16th Century Welsh mathematician Robert Recorde, who was fed up with writing "is equal to" in his equations. He chose the two lines because "noe 2 thynges can be moare equalle".
  2. "Restaurant" is the most mis-spelled word in search engines.
  3. Cyclist Lance Armstrong's heart is almost a third larger than the average man's.
  4. It takes 75kg of raw materials to make a mobile phone.
  5. Bill Gates does not have an iPod.
  6. It takes less energy to import a tomato from Spain than to grow them in this country because of the artificial heat needed, according to Defra.
  7. The day when most suicides occurred in the UK between 1993 and 2002 was 1 January, 2000.
  8. You are 176 times more likely to be murdered than to win the National Lottery.
  9. Bill Clinton sent just two e-mails while he was president.
  10. Bill Clinton revealed in his autobiography that he didn't learn to ride a bike properly until he was 22.
  11. It's 30 years since the world's first barcode was used. It was on a 10-pack of Wrigley's Juicy Fruit at a supermarket in Ohio. The gum is now an exhibit in the Smithsonian Museum in Washington DC.
  12. Hexakosioihexekontahexaphobiacs is the term for people who fear the number 666.
  13. In America it's possible to subpoena a dog.
  14. Poets die young... "On average, poets lived 62 years, playwrights 63 years, novelists 66 years and non-fiction writers lived 68 years," according to California State University's James Kaufman.
  15. The Mona Lisa used to hang on the wall of Napoleon’s bedroom.
  16. The word "time" is the most common noun in the English language, according to the latest Oxford dictionary.
  17. In the 1960s, the CIA used to watch Mission Impossible to get ideas about spying.

And don't forget delay jitter is the variance of delay.

Last years 100 things:

http://www.bbc.co.uk/blogs/magazinemonitor/2006/12/100_things_we_didnt_know_last_2.shtml

http://news.bbc.co.uk/1/hi/magazine/4566526.stm

http://news.bbc.co.uk/1/hi/magazine/4134329.stm