TI-BASIC:Easter Calculation

From Learn @ Cemetech
Revision as of 18:06, 24 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

File:@@

Routine Summary

Calculates the day that Easter Sunday falls on any given year.

Inputs

Y - The year (any year at all)

Outputs

Ans - The day in March of Easter Sunday (plus 31 if the month is April)

Variables Used

Y, Ans

Calculator Compatibility

TI-83/84/+/SE Author

John Horton ConwayAuthors

@@URL: [1] Download

file eastercalculation.zip

:int(Y/ᴇ2
:50-30fPart((11(1+19fPart(Y/19))-Ans+int(Ans/4)+int(8(Ans+11)/25))/30
:If Ans=50 or Ans=49 and 11≤19fPart(Y/19
:Ans-1
:round(Ans+7-7fPart((int(23(3+(Ans>31))/9)+Ans-31(Ans>31)+2+Y+int(Y/4)-int(Y/ᴇ2)+int(Y/400))/7),0

This is the TI-BASIC version of an Easter Calculation algorithm by John Horton Conway (famous for creating the cellular automata "The Game of Life"). After implementation of this program, {{3+(Ans>31)}} is the month it occurs in, and {{Ans-31(Ans>31)}} is the day.

Date Identification

This code, as it stands right now, displays the day of March it falls on (if it's over 31, then the day in April+31).

Append the following code to display the actual day:

:ClrHome
:Disp sub("MARCHAPRIL",1+5(Ans>31),5
:Output(1,7,Ans-31(Ans>31

Why it Works

Easter is the first Sunday strictly after the Paschal Full Moon, which is an approximation of the real full moon (the 14th day of a lunar month, specifically), although it may be off by as much as two days.

The formula is

[2]

except if the formula gives April 19, take April 18, and if the formula gives you April 18 and G≥12, take April 17.

Here is the value of G:

[3]

Here is the value of C (with H=Template:Int(Y/100), and [H]=Template:Int(H)):

[4]

The first four lines of code implement this algorithm.

Lastly, the last line of code adjusts the date to the next Sunday using a modified version of the Day of Week routine.Footnote If you have an 84+ or 84+SE, this may as well be {{Ans+7-dayOfWk(Y,3+(Ans>31),Ans31(Ans>31))}}. /footnote

Error Conditions

  • None known.

Related Routines