Contentseaster program in Experiments with MATLAB. Let's check this year.
ans = 31-Mar-2013How about next year?
ans = 20-Apr-2014The Art of Computer Programming. 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. Knuth 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.
year = 365.2425; month = 29.53; format rat ratio = year/month
ratio = 6444/521is 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.
format short ratio meton = 235/19
ratio = 12.3685 meton = 12.3684In 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.
% addpath ../../exm type easter
function dn = easter(y) % EASTER Date of Easter. % EASTER(y) is the datenum of Easter in year y. % Ref: Donald Knuth, The Art of Computer Programming, % Fundamental Algorithms, pp. 155-156. % Golden number in 19-year Metonic cycle. g = mod(y,19) + 1; % Century number. c = floor(y/100) + 1; % Corrections for leap years and moon's orbit. x = floor(3*c/4) - 12; z = floor((8*c+5)/25) - 5; % Epact. e = mod(11*g+20+z-x,30); if (e==25 && g>11 || e==24), e = e + 1; end % Full moon. n = 44 - e; if n < 21, n = n + 30; end % Find a Sunday. d = floor(5*y/4) - x - 10; % Easter is a Sunday in March or April. d = n + 7 - mod(d+n,7); dn = datenum(y,3,d);<http://en.wikipedia.org/wiki/Easter>  Wikipedia, Computus, details on calculation of Easter. <http://en.wikipedia.org/wiki/Computus>  Wikipedia, Metonic cycle. <http://en.wikipedia.org/wiki/Metonic_cycle>
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.