Leap Year Birthday?

Posted by Mike Birdgeneau

Category: Data

So hypothetically, if you were born on February 29th of a leap year, you'd eventually discover that you only have a true Gregorian birthday every four years.

What does a birthday truly mean? I've always interpreted it to mean a full trip around the sun -- the orbital period of the Earth. With this definition, one way of solving this problem is to figure out where in Earth's orbit you were born, and look for when the earth crosses the same point in its subsequent orbital periods, and that would be your birthday. (Should the birthday cake be on Feb 28th, or March 1st!)

It was about this point I learned the difference between a tropical year, and a sidereal year: The former being the time interval between vernal (spring) equinoxes, and the latter being a true orbital period of the sun. The Gregorian calendar that we use for daily life and timekeeping is based on the tropical year. Now here's where it gets fun: With the sidereal year being approximately 20.4 minutes longer than a tropical year, when you try to figure out which day your hypothetical birthday falls you start to notice this diference showing up in subsequent years. In the plot below, when I calculated the trip around the sun, you'll notice that the time when we cross the same point in the orbital period time shifts. This is most easily observed as the difference between every four years (for easy visual comparison).

2016: 2016-02-29 14:33:00-07:00
2017: 2017-02-28 20:44:13-07:00
2018: 2018-03-01 02:53:00-07:00
2019: 2019-03-01 08:54:57-07:00
2020: 2020-02-29 15:04:19-07:00
2021: 2021-02-28 21:16:28-07:00
2022: 2022-03-01 03:32:21-07:00
2023: 2023-03-01 09:45:42-07:00
2024: 2024-02-29 15:50:20-07:00

Our calendar, even with consideration to leap years doesn't use a sidereal year - but at least our seasons won't shift (noticeably). If we all measure our birthdays using sidereal years, then this leap year problem isn't limited to just people born on February 29th... Depending on when you're born on any given day, your 'sidereal birthday' may shift year after year, but to keep things simple, you can just use your tropical birthday -- but don't be fooled, it's not a true trip around the sun.

Birthday Drift

So what is a birthday really mean? What does a year really mean?

"What do you mean, An African or European swallow?"

-- Monty Python

The following is the python code I used to perform these calculations:

from skyfield.api import load
from scipy import optimize
from datetime import datetime
from dateutil import tz

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

def earthPosition(t1):

    planets = load('de430.bsp')
    sun, earth, mars = planets['SUN'], planets['EARTH BARYCENTER'], planets['MARS BARYCENTER']
    ts = load.timescale()
    t0 = ts.utc(2016, 2, 29, 21, 33, 0) # UTC
    astrometric = sun.at(t0).observe(earth)
    ra0, dec0, distance0 = astrometric.radec()

    t1 = ts.tai(jd=t1)

    astrometric1 = sun.at(t1).observe(earth)
    ra1, dec1, distance1 = astrometric1.radec()

    return abs( dec0.radians - dec1.radians )


def findBirthday( yr ):
    ts = load.timescale()
    tmin = ts.utc(yr,2,28,0,0,0).tai
    tmax = ts.utc(yr,3,1,23,59,59).tai
    x0 = ts.utc(yr,2,28,23,59,59).tai

    best, val, des = optimize.fmin_l_bfgs_b(earthPosition, x0, bounds=[(tmin,tmax)],
                                            approx_grad=True, iprint=-1)

    tres = ts.tai(jd=best).utc_iso()

    tres = datetime.strptime(tres[0],'%Y-%m-%dT%H:%M:%SZ')
    tres = tres.replace(tzinfo=tz.gettz("UTC"))

    return(tres.astimezone(tz.gettz("America/Edmonton")))


birthdays = []
for year in range(2016,2025):
    result = findBirthday(year)
    birthdays.append(str(result))
    print(str(year) + ": " + str(result))

df = pd.DataFrame({'Year' : range(2016,2025), 'Birthday' : birthdays})

df.to_csv('birthdays.csv')

Comments

Python Development with Docker

I've been trying to brush up my skills in Python after spending a lot of time in R. One of the challenges I've run into is maintaining a common development environment on my Mac. Enter Docker.

Force Carbonation Charts

Force carbonation charts are readily available in either metric or imperial units, mostly the latter. The problem was, I use Celcius, and my regulator is in psi. This was a quick solution to the problem.

Leap Year Birthday?

If you're born on Feb 29th, when's your Birthday? Good question.

Other ways to reach me