These equations, from the Astronomical Almanac,
can be used to calculate the apparent coordinates of the Sun, mean equinox and ecliptic of date, to a precision of about 0°.01 (36″), for dates between 1950 and 2050.
Start by calculating n, the number of days (positive or negative) since Greenwich noon, Terrestrial Time, on 1 January 2000 (J2000.0). If you know the Julian date for your desired time then
The mean longitude of the Sun, corrected for the aberration of light, is:
The mean anomaly of the Sun (actually, of the Earth in its orbit around the Sun, but it is convenient to pretend the Sun orbits the Earth), is:
Put and in the range 0° to 360° by adding or subtracting multiples of 360° as needed.
Finally, the ecliptic longitude of the Sun is:
The ecliptic latitude of the Sun is nearly:
as the ecliptic latitude of the Sun never exceeds 0.00033°,
and the distance of the Sun from the Earth, in astronomical units, is:
, and form a complete position of the Sun in the ecliptic coordinate system. This can be converted to the equatorial coordinate system by calculating the obliquity of the ecliptic, , and continuing:
- , where is in the same quadrant as ,
To get RA at the right quadrant on computer programs use double argument Arctan function such as ATAN2(y,x)
Rectangular equatorial coordinates
In right-handed rectangular equatorial coordinates (where the axis is in the direction of the vernal point, and the axis is 90° to the east, in the plane of the celestial equator, and the axis is directed toward the north celestial pole
), in astronomical units:
Obliquity of the ecliptic
Where the obliquity of the ecliptic is not obtained elsewhere, it can be approximated:
for use with the above equations.