Continued fractions, music, and calendars

A couple of applications of continued fractions:

Equal temperament

The two most important intervals in Western music are the octave, corresponding to a frequency ratio of about 2/1, and the perfect fifth, corresponding to a frequency ratio of about 3/2. “Just” octaves and fifths are exactly 2/1 and 3/2, respectively. However, no combination of just fifths can ever equal a combination of just octaves; that is, (3/2) raised to any integer power can never equal (2/1) to an integer power (aside from the trivial case where both powers are zero). To obtain a closed tuning system, one usually tempers the fifth, adjusting it so that m fifths equal n octaves:

(2/1)n = fm

where f is close to 3/2. This can be rewritten

n log (2/1) = m log f

or

m / n = log (2) / log f

What one wants is values of m and n such that m / n is nearly equal to log (2) / log (3/2) = 1.70951129135… This looks like a job for continued fractions.

log (2) / log (3/2) = 1 + 1 / (1 + 1 / (2 + 1 / (2 + 1 / (3 + …))))

This gives successive approximations:

1 / 1 = 1.0000000…
2 / 1 = 2.0000000…
5 / 3 = 1.6666667…
12 / 7 = 1.7142857…
41 / 24 = 1.7083333…
53 / 31 = 1.7096774…

The first reasonably close approximation is 12 / 7, meaning that 7 just octaves is nearly equal to 12 just fifths; conversely, if you divide the octave into 12 equal parts and take 7 such parts as a tempered fifth, then 12 tempered fifths is exactly 7 octaves.

So an equal division of the octave into 12 parts gives a good approximation to a just fifth. It happens also to give adequate approximations to major and minor thirds (5/4 and 6/5). That’s why we use 12-equal temperament for most Western music today.

The continued fraction expansion shows you’d get a better approximation to a just fifth using a 41-equal division of the octave, and an extremely good approximation using 53-equal. Of course these divisions are considerably less practical for any mechanical instrument or controller.

This analysis is pretty simple, but in reality you might want a slightly worse approximation to a just fifth if it gets you significantly better approximations to thirds. Continued fractions can be generalized to find simultaneous good rational approximations to several different real numbers, and this can be applied to tuning theory, but not as cleanly as the above.

Calendars

The length of the mean tropical year is 365.242190419 days. Let’s consider successive approximations to this number using continued fractions:

365 / 1 = 365.00000000…: This says a year is about 365 days long, of course, and of course if every calendar year were 365 days, it would work well in the short term but get badly out of sync with the sun in a century or so.

1461 / 4 = 365 1/4 = 365.25000000…: This says 4 years is about 1461 days, which is the number of days in 3 standard years of 365 days plus one leap year of 366 days. If the calendar years are always in that pattern, they’ll be off by 0.00781 days per year or 0.781 days per century. That, of course, is the Julian calendar. The improvement of the Gregorian calendar was that century years are not leap years (subtracting one day per century, so the discrepancy now is 0.219 days per century) — except for years divisible by 400, which are leap years (adding back 0.25 days per century, for a discrepancy of 0.031 days per century).

10592 / 29 = 365 7/29 = 365.24137931… and 12053 / 33 = 365 8/33 = 365.24242424…: This says another way we could have done better than the Julian calendar would have to been to make an adjustment every 29 or 33 years. For instance, 12053 = 365 * 25 + 366 * 8, so if we did the 3 standard years, 1 leap year thing for 8 cycles, then did 1 standard year, and then repeated, we’d have a discrepancy of 0.0210 days per century. Of course this would be ridiculously confusing, and the benefit relative to the Gregorian calendar would be tiny.

46751 / 128 = 365 31/128 = 365.2421875…: If we did 3 standard years, 1 leap year for 32 cycles, that would be 46752 days. So if every 128 years we omitted a leap year, that would give us 46751 days, and the discrepancy would be 0.00029 days per century! This is 100 times more accurate than the Gregorian calendar. Of course, you’d lose the advantage of being able to tell at a glance whether a given year is a leap year or not, though that wouldn’t matter to most people most of the time.

Now, the length of the mean tropical year is not constant. It changes by about 5 ms per year, or about 0.00000006 days per year, or about 0.000006 days per century. Any calendar rule that claims to give discrepancies about this size or smaller is too accurate! The above 128-year calendar, then, is considerably more accurate than the Gregorian but nowhere near too accurate. Even so, don’t hold your breath waiting for its adoption…

The next approximation from the continued fraction series is 947073 / 2593 = 365.242190512, which is too accurate.

One Response to Continued fractions, music, and calendars

  1. Pingback: Leap | Doctroidal dissertations

Comments are closed.