# Computing Approximate Solar Coordinates

Given below is a simple algorithm for computing the Sun's angular coordinates to an accuracy of about 1 arcminute within two centuries of 2000. The algorithm's accuracy degrades gradually beyond its four-century window of applicability. This accuracy is quite adequate for computing, for example, the times of sunrise and sunset, or solar transit. For navigational purposes it would provide about 1 nautical mile accuracy. The algorithm requires only the Julian date of the time for which the Sun's coordinates are needed (Julian dates are a form of Universal Time.)

First, compute D, the number of days and fraction (+ or –) from the epoch referred to as "J2000.0", which is 2000 January 1.5, Julian date 2451545.0:

where JD is the Julian date of interest. Then compute

Mean anomaly of the Sun: | g = 357.529 + 0.98560028 D |

Mean longitude of the Sun: | q = 280.459 + 0.98564736 D |

Geocentric apparent ecliptic
longitude of the Sun (adjusted for aberration): |
L = q + 1.915 sin g + 0.020 sin 2g |

where all the constants (therefore g, q, and L) are in degrees. It may be necessary or desirable to reduce g, q, and L to the range 0° to 360°.

The Sun's ecliptic latitude, b, can be approximated by b=0. The distance of the Sun from the Earth, R, in astronomical units (AU), can be approximated by

Once the Sun's apparent ecliptic longitude, L, has been computed, the Sun's right ascension and declination can be obtained. First compute the mean obliquity of the ecliptic, in degrees:

Then the Sun's right ascension, RA, and declination, d, can be obtained from

sin d = sin e sin L

RA is always in the same quadrant as L. If the numerator and
denominator on the right side of the expression for RA are used in a
double-argument arctangent function (e.g., "atan2"), the proper quadrant
will be obtained. If RA is obtained in degrees, it can be converted to
hours simply by dividing by 15. RA is conventionally reduced to the range
0^{h} to 24^{h}.

Other quantities can also be obtained. The Equation of Time, EqT, apparent solar time minus mean solar time, can be computed from

where Eqt and RA are in hours and q is in degrees. The angular semidiameter of the Sun, SD, in degrees, is simply

This algorithm is essentially the same as that found on page C5 of
*The Astronomical Almanac*; a
few constants have been adjusted above to extend the range of years for
which the algorithm is valid.

Graphs of the angular error of this algorithm can be viewed by clicking on the links below. Each PDF graph shows the difference in arcseconds between this algorithm and an accurate reference ephemeris, as a function of year. The reference ephemeris is DE405 from the Jet Propulsion Laboratory.

Equatorial coordinates (PDF, 283K) – right ascension (red) and declination (green)

If the algorithm given here is not sufficiently accurate, other easy-to-implement ephemerides of the Sun (along with those of the Moon and major planets) can be found in:

- Chapront-Touze, M. & Chapront, J. 1991,
*Lunar Tables and Programs from 4000 BC to AD 8000*(Richmond, VA: Willmann-Bell, Inc.) - Bretagnon, P. & Simon, J-L 1986,
*Planetary Programs and Tables from –4000 to +2800*(Richmond, VA: Willmann-Bell, Inc.)

Alternatively, the Multiyear Interactive Computer Almanac (MICA), an application for PCs and Macs, computes coordinates of the Sun, Moon and planets to better than 0.1-arcsecond accuracy. It provides almanac data in tabular form, at any time interval, for the years 1800 through 2050.