Problem Description
Here's a program that calculates the dates and times of
new and full moons for any given start date and number of
months.
Background & Techniques
The moon travels around the earth about once every 29 1/2 days.
(Actually about once every 27 1/2 days but it seems like 29 1/2 to us for
reasons we'll explore in a moment.) It's path around the
earth is tilted approximately 5 degrees from plane of the earth's orbit
about the sun. This means that when the moon is on the far
side of the earth, away from the sun, then we are looking directly away from the sun
as we view the moon and the full disk is lit up (a full moon). Half a revolution later, the moon
is between us and the sun and the side facing us is not illuminated at
all (a new moon). This also explains why the full moon
shines nearly all night - just about the time we turn away from the sun
(sunset), the moon is just coming into view. Similarly,
the new moon rises and sets at about the same time as the
sun.
Now about the 27.5 day to 29.5 day cycle discrepancy. The
moon happens to rotate around the earth in the same direction as the earth
rotates about the sun. This means that 27.5 days after,
say a full moon, the moon has made a full circuit of the earth, but the
earth has moved forward about 27.5/ 365 (=.075) of its circuit about
the sun so the moon is lagging behind where it needs to be in order to
appear directly opposite the earth In fact the moon will
have to make up about .075 of its circuit to again be directly away from
the sun. This will take .075x27.5 or 2.1 days, making the
apparent lunar cycle about 29.6 days!
By the way, the same reasoning explains why while days seem to be
24 hours long and years average 365.25 days, alien observers
from outer space would see that we actually take only about 23 hours
and 56 minutes to rotate 360 degrees and that we actually make
366.25 revolutions on our axis per circuit of the sun!
Programmer's Notes
The actual calculation of dates of the new and
full moons is based on Basic code I converted from Peter Duffett-Smith's
book "Astronomy with your Personal Computer", Cambridge
University Press, 1990. Duffett-Smith, in turn, attributes the
routine to Meuss's book "Astronomical Formulae for Calculators"
Moon calculations, like all planetary
calculations, tend to be messy because of the effect of gravity which is
always speeding things up, or slowing them down. And since the
earth's orbit is elliptical about the sun, the amount of speeding
up/slowing down also varies depending on our distance from the
sun. The approximations in this program calculate the time of
the new and full moons within 2 minutes. Duffet-Smith's more
accurate "Moon" subroutine calculates the position of the moon
within a few arc-seconds, but uses "the first 53 terms in
longitude, 47 in latitude, and 31 in horizontal parallax" of the
harmonic series used to represent the position of the moon as a function
of time. Now that's messy!
Running/Exploring the Program