# Positional astronomy formulas

• Stargazing
• VansFannel
In summary, the online calculators do not seem to provide accurate results for the formula 49 in the book "Practical Astronomy with your Calculator or Spreadsheet, 4th edition".

#### VansFannel

TL;DR Summary
Help to find positional astronomy formulas
Hi,

I'm developing a C++ computer library with the formulas in the book "Practical Astronomy with your Calculator or Spreadsheet, 4th edition" but I have a problem with the formula 49, "Sunrise and sunset": I don't get the same results than in the book.

I've been searching to find online calculator to check if the book is wrong or I am wrong. I've found some but I can't get any conclusion because each of them returns a different value; i.e, if I have tried three, I get three different values for sunset and sunrise.

So, I have searched to find the formulas that these online calculator uses without success. I've been searching for the formulas adopted by the IUA but, again, without success.

Where can I find those formulas? or How can I know if I'm getting a good results?

Thanks.

Hello @VansFannel,

Welcome to PF! In future posts, it is helpful to actually post the equation in question, since most people reading your post won't have the specific book you are referencing.

For example, I only have the 3rd edition of Peter Duffitt-Smith, Practical Astronomy With Your Calculator, and I'm guessing that most people reading this don't have any edition at all.

According to my edition, I think the formula you are using is

$$\mathrm{GST = \frac{(24.07 \times GST1) - T00 \times (GST2 - GST1)}{24.07 + GST1 - GST2}}$$

where GST is the actual Greenwich sidereal time of the rising or setting, GST1 is the Greenwich sidereal time of the rising or setting calculated from the position appropriate to the midnight before, GST2 is the Greenwich sidereal time of the rising or setting calculated from the position appropriate to the midnight after, and T00 is the Greenwich sidereal time at 0h UT of the date in question (i.e., the midnight before).

The formula works by using the calculated coordinates for the two midnights straddling the required sunrise and sunset, and performs an interpolation between them.

The formula relies on some calculations from previous sections (sections 46 and 47), and the book says that the interpolation approach is expected to be accurate only to a few minutes of their correct values.

Are the values you are getting off by only a few minutes? if so, that may be the best that particular formula is going to get you. I'm guessing the online calculators might be more accurate (there are more accurate ways to determine the sunrises and sunsets, than what is presented in section 49 of the book).

[Edit: Section 49 also does some handwaving near the end of the section to improve accuracy, such as taking into account the refraction of Earth's atmosphere (section 37), geocentric parallax (section 38), and the finite diameter of the Sun's disk. Formulae for these improvements are not given in section 49, but they are something to think about if you wish to improve accuracy.]

[Another edit: I see now that there is a detailed example at the end of the section that includes some of these accuracy improvements.]

Last edited:
I think there are more accurate formulas out there, this is why I am asking about them. Do you know where are the formulas that the IAU is using?

With all the previous 48 formulas I get the same results than the book, this is the first formula where I don't get the same result.

You're only a few minutes different than the book. Again, without corrections, that simple equation in section 49 is only accurate up to a few minutes.

There's a detailed example in the book at the very end of section 49. This example implements many of the improved accuracy corrections (above and beyond the simple formula). It starts out:

[Edit: oops I originally quoted the wrong example. But you seem to be using the correct example]

It then goes on, calculating all the parameters discussed earlier in section 49, including the improved accuracy corrections it discusses at the end of the section.

Does your C++ program match the example? You should be able to trace through your program, step by step, and see where it differs from detailed example in the book. [If your implementation differs from the book, at which step do they diverge?]

Last edited:
Also, some of the online calculators you mentioned don't specify whether they base the sunrise/sunset times on the upper limb, lower limb, or the midpoint of the sun. These things will make a difference. It's anybody's guess how the author of any particular online calculator implemented their algorithm (unless they specify it publicly).

I recommend as a first step to make sure your C++ program agrees with the book. You can at least use that as a starting point, and go from there.

I get the same results in all the 48 previous formulas. This is why I am asking about the formulas adopted by the IAU, because I want to have something without errors to check with.

VansFannel said:
I think there are more accurate formulas out there, this is why I am asking about them. Do you know where are the formulas that the IAU is using?

No, I don't know specifically which formula the IAU uses. Does the IAU even have an online sunset/sunrise calculator?

I've looked at some of the links you've provided, but we're just making assumptions as to what parameters they use (are they using the upper or lower limb of the sun, or the center?).

The example in the book makes it clear that it's just an approximation. That said, it's my impression that sunrise/sunset times are not an exact science. It depends on what you consider "sunrise" and what you consider "sunset." And even then there can be other variables involved (elevation, atmosphere, etc.)

VansFannel said:
With all the previous 48 formulas I get the same results than the book, this is the first formula where I don't get the same result.

I understand. But exactly which step does your answer fall out of sync with the book's example. Again, the book's example is very detailed. There's 11 steps in the book's example, and each step can be divided into substeps. If there's a discrepancy, you should be able to tell where in the calculation process (i.e., which step) things start to disagree.

I don't asking if the book makes approximations or not. I said: "I get the same results than in the book in ALL the 48 previous formulas that I have implemented". So, it must be something wrong in the book or in my implementation, this is why I am asking about the formulas to compute the sunset and sunrise.

So, if you don't know the answer (to where to check the formulas), it is OK.

VansFannel said:
I don't asking if the book makes approximations or not. I said: "I get the same results than in the book in ALL the 48 previous formulas that I have implemented". So, it must be something wrong in the book or in my implementation, this is why I am asking about the formulas to compute the sunset and sunrise.

So, if you don't know the answer (to where to check the formulas), it is OK.

Right. I don't, as of yet, know where to check the formulas. It's a rather lengthy example and goes over many lengthy sections, previously mentioned in the book. (It would take quite a bit of effort for me to implement the entire set of previous 48 formulas just for this thread.)

But, but, that doesn't mean that myself or somebody else reading this thread (if they happen to have the book) can't help in verifying if there is something in the book's example that is wrong. It would really help though if you could tell us which part disagrees with your implementation.

For example, what does your implementation get for T00'? Does your implementation agree with the book up to that point? If so, what does your implementation get for, "the correction, $\Delta t$, due to parallax (subtractive), refraction (additive), and the Sun's finite diameter (additive)"? And if that's where things diverge, which substep? Things like that would help me (or anyone else) greatly in double checking the book's calculations.

Sorry to revive an old thread, but I came across this formula and don’t understand it. Where does it come from? I understand it is the interpolation, but why is the 24.07 multiplied in the numerator and added in the denominator?

milqyway said:
Sorry to revive an old thread, but I came across this formula and don’t understand it. Where does it come from? I understand it is the interpolation, but why is the 24.07 multiplied in the numerator and added in the denominator?

I'd have to dig out my book* again to be absolutely sure. But as I recall (without digging out the book), the 24.07 figure functions as the value of 1 solar day in units of sidereal minutes hours.

The rest is the algebraic solving for the variable "GST" after setting up an interpolation formula.

*(3rd edition of Peter Duffitt-Smith, Practical Astronomy With Your Calculator)

Last edited: