This tutorial explains how to calculate RIGHT ASCENSION (R.A.) & DECLINATION for the planets in the solar system and the sun using the Keplerian Elements.
The JS simulation will also use these calculated Celestial Coordinates to plot the Sun and the other planets on the Celestial Sphere.
If you haven't followed that JS tutorial yet, we recommend to do that first: TUTORIAL - PLANETS
I. RECAP ON CALCULATING KEPLERIAN ELEMENTS
Here is a refresher of the steps we took to calculate the Keplerian Elements (taken from TUTORIAL - PLANETS):
CALCULATE JULIAN DATE
First we took a Gregorian input date and converted it to a Julian Date.
GET KEPLERIAN ELEMENTS FROM JPL
Then we extracted the Keplerian Elements for the planets in our solar system for J2000 from the JPL website.
CALCULATE KEPLERIAN ELEMENTS FOR DATE
By combining (1) and (2), we can now calculate each of the planet's six Keplerian Elements for the input date.
CALCULATE MEAN ANOMALY
Now calculate MEAN ANOMALY, which is the angle measured from point of Perihelion if in circular orbit.
CALCULATE ECCENTRIC ANOMALY
Now resolve Kepler's Equation through an iterative method to get ECCENTRIC ANOMALY.
CALCULATE TRUE ANOMALY
Now calculate TRUE ANOMALY to get actual position of planet.
CALCULATE RADIUS VECTOR
Calculate the distance from the planet to the sun.
CALCULATE HELIOCENTRIC ECLIPTIC COORDINATES
Finally we can now calculate X, Y & Z coordinates of the planets on the Ecliptic Plane to use in our simulation.
II. CALCULATE RA & DECLINATION PLANETS
The additional steps required to calculate RA & DECLINATION for the planets (used for observations from Earth):
CALCULATE GEOCENTRIC ECLIPTIC COORDINATES
By subtracting the Earth's coordinates for the planet in question, you change the origin of coordinate system.
CALCULATE GEOCENTRIC EQUATORIAL COORDINATES
By taking into account the Earth's axial tilt of 23.43928° at J2000, we change the coordinate system again.
CALCULATE RIGHT ASCENSION (R.A.)
Now calculate RIGHT ASCENSION angle (and convert to hours, minutes, seconds if desired).
Finally, also calculate angle of DECLINATION (and convert to degrees, minutes, seconds if desired).
By looking at the complete source code of this tutorial, you will see all these steps executed in the described order. Credits for the calculations in this section go to Keith Burnett and David Colarusso.
III. CALCULATE RA & DECLINATION SUN
Now that we've done most of the work, there is one thing left to do. That is to calculate RA & DECLINATION for the sun.
Since the sun is at the center of our solar system, HELIOCENTRIC ECLIPTIC COORDINATES of 0,0,0 can be used. Use that as the "planet" input when calculating (9), (10), (11) & (12) for the sun.
Following the 12 steps described above, allow you to calculate the Celestial Coordinates for the planets and the sun.
The finished simulation on the right shows not only the calculated values for RIGHT ASCENSION and DECLINATION, but also demonstrates how the planets and sun move across the sky over time.
The apparent "sine wave" motion is caused by the axial tilt of the Earth (see "PATH OF SUN ACROSS SKY" section in GLOSSARY).