<blockquote>
<p>This equation - which really has nothing to do with the Sun specifically (and hence my question trigger) - does seem to assume a constant declination.</p>
</blockquote>
<p>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.</p>
<p>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 &quot;<a href="https://hsm.stackexchange.com/q/6347/3869">writing with feathers using light from burning animal fat</a>&quot; or in a spreadsheet, and for each you'd calculate how far off you are from this equation being correct. In other words:</p>
<p><span class="math-container">$$\Delta = \tan(\text{declination})\tan(\text{latitude}) \pm \cos(\text{hour angle})$$</span></p>
<p>where the <span class="math-container">$\pm$</span> distinguishes between rising and setting and <span class="math-container">$\Delta$</span> is some indicator of how far away the time of this line in the spreadsheet is from the correct time.</p>
<p>It's not linear but it's at least monotonic near the correct time.</p>
<p>You'd then find the two lines where the sign of <span class="math-container">$\Delta$</span> 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 <a href="https://en.wikipedia.org/wiki/Binary_search_algorithm" rel="nofollow noreferrer">binary search</a> or if you can take derivatives <a href="https://en.wikipedia.org/wiki/Newton%27s_method" rel="nofollow noreferrer">Newton's method</a> or if in Excel there is even a <a href="https://support.microsoft.com/en-us/office/use-goal-seek-to-find-the-result-you-want-by-adjusting-an-input-value-320cb99e-f4a4-417f-b1c3-4f369d6e66c7" rel="nofollow noreferrer">goal seek</a> function.</p>
<p>So:</p>
<ol>
<li>Get an ephemeris for declinations and hour angles for times spaced before and after the expected timeframe</li>
<li>Iterate and converge on a solution by either finding the zero crossing of <span class="math-container">$\Delta$</span> and asking for more ephemeris points, or using some kind of <a href="https://en.wikipedia.org/wiki/Interpolation" rel="nofollow noreferrer">interpolation</a>, either linear or otherwise.</li>
</ol>

CC BY-SA 4.0
2022-05-16T07:33:24.537Z
Thanks. By the way, I think I'll take the spreadsheet over "writing with feathers using light from burning animal fat".
d_e
CC BY-SA 4.0
2022-05-15T23:55:56.583Z
2022-05-15T23:55:56.583Z
uhoh
<p>The standard <a href="https://en.wikipedia.org/wiki/Sunrise_equation" rel="nofollow noreferrer">Sunrise Equation</a> (refraction neglected) is this:</p>
<p><span class="math-container">$$ \cos(\text{hour angle}) = \tan(\text{declination})\tan(\text{latitude}) $$</span></p>
<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2022-05-15T19:15:09.663Z
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.
Greg Miller
CC BY-SA 4.0
2022-05-15T19:28:33.313Z
@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).
d_e
CC BY-SA 4.0
2022-05-15T21:52:05.053Z
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.
JohnHoltz
CC BY-SA 4.0
2022-05-15T23:03:45.727Z
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.
Greg Miller
CC BY-SA 4.0
2022-05-16T03:57:06.617Z
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](https://en.wikipedia.org/wiki/Sunrise_equation) has a correction for elevation (including refraction), but I don't know how good it is. ;)
PM 2Ring
CC BY-SA 4.0
2022-05-16T04:11:43.020Z
Wikipedia links to https://www.siranah.de/html/sail040o.htm which gives a good description of the problem of refraction for celestial bodies near the horizon.
PM 2Ring
<declination><sunrise>
What is the "sunrise equation" for non-constant declination component?
d_e
# What is the "sunrise equation" for non-constant declination component?

(Asked by: username_0 on 2022-05-15)

The standard [Sunrise Equation](https://en.wikipedia.org/wiki/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.

**Tags:** declination, sunrise
> **Comments:**
> **username_1**: 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.  
> **username_0**: @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).  
> **username_2**: 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.  
> **username_1**: 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.  
> **username_3**: 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](https://en.wikipedia.org/wiki/Sunrise_equation) has a correction for elevation (including refraction), but I don't know how good it is. ;)  
> **username_3**: Wikipedia links to https://www.siranah.de/html/sail040o.htm which gives a good description of the problem of refraction for celestial bodies near the horizon.  

---

## 1 answers

### Answer by username_4 on 2022-05-15. Score: 2 | Accepted answer

> 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](https://hsm.stackexchange.com/q/6347/3869)" 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](https://en.wikipedia.org/wiki/Binary_search_algorithm) or if you can take derivatives [Newton's method](https://en.wikipedia.org/wiki/Newton%27s_method) or if in Excel there is even a [goal seek](https://support.microsoft.com/en-us/office/use-goal-seek-to-find-the-result-you-want-by-adjusting-an-input-value-320cb99e-f4a4-417f-b1c3-4f369d6e66c7) function.

So:

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](https://en.wikipedia.org/wiki/Interpolation), either linear or otherwise.

> **Comments:**
> **username_0**: Thanks. By the way, I think I'll take the spreadsheet over "writing with feathers using light from burning animal fat".  

---

