Autumn Equinox

September 21, 2012

Today is the autumn equinox, when the day and night are of equal lengths at the equator.

Your task is to write a program that calculates the length of the day and the night to show that they are of equal length. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Even a hypothetical spherical Earth doesn’t give equal day and night times at the equinox, in general. Wikipedia defines the equinox thus: “An equinox occurs twice a year (around 20 March and 22 September), when the tilt of the Earth’s axis is inclined neither away from nor towards the Sun, the center of the Sun being in the same plane as the Earth’s equator. The term equinox can also be used in a broader sense, meaning the date when such a passage happens.”

It says also that “The date at which sunset and sunrise become exactly 12 hours apart is known as the equilux. Because times of sunset and sunrise vary with an observer’s geographic location (longitude and latitude), the equilux likewise depends on location and does not exist for locations sufficiently close to the Equator. The equinox, however, is a precise moment in time which is common to all observers on Earth.”

Why doesn’t the equilux exist too close to the equator? Because sunrise occurs when the sun just barely begins to appear on the horizon (because of refraction, this occurs a little before the upper limb of the sun is actually tangent to the horizon). When the Earth has turned by an angle of π, the sun will be just about to start setting (around the equinox at the equator). It won’t actually set until the disk of the Sun just disappears behind the horizon (which occurs a little late because of refraction). Even ignoring refraction, the angular diameter of the Sun is about 31.6′–32.7′ (according to Wikipedia) (about 0.00919-0.009512 radians), so the day gets about half a degree more rotation than the night gets by simple geometry, and refraction makes it even longer. The lesson I just learned from this: the equilux isn’t directly tied to the equinox, and despite common usage, the equinox is best understood as an instant of alignment, rather than a particularly well-balanced day.