The standard Sunrise Equation (refraction neglected) is this:

$$ \cos(\text{hour angle}) = \tan(\text{declination})\tan(\text{latitude}) $$

This equation - which really has nothing to do with the Sun specifically (and hence my question trigger) - does seem to assume a constant declination. which is somewhat circular: since the declination of the Sun is not constant and given that we don't know the exact sunrise time we also don't know the exact declination. In the case of the Sun this error seems small and for practical proposes (especially with refraction and twilights) is probably quite good within seconds.

But, what about other bodies that move faster like the Moon, or if we pursue the theoretical accurate values? Maybe I'm lacking the correct terminology here, but I could not find any equation or a process if there is no analytical solution.

  • $\begingroup$ It does not assume a constant declination, it's just that it computes the values for a given declination. You would need a series of these plots for computations throughout the year. $\endgroup$ Commented May 15, 2022 at 19:15
  • $\begingroup$ @GregMiller, For me "computes the values for a given declination" and assuming constant declination is the same thing. the thing is the declination is given and fixed. The declination can indeed be given, for example, for May 16 2022 8:00 AM GMT. but this is not the accurate exact the date of the sunrise. At the still unknown time of the sunrise the exact declination is also unknown. Maybe few iterations will indeed do the job (if that's what you are alluding to). $\endgroup$
    – d_e
    Commented May 15, 2022 at 19:28
  • 1
    $\begingroup$ I do not have my computer with me so I cannot look up how I did it, but I know that I programmed routines to use 2 points to linearly interpolate or 3 points to do a quadratic interpolation. Linear worked well for the Sun and quadratic for the Moon. $\endgroup$
    – JohnHoltz
    Commented May 15, 2022 at 21:52
  • 1
    $\begingroup$ The edit makes it more clear what you're loooking for. The general method is to compute the RA/Dec for any time on the day you're interested in, then compute the Rise or set time based on that, then use the time from that to itterativley get a more precise answer. Not as big a deal for the Sun like you said, but the moon can vary by about an hour. $\endgroup$ Commented May 15, 2022 at 23:03
  • 1
    $\begingroup$ BTW, that equation also neglects the elevation of the observer, and the angular radius of the Sun. And it assumes the Earth is a sphere. Wikipedia has a correction for elevation (including refraction), but I don't know how good it is. ;) $\endgroup$
    – PM 2Ring
    Commented May 16, 2022 at 3:57

1 Answer 1


This equation - which really has nothing to do with the Sun specifically (and hence my question trigger) - does seem to assume a constant declination.

It might seem so but it doesn't. We can say that the equation is a necessary condition but it's not sufficient to solve the problem.

In practice you would get a list of hour angles and declinations for your object that bracket the expected time of rise or set either "writing with feathers using light from burning animal fat" or in a spreadsheet, and for each you'd calculate how far off you are from this equation being correct. In other words:

$$\Delta = \tan(\text{declination})\tan(\text{latitude}) \pm \cos(\text{hour angle})$$

where the $\pm$ distinguishes between rising and setting and $\Delta$ is some indicator of how far away the time of this line in the spreadsheet is from the correct time.

It's not linear but it's at least monotonic near the correct time.

You'd then find the two lines where the sign of $\Delta$ changes and start trying to converge on the time where it is close enough to zero (based on how accurately you need to know the rise/set time) using something simple like a binary search or if you can take derivatives Newton's method or if in Excel there is even a goal seek function.


  1. Get an ephemeris for declinations and hour angles for times spaced before and after the expected timeframe
  2. Iterate and converge on a solution by either finding the zero crossing of $\Delta$ and asking for more ephemeris points, or using some kind of interpolation, either linear or otherwise.
  • 1
    $\begingroup$ Thanks. By the way, I think I'll take the spreadsheet over "writing with feathers using light from burning animal fat". $\endgroup$
    – d_e
    Commented May 16, 2022 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .