function e=easter(day,month,year,dogma)
%Syntax: e=easter(day,month,year,dogma)
%______________________________________
%
% Returns 1 if the specified date is the Easter Sunday or 0 if it is
% not, related to the Roman-Catholic Easter or the Othodox Easter.
%
% e is the indicator 0 or 1.
% day, month and year are three variables that define the date.
% dogma can take one of the following values
% 'Catholic'
% 'Orthodox'
%
% Reference:
% Claus Tondering, Calendar FAQ,
% http://www.tondering.dk/claus/calendar.html
% Version 2.3 - 25 September 2000
%
%
% Example:
% >> e=easter(15,4,2002,'Catholic')
%
% e =
%
% 0
%
% >> e=easter(31,3,2002,'Catholic')
%
% e =
%
% 1
%
% Alexandros Leontitsis
% Department of Education
% University of Ioannina
% 45110 - Dourouti
% Ioannina
% Greece
%
% University e-mail: me00743@cc.uoi.gr
% Lifetime e-mail: leoaleq@yahoo.com
% Homepage: http://www.geocities.com/CapeCanaveral/Lab/1421
%
% 10 Oct 2006.
% day must be a scalar
if sum(size(day))>2
error('day must be a scalar.');
end
% month must be a scalar
if sum(size(month))>2
error('month must be a scalar.');
end
% year must be a scalar
if sum(size(year))>2
error('year must be a scalar.');
end
% The Catholic dogma is predefined
if nargin < 4
dogma = 'Catholic';
end
% Calculate the Easter Sunday
switch dogma
case 'Catholic'
G=rem(year,19);
C=floor(year/100);
H=rem(C-floor(C/4)-floor((8*C+13)/25)+19*G+15,30);
I=H-floor(H/28)*(1-floor(H/28)*floor(29/(H+1))*floor((21-G)/11));
J=rem(year+floor(year/4)+I+2-C+floor(C/4),7);
L=I-J;
Eastermonth=3+floor((L+40)/44);
Easterday=L+28-31*floor(month/4);
if day==Easterday & month==Eastermonth
e=1;
else
e=0;
end
case 'Orthodox'
a=rem(year,4);
b=rem(year,7);
c=rem(year,19);
d=rem(19*c+16,30);
e=rem(2*a+4*b+6*d,7);
N=d+e+3;
if N<=30
Eastermonth=4;
Easterday=N;
else
Eastermonth=5;
Easterday=N-30;
end
if day==Easterday & month==Eastermonth
e=1;
else
e=0;
end
otherwise
error('dogma should be either "Catholic" or "Orthodox"');
end