3
$\begingroup$

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.

The example in the book say:

Calculate the times of sunrise and sunset (upper limb) over a level horizon at sea-level on 10 March 1986, as observed from Boston, Massachusetts, at longitude 71.05º W and latitude 42.37º N. We shall take the Sun's angular diameter to be 0.533 degrees, its horizontal parallax to be 8.79 arcseconds, and the refraction due the atmosphere as 34 arcminutes and, having added on half of the Sun's angular diameter and a small correction for parallax, we arrive at a total vertical shift at the horizon of the upper limb of 0.833333 degrees. The time zone correction is -5 hours.

In the book:

Rise: 6h 6m 0s
Set:  17h 43m 0s

With my implementation:

Rise: 6h 4m 2.98s
Set:  17h 39m 41.28s

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 IAU but, again, without success.

Where can I find those formulas?

The online calculators are:

https://www.satellite-calculations.com/

https://clearskytonight.com/projects/astronomycalculator/sun/sunrisesunset.html

https://www.neoprogrammics.com/de405_usno_ae98/DE405_Sun.php

https://ssd.jpl.nasa.gov/horizons.cgi

UPDATE

I repeat my question because it seems that there is something that it is misunderstood:

Where can I find the formulas adopted by the IAU?

$\endgroup$
9
  • 1
    $\begingroup$ Can you link to the three online calculators that you are using? $\endgroup$
    – James K
    Dec 21, 2021 at 21:27
  • $\begingroup$ Here is one written in Javascript, so you can walk through the code. celestialprogramming.com/risesetalgorithm.html $\endgroup$ Dec 22, 2021 at 1:47
  • 1
    $\begingroup$ You might like to look at this article on calculating the Equation of Time by Hughes, Yallop, & Hohenkerk (1989) . academic.oup.com/mnras/article/238/4/1529/1037665#92137115 I was playing around with that stuff earlier this year, and noticed some minor differences with the constants used by Duffet-Smith. $\endgroup$
    – PM 2Ring
    Dec 23, 2021 at 8:21
  • 1
    $\begingroup$ There is no "IAU approved" formula (nor is there a need for that). $\endgroup$ Dec 23, 2021 at 9:11
  • 1
    $\begingroup$ The IAU doesn't produce, or adopt formulae, algorithms or ephermides. Why do you suppose that they do? $\endgroup$
    – James K
    Dec 23, 2021 at 9:47

4 Answers 4

4
$\begingroup$

The IAU does provide a C library called "Standards of Fundamental Astronomy" at http://www.iausofa.org/ which states "The principal function of the SOFA Astronomy Library is to provide definitive algorithms" (on http://www.iausofa.org/2021_0512_C/sofa/sofa_lib.lis).

The library even includes limited-precision Ephemerides under the "Ephemerides (limited precision)" section of the same link: http://www.iausofa.org/2021_0512_C/sofa/sofa_lib.lis

However, they don't provide a definitive formula for sunrise/sunset.

You might be thinking of the SPICE libraries at https://naif.jpl.nasa.gov/naif/aboutspice.html which should give you the same precision as NASA's official computations at https://gml.noaa.gov/grad/solcalc/

The page above also links to https://gml.noaa.gov/grad/solcalc/calcdetails.html which provides a simpler formula, but notes that it's fairly inaccurate.

Finally, you may want to visit Where can I find the positions of the planets, stars, moons, artificial satellites, etc. and visualize them? which lists many other resources

$\endgroup$
1
$\begingroup$

James K mentioned one possible source of difference: calculating the Sun's position at one time and using that position to calculate the sunrise and sunset. When I do that with my own code, I get these results:

  • Sun's position at 0 hr Eastern time (5 hr UT)
  • Rise: 6:03
  • Set: 17:42

When I include the Sun's motion during the day, I get these results:

  • Sun's position interpolated to time of rise/set
  • Rise: 6:04
  • Set: 17:46

My position of the Sun is based on this reference: Jean Meeus, Astronomical Formulae For Calculators, 4th Edition, 1988.

As mentioned in a comment, differences of a minute are not too significant due to the variability of the real event.

$\endgroup$
4
  • $\begingroup$ I have implemented the previous 48 formulas and, in all of them, I get the same result. Now, I don't, so there is a problem with the formula or with my implementation. This is why I am asking: "Where can I find those formulas?" And nobody has answered that question yet. $\endgroup$
    – VansFannel
    Dec 23, 2021 at 7:58
  • 1
    $\begingroup$ I do not have the Duffett-Smith book, but I assume it uses the standard method of finding the time when the Sun is 0.833 degrees below the horizon. The details of the method are in many sources such as the Jean Meeus book and the Astronomical Almanac. You can also use the other formulas in the Duffett-Smith book to check if your time is correct! Also, if your code is the same as in the book but gives different results than the book, then the result in the book is wrong. (You should be happy if your results are within a minute of JPL Horizon's website.) $\endgroup$
    – JohnHoltz
    Dec 23, 2021 at 18:59
  • $\begingroup$ My results are within less than a minute with the Apparent RA & DEC. $\endgroup$
    – VansFannel
    Dec 23, 2021 at 19:28
  • 1
    $\begingroup$ @Vans If your RA & DEC are good, then I suppose you need a better model for the figure of the Earth. Also see the various definitions of latitude. $\endgroup$
    – PM 2Ring
    Dec 24, 2021 at 3:10
1
$\begingroup$

What you ask for doesn't exist. The IAU has not adopted any particular formula.

If you are getting different answers from the implementation in the book then your implementation is wrong (or the book's implementation is wrong)

If you are getting different answers from those on the internet, there are several possible reasons. Differences like the ones you see here may be the result of:

  • Different choice of atmospheric parameters (how much refraction)
  • Different definition of "sunrise" (upper limb touching horizon vs centre vs lower limb)
  • Different model. As far as I'm aware, the IAU doesn't do solar system models, but NASA do. Their model is called DE440 it is based on numerical integration of the planets' movements. Another is called VSOP (it was created by the French Bureau de Longitudes) and is based on proper Keplarian elements. However both achieve sub milli-arcsecond accuracy, so can't account for differences of a minute or more. USNO also publish ephemeris.
  • Failing to use the model correctly for example calculating the solar RA/Dec at 00:00 on the day in question, and then finding when that point crosses the horzion.

Of the various uncertainties, the one that I think is most likely to be causing the variation is the atmospheric model, as this has a significant effect on rise times and is genuinely variable.

As for the algorithms found in the calculators, you can read their javascript source. For example the satellite site uses the algorithm at http://www.stjarnhimlen.se/comp/riset.html

$\endgroup$
6
  • 1
    $\begingroup$ Nobody sane does sunrise / sunset to the second because atmospheric conditions can make sunrise / sunset time change by over a minute. $\endgroup$ Dec 22, 2021 at 14:13
  • $\begingroup$ Re Another is called VSOP (it was created by the French Bureau de Longitudes) and is based on osculating Keplarian elements. That's icorrect. The VSOP is based on "proper elements". Osculating elements are pretty much worthless. $\endgroup$ Dec 22, 2021 at 14:14
  • $\begingroup$ Thanks but I am asking about the formulas adopted by the IAU. $\endgroup$
    – VansFannel
    Dec 23, 2021 at 7:59
  • 1
    $\begingroup$ An IAU approved algorithm doesn't exist. I'll edit to make that clear. $\endgroup$
    – James K
    Dec 23, 2021 at 9:49
  • $\begingroup$ But even so, your answer doesn't answer my question. $\endgroup$
    – VansFannel
    Dec 23, 2021 at 12:24
0
$\begingroup$

Answering your main question: if you were to correct the text in the book you would word it differently, deleting all the mentions of parallax except for a single sentence saying there is such a thing but it's negligible for calculating the Sun's rise and set time. No one's going to run aground because of that small a correction, or even notice it, so it's not worthy of being reworded or mentioned in a future errata list.

Then, for your C++ library, someplace in your documentation, you should say that the major uncertainty is refraction. "34 arcminutes" is what you'd see if the center of the pupils of your eyes were exactly at sea level. If they weren't (they never are), you'd have to adjust, reduce, the correction factor, and you'd have to add in the dip correction which is part geometry and part a second refraction correction. Both of those factors need to be adjusted for temperature and atmospheric pressure. Don't go there. Don't try to be that precise. No one cares much about the exact minute the Sun peeks above the horizon. The various twilight times are more important, giving an idea of what you can do before sunrise and after sunset.

$\endgroup$

You must log in to answer this question.

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