Darwin, pancakes and birthdays
I was browsing Twitter yesterday, and I happened to see a fun tweet about Darwin.
It's Darwin's birthday apparently. Do you think he was ever like "can I have a birthday cake?" and everyone else was like NO ONLY PANCAKES.
I quite like the idea of this, but I was a bit dubious about the plausibility. The tradition of pancakes on Shrove Tuesday is fairly well established, with pancake races dating back to at least 1445, so we can be reasonably sure that Darwin was at least familiar with eating pancakes on the day.
Birthday cakes are a little fuzzier. The earliest reference to a birthday cake that I could find was in Germany, 1746, and there really aren’t many mentions of cakes in Europe before 1850. Since Darwin was born in 1809, I don’t know how many birthday cakes he would actually have had. Poor Darwin.
But that wasn’t what piqued my interest. Let’s suppose that Darwin definitely had pancakes and birthday cakes. As was correctly pointed out a few moments after the original tweet, Shrove Tuesday moves around every day with Easter. I wanted to know: did Darwin’s birthday ever overlap with Shrove Tuesday while he was alive?
This gave me an opportunity to do a bit of playing with the
datetime library in Python. Nothing here is particularly complicated, but it was fun to write nonetheless.
First we need to calculate the date of Easter. At face value, this might seem quite hard, since Easter moves around based on the cycles of the Moon. As it turns out, there’s a really easy way to do this, called Butcher’s algorithm. This is very easy to implement in Python, which gives us a way to find Easter:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #!/usr/bin/python import datetime def easter_date(year): a = year % 19 b = year // 100 c = year % 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 p = h + l - 7 * m + 114 month = p // 31 # Here 3=March, 4=April day = p % 31 + 1 # Since dates count from zero return datetime.date(year,month,day)
Once we’ve found Easter, getting to Shrove Tuesday is easy: we just jump back 47 days, and
datetimecontains a handy
timedeltafunction that does just that:
def shrove_tuesday_date(year): easter = easter_date(year) shrove = easter - datetime.timedelta(days=47) return shrove
Finally, a simple
forloop is enough to go through and find the years in Darwin’s life when his birthday was coincident with Shrove Tuesday:
for i in range (1809,1883): if shrove_tuesday_date(i) == datetime.date(i,02,12): print i, i-1809
which returns the following:
1839 30 1850 41 1861 52
So Darwin might have gone without birthday cakes because of Pancake Day at most three times in his life.
Looking at the years above, we notice that they’re separated by eleven years each. It turns out, this isn’t entirely coincidence. Let’s look at a wider range of years. Butcher’s algorithm runs from the start of the Gregorian calendar (in 1543) until, well, indefinitely.
So we can easily reuse the function above to find lots of years where Shrove Tuesday fell (or will fall) on February 12th. Running from 1543 to 2500:
1619 1630 1641 1709 1771 1782 1793 1839 1850 1861 1907 1918 1929 1991 2002 2013 2086 2092 2097 2143 2154 2165 2211 2222 2233 2301 2363 2374 2385 2458 2464 2469
So we have lots of clusters of three cropping up. And in the two areas where it breaks, the differences between years are still the same (6 and 5). And since Easter and Shrove Tuesday are separated by 47 days every year, this means that Easter is moving in the same pattern.
There’s clearly a feature of the Gregorian calendar that causes it to fall out this way. If we looked at different dates, we’d probably find similar patterns. I’m not going to go into it here, because it probably takes quite a lot of work, but I’ve included a link in the further reading section on Easter intervals.
Date maths can be really hard, and this is just one example of that. It’s not at all obvious why this pattern should appear, simply by looking at the calendar. I find all the exceptions and special rules really interesting, and I want to learn more about this. Even writing this simple stuff was quite fun, and I’d like to do more of it in the future.
And after all that, we still don’t know if Darwin got his cake.
- And now it’s all this is the blog of Dr. Drang. A good mix of engineering, maths and programming; I always enjoy reading it. He’s written quite a few good posts on date maths in the past, and I had those in mind as I was writing this post. I also used his fork of blackbird.py to embed the tweet at the top of the post.
- Birthday Cakes: History and Recipes is a detailed history of the birthday cake in Western culture. If you’re interested in where our modern traditions came from, and what birthday cake etiquette used to be in the past, then you should read this. Lots of stuff that I didn’t know before. Fascinating read.
- Easter Intervals is a journal article about the days on which Easter falls, which I briefly mentioned above. It looks at the days on which Easter is most likely to fall, and how the calendar structure sets that up. There’s some very interesting stuff in there.