0

How Common is Easter in March? (Shallow Thoughts)

 6 months ago
source link: https://shallowsky.com/blog/programming/easter-in-march.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How Common is Easter in March?

"Easter is March 31 this year," my husband said. "I think that's rare, having Easter in March."

"I guess so," I said.

"There's a Cray somewhere that they use to calculate the date each year," he joked.

And of course that made me want to find out if Easters in March really are rare.

Roughly, Easter happens on the Sunday after the first full moon after the vernal equinox. That's not quite right: there are complications, and there are also variations (not all churches calculate Easter in the same way).

Jean Meeus, Astronomical Algorithms, has an algorithm for the date of Easter, as does the much more readable Practical Astronomy With Your Calculator (looks like there's a newer edition that covers spreadsheets too). (Disclosure: I get a small kickback if you purchase through those Amazon links.) I'm pretty sure PyEphem has it built in. But I bet there's something in the Python standard library too.

Well, no, it's not in the standard library, but there's dateutil.easter. That makes it simple to explore how common March Easters are (letting dateutil.easter.easter default to EASTER_WESTERN rather than using the Julian or Orthodox algorithms).

from dateutil import easter

num_in_march = 0
earliest_day = 31

for i in range(1900, 2100):
    easterdate = easter.easter(i)
    if easterdate.month == 3:
        num_in_march += 1
        print(easterdate)
        earliest_day = min(earliest_day, easterdate.day)

print("Earliest Easter on March", earliest_day)
print(f"Percent in March: {num_in_march * 100 // 200}% ({num_in_march}/200)")

Turns out there are 44 Easters between 1900 and 2099 that fall in March, or 22%, with the earliest being on March 23rd.

So, not rare at all, and no Cray needed. Aren't computers fun?

Tags: programming, python
[ 12:49 Mar 10, 2024    More programming | permalink to this entry | ]


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK