diff --git a/contents/computus/computus.md b/contents/computus/computus.md index d82973d9c..6be87f2f6 100644 --- a/contents/computus/computus.md +++ b/contents/computus/computus.md @@ -2,24 +2,25 @@ Though the word *Computus* can technically describe any sort of computation {{ "bede725" | cite }} or else a set of medieval tables for calculating various astrological events {{ "dictcomputus" | cite }}, it is also one of the most common historical names for the calculation of the Christian holiday of Easter every year. Nominally, Easter happens the Sunday after the first full moon after the spring equinox (roughly March 21st). -This particular full moon is known by a number of names, such as the Pink (strawberry) Moon, Hunter's Moon, and the Snow Moon, along with several others. +This particular full moon is known by a number of names, such as the Pink (Strawberry) Moon, Hunter's Moon, or the Snow Moon, along with several others. The most common name for it is the paschal full moon, which translates to "Passover" in Greek and signifies an important Jewish festival. For the first few centuries, the date of Easter each year was dictated by the Pope; however, after the church grew, it was no longer straightforward to communicate this date to all of Christendom. -As such, the church did what they could to algorithmically generate tables for clergy to determine the date of Easter each year. +As such, the church did what it could to algorithmically generate tables for clergy to determine the date of Easter each year. To this day, the calculation of Easter still poses a problem, with western and eastern (orthodox) churches celebrating on different dates approximately 50% of the time. I'll be honest, there is a lot of good, Christian drama surrounding the calculation of this event and it's remarkably interesting to read about {{ "bien2004" | cite }}. Suffice it to say that the date of Easter bamboozled many historical scholars, with at least one algorithm appearing in the early archives of the now famous scientific journal of *Nature* {{ "computus1876" | cite }}. The calculation was so complicated that even Frederick Gauss had to try his hand at it (and failed before being corrected by one of his students). -As an important note, because Easter depends on the lunar cycle, the date of the paschal full moon is static in the lunar calendar. +Essentially, the date of Easter depends on both the lunar and solar cycles +The date of the paschal full moon, for example, is static in the lunar calendar, but it is not in the solar calendar. In this way, computus is the act of mapping a lunar cycle onto the Gregorian (solar) calendar everyone knows and loves. Because many different calendar systems have existed throughout history, there was a natural question as to *which* calendar system would be used to calculate the precise date of Easter. -The western churches chose the Gregorian calendar and the eastern chose Julian. -The Gregorian calendar more accurately represents the true date of the paschal full moon; however, this is one reason why western and eastern churches sometimes celebrate on different dates. +The western churches chose the Gregorian calendar and the eastern churches chosethe Julian one, and this is one reason why western and eastern churches sometimes celebrate on different dates. +That said, the Gregorian calendar more accurately represents the true date of the paschal full moon, so the western church's approach ended up being more precise. -Though there are many methods to calculate Easter, for now, we will focus only on Gauss's algorithm; however, we will certainly come back (in subsequent years) to incorporate other Easter algorithms. +Though there are many methods to calculate Easter, for now, we will focus only on Gauss's algorithm; however, we mayl certainly come back (in subsequent years) to incorporate other Easter algorithms if there is demand. These algorithms are some of my favorite gems in the history of algorithm design because of all the drama surrounding the calculation of something that seems trivial! After all, how hard could it be to calculate Easter? @@ -32,7 +33,7 @@ The legend goes that Gauss actually did not know his real birthday in the Gregor Apparently, his mother only told him that he was born on a Wednesday 8 days before Ascension Day in 1777, which corresponds to April 30th {{ "bien2004" | cite }}. Honestly, Gauss's Easter algorithm was the 19th century equivalent of undocumented code. -I could imagine Gauss grumpily "patching" his method when users complained that it did not work on dates past 4200 or certain dates within his own era. +I could imagine Gauss grumpily "patching" his method when users complained that it did not work on dates past 4200 or even certain dates within his own era! When some of his compatriots (such as Johann Lambert and Jean Joseph Delambre) expressed their concern over the method's performance, Gauss replied by saying, > The investigation by which the formula [...] is found is based on higher arithmetic, for which I presumably cannot refer to any publication. @@ -45,7 +46,7 @@ One of the most important fans of Gauss's work was Servois, who created a calend Servois' 1800 table This calendar shows the date the paschal full moon, indicating that Easter will be the following Sunday {{ "servois" | cite }}. -In this table, a value greater than 22 indicates the full moon will be on the presented number in March and a value less than 22 indicates the full moon will be on that date in April. +In this table, a value greater than 22 indicates the full moon will be on the presented number (date) in March and a value less than 22 indicates the full moon will be on that date in April. The $$y$$-axis of this table indicates the decade and the $$x$$-axis indicates the precise year. Admittedly, the notation is a bit funky, but it was 1813. Times were different then. @@ -59,14 +60,15 @@ For this reason, before discussing the algorithm, itself, we must first introduc The Gregorian (solar) calendar has been created to mark Earth's full revolution around the Sun, which is approximately 365.2425 days. Unfortunately, days are based on the Earth's rotation about its axis, not its revolution around the Sun, so the number of days in a year is not an integer number (such as 365). This discrepancy has actually lead to a large number of calendar systems, including one invented by Gauss, himself {{ "standish2004" | cite }}. -Before the Gregorian calendar, there was a correction was made from the old Roman calendar to be 365.25 days, creating the Julian calendar. +Before the Gregorian calendar, there was another correction made from an old Roman calendar to set the days in a year to be 365.25 days. +This was called the Julian calendar. From there, the Julian calendar was further corrected to the Gregorian calendar with 365.2425 days. -Though there is a small change necessary to use Gauss's Easter algorithm for the Julian calendar, this will not be covered here; however, if you want to see this, we can add it in upon request. +Though there is only a small change necessary to use Gauss's Easter algorithm for the Julian calendar, this will not be covered here; however, if you want to see this, we can add it in upon request. To account for the non-integer nature of the Gregorian year, a leap day is celebrated on February 29th every 4 years, with exception of when the year is a multiple of 100, where no leap-day is observed; if the year is divisible by 400, however, a leap day is still observed. This means that every 400 years, there are 97 leap days. -This is why a leap day was celebrated in 2020 and 2000, but was not celebrated in 1900. -If at this point, you feel like the calendar system you know and love is held together by duct tape and string, you would be right. +This is why a leap day was celebrated in 2020 and 2000, but was not in 1900. +If at this point, you feel like your favorite calendar system is held together by duct tape and string, you would be right. In addition to the solar year, Gauss's Easter algorithm also needs to keep the lunar year into account. A lunar month corresponds to the time it takes the Moon to complete one full revolution around the Earth. @@ -82,8 +84,9 @@ Below, we also show a snapshot of this simulation after 6 synodic months: Synodic half year Here, we show an outline of the Earth and Moon in an arbitrary initial position, each with an angle of $$-\frac{\pi}{4}$$ from the horizontal axis. -In addition, we show the location of the Moon and Earth again after 6 synodic months. -In both positions, the Moon is hidden behind the Earth, creating a full moon phase. +In addition, we show the location of the Moon and Earth again after 6 synodic months and additional outlines for each intermediate synodic month. +Red lines are drawn from the center of the sun to the moon to indicate the positioning of the moon in relation to the sun and earth. +In all positions, the Moon is hidden behind the Earth, creating the full moon phase. In this way, the synodic month is the time between two consecutive phases, which is slightly longer than the time it takes to revolve around the Earth and return to the same angle (here $$\frac{\pi}{4}$$). Each synodic month is approximately 29.5 days, so a synodic year of 12 lunar months is 354 days, which is 11 days shorter than the normal 365 days in a Gregorian year. The following is a pictorial representation of offset between a solar and lunar year: @@ -91,17 +94,26 @@ The following is a pictorial representation of offset between a solar and lunar Full year Here, we see the Sun at the center, with the Earth and Moon starting the year at an angle of $$-\frac{\pi}{4}$$ from the horizontal axis. -The initial location of the Earth and Moon are initially shown as an outline with an A at their center. +The initial location of the Earth and Moon are shown as an outline with the letter "A" at their center. After a full synodic lunar year (12 lunar months), another outline of the Earth and Moon are shown at position B, and after a full Gregorian year, they are shown in position C. An arc is then drawn showing the difference of 11 days between the Earth's position after a synodic year, and another arc is drawn to show the difference between the Moon's position after a full Gregorian year. Because the synodic month and the solar year are not synchronized, the phase of the Moon will be different on the same day of the Gregorian year. That said, the lunar and solar calendars will re-synchronize roughly every 19 years. -For example, if there is a new moon on January 1st, 2020, there will not be a new moon on January 1st, 2021; however, there will be a new moon on January 1st, 2039. +For example, if there is a new moon on January 1st, 2020, there will not be a new moon on January 1st, 2021; however, there *will* be a new moon on January 1st, 2039. This 19-year cycle where the Moon and Sun are waiting to re-synchronize is known as the Metonic cycle and has been studied for centuries. -As a final note, there is a small offset in the Metonic cycle of 1 hour and 45 minutes every 19 years, so in 2500 years, it will be 8 days off. -With this in mind, we should be able to start discussing the algorithm, itself. +This cycle allows us to somewhat easily transition between solar and lunar calendars. +If we imagine any Gregorian date (let's say January 1st again for clarity), the moon could be in one of 19 different phases, as shown below: + +Metonic cycle + +Here, we show each possible phase of the moon as an outline, but the actual phase as a grey circle. +Essentially, by knowing what year we are on in the Metonic cycle, we can single out which phase of the moon we will see on any given date. +This is powerful and will allow us to find the next full moon by looking ahead a few days. + +As a final note, there is a small offset in the Metonic cycle of 1 hour and 45 minutes every 19 years, so in 2500 years, it will be 8 days off, but that's a problem for people in 2500. +For now, we should be able to start discussing the algorithm, itself. ## The algorithm @@ -130,7 +142,7 @@ From here, we also need to calculate an offset to $$a$$, and for this we need th $$ k = \left\lfloor\frac{\text{year}}{100}\right\rfloor, $$ -where $$\lfloor\cdot\rfloor$$ is a flooring operation of rounding the value down to the nearest integer. +where $$\lfloor\cdot\rfloor$$ is the flooring operation of rounding the value down to the nearest integer. With this, we can calculate the shift in the Metonic cycle to be, $$ @@ -197,9 +209,10 @@ For this computation, we do similar operations, but for the weekly calendar of 7 The first step is calculating the correct offset each century based on the fact that Jan 1st, in year 1 was a Friday and then accounting for all the non-observed leap days ($$k-q$$), $$ -N = (4+k-q)~\%~7 +N = (4+k-q)~\%~7. $$ +From here, things get a little tricky. There are 52 weeks in a year, but $$52\times7=364$$, meaning we are essentially one day off every year, with exception of leap years where we are two days off. As an example, look at the following table @@ -247,7 +260,7 @@ $$ $$ Remember that March 22nd would be the first possible day to celebrate Easter because March 21st would be the first possible full moon of spring. -All said, there are a few exceptions that are somewhat tricky to understand. +All said, there are a few exceptions that are somewhat tricky to understand, namely: $$ e = \left\{ @@ -273,6 +286,14 @@ The sheer complexity of this calculation both baffles and astounds me -- especia Sure, this can be done straightforwardly with a calculator, but it is no doubt an algorithm worth discussing and celebrating for its ingenuity at the time of creation. +## Video Explanation + +Here is a video describing key elements of Gauss's Easter Algorithm: + +
+ +
+ ## Example Code Unlike many other chapters in the Algorithm Archive, this particular method can be described almost entirely by mathematical expressions. As such, it should be relatively straightforward to implement in a number of different languages, and I heartily encourage you to do so! @@ -326,5 +347,6 @@ The text of this chapter was written by [James Schloss](https://github.com/leios - The image "[Servois 1800 Colored Table](res/servois_1800.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). - The image "[Relative Orbits](res/orbit.svg)" was created by [Xadisten](https://github.com/lockcmpxchg8beax) and was provided during a discussion on Twitch. It is licensed under the [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/legalcode). - The image "[Synodic Half Year](res/synodic_half_year.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). +- The image "[Metonic shadows](res/metonic.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). - The image "[Full Year Orbit](res/orbit.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). - The image "[Servois 2000 Colored Table](res/servois_2000.png)" was created by [James Schloss](https://github.com/leios) and is licensed under the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/legalcode). diff --git a/contents/computus/res/metonic.png b/contents/computus/res/metonic.png new file mode 100644 index 000000000..239d77383 Binary files /dev/null and b/contents/computus/res/metonic.png differ diff --git a/contents/computus/res/synodic_half_year.png b/contents/computus/res/synodic_half_year.png index c66727528..54a7ff3d2 100644 Binary files a/contents/computus/res/synodic_half_year.png and b/contents/computus/res/synodic_half_year.png differ