I'm trying to make a game with high accuracy moon position so I followed some equations on geoastro.de Basics of Positional Astronomy and Ephemerides and with some help from the questions answers, I get the same result which they explained in the example.

but there is problem that is I calculate declination and right ascension by Pre-calculated values of ecliptic latitude and longitude and they didn't explain their equations or any thing about them.

I tried to search and ask, but I did not find anything, or I found very complex equations, and I don't think I will need this complexity.

So is there equation or resource that can help me to calculate declination and right ascension with limited information (Julian day and (T) number of Julian centuries since 2000/01/01 at 12 UT) or to calculate ecliptic latitude and longitude without very complex equations?

Equations of the moon altitude and azimuth:

1- Julian day = (365.25 * year) + (30.6001 * (month + 1)) - 15 + 1720996.5 + day + hour/24.0

2- T (number of Julian centuries since 2000/01/01 at 12 UT) = (JD - 2451545.0) / 36525.0

3- eps (obliquity of the ecliptic) = 23.0 + 26.0 / 60.0 + 21.448 / 3600.0 - (46.8150 * T + 0.00059 * T * T - 0.001813 * T * T * T) / 3600

Ecliptic latitude (B) = -1.87° (pre-calculated value)
Ecliptic longitude (L) = 131.52° (pre-calculated value)

4- delta (declination) = (180/PI) * arcsin[sin(eps) * cos(Ecliptic latitude) * sin(Ecliptic longitude) + cos(eps) * sin(Ecliptic latitude)]

5- RA (right ascension) = (180/PI) * arctan[(sin(Ecliptic longitude) * cos(eps) - tan(Ecliptic latitude) * sin(eps)) / cos(Ecliptic longitude)]
if arctan result is lower than zero add (PI) to arctan.

6- theta0 (sidereal time (degrees) at Greenwich) = 280.46061837 + 360.98564736629 * (JD - 2451545.0) + 0.000387933 * T * T - T * T * T / 38710000.0

7- theta (local sidereal time at longitude 10° E) = theta0 + longitude (eastern longitudes positive, western negative).

8- tau (local hour angle) = theta - RA

9- altitude = (180/PI) * arcsin[sin(latitude) * sin(delta) + cos(latitude) * cos(delta) * cos(tau)]

10- azimuth = (180/PI) * arctan2[- sin(tau) / (cos(latitude) * tan(delta) - sin(latitude) * cos(tau))]

Thanks for reading.

New contributor
Ahmed Dyaa is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • $\begingroup$ No but it helped me to get the right way to calculate alt & az and as I mentioned "and with some help from the questions, I get the same result which they explained in the example." But this time I have a problem with declination and right ascension and ecliptic latitude and longitude. $\endgroup$
    – Ahmed Dyaa
    Commented Jun 10 at 13:06
  • 1
    $\begingroup$ If you don't need high accuracy, why not just pre-generate the positions of the moon for say, every week for 100 years (using JPL Horizons), and linearly interpolate positions between the two? High accuracy algorithms are going to have a lot of terms. $\endgroup$ Commented Jun 10 at 14:23
  • $\begingroup$ I don't understand the question. lots of that is constants, like obliquity of the ecliptic. The others are either precalculated or a function of time, which you know. You say they give the right answer. Do you want to know how the equations are derived? $\endgroup$ Commented Jun 10 at 16:02
  • $\begingroup$ They used in example (that I put it's link) a pre-calculated values for ecliptic latitude and longitude to calculate declination and right ascension, what I want in my game is to calculate the position of the moon at specific date and time to do that, I must have equation for ecliptic latitude and longitude to calculate them at the specific date and time that I want OR to calculatedeclination and right ascension without ecliptic latitude and longitude, because I don't have them equation. $\endgroup$
    – Ahmed Dyaa
    Commented Jun 10 at 16:39
  • $\begingroup$ I think you are looking for simple analytical equations to predict where the Moon is but unfortunately you're going to be out of luck - the motion of the Moon is sufficiently complex that it has defied many attempts to make a simple, accurate theory. There are relatively simple low precision methods or much more complex high precision methods with hundreds of terms; you will need to decide what precision is acceptable for your use. Take a look at the link above which gives ecliptic lat & long and the sec. 8 after it and see if it meets the needs $\endgroup$ Commented Jun 11 at 9:53


You must log in to answer this question.