{"id":549,"date":"2013-03-18T12:00:13","date_gmt":"2013-03-18T17:00:13","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=549"},"modified":"2016-12-05T13:57:30","modified_gmt":"2016-12-05T18:57:30","slug":"easter","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2013\/03\/18\/easter\/","title":{"rendered":"Easter"},"content":{"rendered":"&nbsp;\r\n<div class=\"content\"><!--introduction-->Easter Sunday is March 31 this year. Why? How is the date of Easter determined?\r\n\r\n<!--\/introduction-->\r\n<h3>Contents<\/h3>\r\n<div>\r\n<ul>\r\n \t<li><a href=\"#b0268787-2bdc-4222-8cf5-df42f24bf441\">Easter Day<\/a><\/li>\r\n \t<li><a href=\"#fb7f4943-cb1e-43d7-afa9-92719e951ca6\">Don Knuth<\/a><\/li>\r\n \t<li><a href=\"#ee8ff8af-8d48-44d4-9752-599caf54dd65\">Metonic cycle<\/a><\/li>\r\n \t<li><a href=\"#b2f7c023-ebaf-4191-826d-c5a766fd701e\">MATLAB program<\/a><\/li>\r\n \t<li><a href=\"#d5123200-4ce1-4de5-910c-cf77d13f9a21\">References<\/a><\/li>\r\n<\/ul>\r\n<\/div>\r\n<h4>Easter Day<a name=\"b0268787-2bdc-4222-8cf5-df42f24bf441\"><\/a><\/h4>\r\nEaster Day is one of the most important events in the Christian calendar. It is also one of the most mathematically elusive. In fact, regularization of the observance of Easter was one of the primary motivations for calendar reform centuries ago.\r\n\r\nEaster is linked to the Jewish Passover. The informal rule is that Easter Day is the first Sunday after the first full moon after the vernal equinox. But the ecclesiastical full moon and equinox involved in this rule are not always the same as the corresponding astronomical events, which, after all, depend upon the location of the observer on the earth. The date varies between March 22 and April 25.\r\n\r\nThere is an <a href=\"https:\/\/www.mathworks.com\/content\/dam\/mathworks\/mathworks-dot-com\/moler\/exm\/exm\/easter.m\"><tt>easter<\/tt><\/a> program in <a href=\"https:\/\/www.mathworks.com\/moler\/exm\/index.html\"><i>Experiments with MATLAB<\/i><\/a>. Let's check this year.\r\n<pre class=\"codeinput\">datestr(easter(2013))\r\n<\/pre>\r\n<pre class=\"codeoutput\">ans =\r\n31-Mar-2013\r\n<\/pre>\r\nHow about next year?\r\n<pre class=\"codeinput\">datestr(easter(2014))\r\n<\/pre>\r\n<pre class=\"codeoutput\">ans =\r\n20-Apr-2014\r\n<\/pre>\r\n<h4>Don Knuth<a name=\"fb7f4943-cb1e-43d7-afa9-92719e951ca6\"><\/a><\/h4>\r\nThe <i>EXM<\/i> program is based on the algorithm presented in the first volume of the classic series by Donald Knuth, <a href=\"http:\/\/en.wikipedia.org\/wiki\/The_Art_of_Computer_Programming\">The Art of Computer Programming<\/a>. Knuth has used it in several publications to illustrate different programming languages. The task has often been the topic of an exercise in computer programming courses.\r\n\r\nKnuth says that the algorithm is due to the Neapolitan astronomer Aloysius Lilius and the German Jesuit mathematician Christopher Clavious in the late 16th century and that it is used by most Western churches to determine the date of Easter Sunday for any year after 1582.\r\n<h4>Metonic cycle<a name=\"ee8ff8af-8d48-44d4-9752-599caf54dd65\"><\/a><\/h4>\r\nThe earth's orbit around the sun and the moon's orbit around the earth are not in sync. It takes the earth about 365.2425 days to orbit the sun. This is known as a tropical year. The moon's orbit around the earth is complicated, but an average orbit takes about 29.53 days. This is known as a synodic month. The fraction\r\n<pre class=\"codeinput\">year = 365.2425;\r\nmonth = 29.53;\r\nformat <span class=\"string\">rat<\/span>\r\nratio = year\/month\r\n<\/pre>\r\n<pre class=\"codeoutput\">ratio =\r\n    6444\/521   \r\n<\/pre>\r\nis not the ratio of small integers. However, in the 5th century BC, an astronomer from Athens named Meton observed that the ratio is very close to 235\/19.\r\n<pre class=\"codeinput\">format <span class=\"string\">short<\/span>\r\nratio\r\nmeton = 235\/19\r\n<\/pre>\r\n<pre class=\"codeoutput\">ratio =\r\n   12.3685\r\nmeton =\r\n   12.3684\r\n<\/pre>\r\nIn other words, 19 tropical years is close to 235 synodic months. This Metonic cycle was the basis for the Greek calendar and is the key to the algorithm for determining Easter.\r\n<h4>MATLAB program<a name=\"b2f7c023-ebaf-4191-826d-c5a766fd701e\"><\/a><\/h4>\r\nHere is the complete MATLAB program.\r\n<pre class=\"codeinput\"><span class=\"comment\">% addpath ..\/..\/exm<\/span>\r\ntype <span class=\"string\">easter<\/span>\r\n<\/pre>\r\n<pre class=\"codeoutput\">function dn = easter(y)\r\n% EASTER  Date of Easter.\r\n% EASTER(y) is the datenum of Easter in year y.\r\n% Ref: Donald Knuth, The Art of Computer Programming,\r\n%      Fundamental Algorithms, pp. 155-156.\r\n\r\n% Golden number in 19-year Metonic cycle.\r\ng = mod(y,19) + 1;\r\n\r\n% Century number.\r\nc = floor(y\/100) + 1;\r\n\r\n% Corrections for leap years and moon's orbit.\r\nx = floor(3*c\/4) - 12;\r\nz = floor((8*c+5)\/25) - 5;\r\n\r\n% Epact.\r\ne = mod(11*g+20+z-x,30);\r\nif (e==25 &amp;&amp; g&gt;11 || e==24), e = e + 1; end\r\n\r\n% Full moon.\r\nn = 44 - e;\r\nif n &lt; 21, n = n + 30; end\r\n\r\n% Find a Sunday.\r\nd = floor(5*y\/4) - x - 10;\r\n\r\n% Easter is a Sunday in March or April.\r\nd = n + 7 - mod(d+n,7);\r\ndn = datenum(y,3,d);\r\n\r\n<\/pre>\r\n<h4>References<a name=\"d5123200-4ce1-4de5-910c-cf77d13f9a21\"><\/a><\/h4>\r\n[1] Donald E. Knuth, The Art of Computer Programming, Volume 1: Fundamental Algorithms (3rd edition), pp. 155-156, Addison-Wesley, 1997, ISBN 0-201-89683-4.\r\n\r\n[2] Wikipedia, Primary article on Easter. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Easter\">&lt;http:\/\/en.wikipedia.org\/wiki\/Easter<\/a>&gt;\r\n\r\n[3] Wikipedia, Computus, details on calculation of Easter. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Computus\">&lt;http:\/\/en.wikipedia.org\/wiki\/Computus<\/a>&gt;\r\n\r\n[4] Wikipedia, Metonic cycle. <a href=\"http:\/\/en.wikipedia.org\/wiki\/Metonic_cycle\">&lt;http:\/\/en.wikipedia.org\/wiki\/Metonic_cycle<\/a>&gt;\r\n\r\n<script>\/\/ <![CDATA[\r\nfunction grabCode_5beec79cb74743fd9ca4a840320178f6() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='5beec79cb74743fd9ca4a840320178f6 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 5beec79cb74743fd9ca4a840320178f6';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2013 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('\r\n\r\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\r\n\r\n\r\n\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }\r\n\/\/ ]]><\/script>\r\n<p style=\"text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;\">\r\n<a><span style=\"font-size: x-small; font-style: italic;\">Get\r\nthe MATLAB code<noscript>(requires JavaScript)<\/noscript><\/span><\/a>\r\n\r\nPublished with MATLAB\u00ae R2012b<\/p>\r\n<p class=\"footer\">\r\nPublished with MATLAB\u00ae R2012b<\/p>\r\n\r\n<\/div>\r\n<!--\r\n5beec79cb74743fd9ca4a840320178f6 ##### SOURCE BEGIN #####\r\n%% Easter\r\n% Easter Sunday is March 31 this year.  Why?\r\n% How is the date of Easter determined?\r\n\r\n%% Easter Day\r\n% Easter Day is one of the most important events in the Christian calendar.\r\n% It is also one of the most mathematically elusive.\r\n% In fact, regularization of the observance of Easter was one of the primary\r\n% motivations for calendar reform centuries ago.\r\n\r\n%%\r\n% Easter is linked to the Jewish Passover.\r\n% The informal rule is that Easter Day is the first Sunday after the first full\r\n% moon after the vernal equinox.  But the ecclesiastical full moon and equinox\r\n% involved in this rule are not always the same as the corresponding\r\n% astronomical events, which, after all, depend upon the location of the\r\n% observer on the earth.  The date varies between March 22 and April 25.\r\n\r\n%%\r\n% There is an <https:\/\/www.mathworks.com\/moler\/exm\/exm\/easter.m |easter|>\r\n% program in\r\n% <https:\/\/www.mathworks.com\/moler\/exm\/index.html _Experiments with MATLAB_>.\r\n% Let's check this year.\r\n\r\ndatestr(easter(2013))\r\n\r\n%%\r\n% How about next year?\r\n\r\ndatestr(easter(2014))\r\n\r\n%% Don Knuth\r\n% The _EXM_ program is based on the algorithm presented in the first volume\r\n% of the classic series by Donald Knuth,\r\n% <http:\/\/en.wikipedia.org\/wiki\/The_Art_of_Computer_Programming % The Art of Computer Programming>.\r\n% Knuth has used it in several publications to illustrate different\r\n% programming languages.  The task has often been the topic of an exercise\r\n% in computer programming courses.\r\n\r\n%%\r\n% Knuth says that the algorithm is due to the Neapolitan astronomer\r\n% Aloysius Lilius and the German Jesuit mathematician Christopher Clavious\r\n% in the late 16th century  and that it is used by most Western churches to\r\n% determine the date of Easter Sunday for any year after 1582.\r\n\r\n%% Metonic cycle\r\n% The earth's orbit around the sun and the moon's orbit around the earth\r\n% are not in sync.  It takes the earth about 365.2425 days to orbit the sun.\r\n% This is known as a tropical year.  The moon's orbit around the earth is\r\n% complicated, but an average orbit takes about 29.53 days.  This is known as\r\n% a synodic month.  The fraction\r\n\r\nyear = 365.2425;\r\nmonth = 29.53;\r\nformat rat\r\nratio = year\/month\r\n\r\n%%\r\n% is not the ratio of small integers.  However, in the 5th century BC, an\r\n% astronomer from Athens named Meton observed that the ratio is very close to\r\n% 235\/19.\r\n\r\nformat short\r\nratio\r\nmeton = 235\/19\r\n\r\n%%\r\n% In other words, 19 tropical years is close to 235 synodic months.\r\n% This Metonic cycle was the basis for the Greek calendar and\r\n% is the key to the algorithm for determining Easter.\r\n\r\n%% MATLAB program\r\n% Here is the complete MATLAB program.\r\n\r\n% addpath ..\/..\/exm\r\ntype easter\r\n\r\n%% References\r\n% [1] Donald E. Knuth, The Art of Computer Programming,\r\n% Volume 1: Fundamental Algorithms (3rd edition), pp. 155-156,\r\n% Addison-Wesley, 1997, ISBN 0-201-89683-4.\r\n%%\r\n% [2] Wikipedia, Primary article on Easter.\r\n% <http:\/\/en.wikipedia.org\/wiki\/Easter http:\/\/en.wikipedia.org\/wiki\/Easter>\r\n%%\r\n% [3] Wikipedia, Computus, details on calculation of Easter.\r\n% <http:\/\/en.wikipedia.org\/wiki\/Computus http:\/\/en.wikipedia.org\/wiki\/Computus>\r\n%%\r\n% [4] Wikipedia, Metonic cycle.\r\n% <http:\/\/en.wikipedia.org\/wiki\/Metonic_cycle % http:\/\/en.wikipedia.org\/wiki\/Metonic_cycle>\r\n\r\n##### SOURCE END ##### 5beec79cb74743fd9ca4a840320178f6\r\n-->","protected":false},"excerpt":{"rendered":"<!--introduction-->Easter Sunday is March 31 this year. Why? How is the date of Easter determined?\r\n\r\n<!--\/introduction-->... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2013\/03\/18\/easter\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/549"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=549"}],"version-history":[{"count":15,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":2181,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/549\/revisions\/2181"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}