Continuing on the topic started in article Sunrise and sunset calculator.
Calculating the azimuth of the sun and its altitude above the horizon at any time at the point with given coordinates is on the agenda. We calculate azimuth from the north in a clockwise direction.
I used this algorithm. It was described by some good old Swede. He tried as hard as he could but casual person still wouldn't understand it. For example, I can still understand how we move from one coordinate system to another, but I can't get why the longitude of the perihelion of the Sun is calculated like that
, where d is - the number of days out of epoch J2000 - that's beyond my strength.
It seems like somewhere far away, in an ivory tower sitting the astronomers and calculating this and then all of us, mortals, use this then. Maybe some of these astronomers will explain things to us but for now we have to believe in all these magical numbers and perform the calculation.
Apparently, so does the majority of people.
There are some books that usually recommended to people on forums when somebody don't want to explain things and say "search there". I also would like to put these books here:
Jean Meeus. Astronomical algorithms
Peter Duffett-Smith. Practical Astronomy with your calculator.
As in the case of calculators of the time of sunrise and sunset, here are two calculators - the first uses the information about the coordinates and the time zone information from the directory of cities, i.e. you just have to choose the city and enter the time of observation, and the second allows you to set the coordinates and time zone manually. Information about the city can be added to the directory by the registered users.
Negative altitude above the horizon corresponds to the dark time of the day - the Sun is "under" the horizon. The intersection with the horizon in the morning occurs at the 90 degrees azimuth, from which you can make a bold conclusion that the Sun still rises in the East.
Paul Schlyter (that Swede) claims that the error in the calculations does not exceed one minute of arc for dates in the range from 1900 to 2100.