Created
May 10, 2021 12:06
-
-
Save Gro-Tsen/726e6d045f981c01568de7e8d9575b9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Returns the date of easter in Gregorian year y, where 0 = March 31 | |
def easter(y): | |
a = y%19 | |
b = y//100 | |
c = y%100 | |
d = b//4 | |
e = b%4 | |
f = (b+8)//25 | |
g = (b-f+1)//3 | |
h = (19*a+b-d-g+15)%30 | |
i = c//4 | |
k = c%4 | |
l = (32+2*e+2*i-h-k)%7 | |
m = (a+11*h+22*l)//451 | |
n = h+l-7*m+114 | |
return n-123 | |
eastertab = [easter(i) for i in range(5700000)] | |
easterstats = [0 for j in range(35)] | |
for i in range(5700000): | |
easterstats[eastertab[i]+9] += 1 | |
easterbistats = [[0 for j in range(35)] for j2 in range(35)] | |
for i in range(5700000): | |
easterbistats[eastertab[i]+9][eastertab[(i+1)%5700000]+9] += 1 | |
import matplotlib.pyplot as plt | |
import numpy as np | |
frqtab = [[easterbistats[i][j]/5700000 for j in range(35)] for i in range(35)] | |
plt.pcolormesh([[i-9 for j in range(35)] for i in range(35)],[[j-9 for j in range(35)] for i in range(35)], frqtab, shading="nearest") | |
plt.savefig("/tmp/easter.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment