While the motions of the planets are affected by perturbations due to the influence of each other's gravity, these perturbations are relatively small. Thus, for some purposes, such as constructing a mechanical astronomical clock, it is sufficient to calculate a planet's motion according to Kepler's Laws, as though one was dealing with the two-body problem.
To calculate the position of a planet in this way, one begins with M, the mean anomaly. That is the average position of the planet in its orbit, as an angle from perhelion, and in the plane of its orbit. That is calculated, of course, by taking the mean anomaly for some starting time, plus the mean motion times the amount of time after that starting time.
The next step in handling an elliptical orbit is to calculate the eccentric anomaly, E. It is related to the mean anomaly by the formula:
M = E + e sin E
with e being the eccentricity of the orbit. Since e is small, although this formula is not invertible, E can be calculated iteratively, using M as an approximaton to E:
E1 = M - e sin M E2 = M - e sin E1 E3 = M - e sin E2 ...
The actual angle between the planet and the line of perhelion, the true anomaly, A, can then be calculated simply from the eccentric anomaly by the formula:
___________ / / \ | / E \ / 1 - e | A = 2 atan | tan | --- | / --------- | | \ 2 / / 1 + e | \ \/ /
As what is usually sought is the planet's apparent position from Earth, its position needs to be converted to Cartesian (rectangular) coordinates, which means that its distance from the Sun is also needed. That is given by the formula
r = a ( 1 - e cos E )
where r is the distance sought, e is the eccentricity and E the eccentric anomaly, as before, and a is the semi-major axis of the orbit.
Conversion from polar to rectangular coordinates, and making use of the inclination of the planet's orbit to the ecliptic and its ascending node to convert to ecliptic coordinates from those of the plane of its own orbit is just standard trigonometry.
In the case of the Moon, the influence of the Sun's gravity in addition to that of the Earth is strong enough that even a basic approximation to the Moon's motion must take account of perturbations.
Two obvious ones are that the Moon's nodes make a complete circle around the Earth in 6793.48 days in a retrogade direction, and the positon of the Moon's apogee circles the Earth in 3232.6 days in a direct direction.
But just taking these two additional factors into account would not produce even a basic approximation of the Moon's position. To do so, several other factors need to be considered:
The evection, also called the second equation (the first equation being the equation of the centre, that is, the adjustment for the fact that the Moon's orbit is elliptical, which is the factor we have already dealt with above in the calculation of the true anomaly from the mean anomaly) was discovered by Ptolemy. This correction to the Moon's motion can be considered to be a periodic change in the eccentricity of its orbit. It is a function of the angle between the Moon's apogee and the Sun's position. When either the apogee or the perigee is in the same direction from the Earth as the Sun, the eccentricity of the Moon's orbit is at its maximum, and when the two directions are at right angles, the eccentricity is at a minimum.
The variation was discovered by Tycho Brahe. It is a function of the angle between the angle between the Sun and the Moon as seen from Earth, and thus reflects the direct effect of the Sun's gravity on the Moon's motion around the Earth. Like the tides, this depends on the difference between the Sun's gravity in two locations; at the Moon's center and at the Earth's center. The parallactic inequality, discovered by Newton, is also a function of this angle, essentially a higher-order term in the variation, reflecting the fact that the Sun is at a finite distance from the Earth, and so the variation would become zero when the angle between the Moon and the Sun is somewhat less than 90 degrees.
The annual equation was also discovered by Brahe. It is a function of the angle between the Earth and the Earth's perhelion from the Sun, as it reflects the change in the strength of the perturbing effect of the Sun's gravity.