Categories
Computer Programming Life

The Math of Y2K

Airplanes crashing! ATM machines stopping! Computers exploding!? What was the Y2K doomsday all about?

Most computer programs written prior to the mid 1990s used only 2 characters to keep track of the year. Back in the 1970s and 1980s, computing power was expensive, so it made sense not to waste 2 extra digits storing a bunch of redundant “19__” prefixes. The computer would simply store a 55 or 97, instead of 1955 or 1997.

The problem with Y2K was that any date calculation written this way would fail once the year rolled over to 2000. Why? Let’s look at a very simple example. Let’s say a computer program calculates how old you are in order to determine if you’re eligible for certain medical benefits. The code could look something like this:

birth_year = 29;
current_year = 95;
age = current_year – birth_year;
If (age >= 65) then medicare_eligible = TRUE;

Normally, this works fine. In the above example, the age = 95 – 29 = 66, and he can get medicare benefits. But, notice what happens when this same code runs in the year 2000 !

birth_year = 29;
current_year = 00;
age = current_year – birth_year;
If (age >= 65) then medicare_eligible = TRUE;

Now age = 00 – 29. That’s negative 29 years old. Clearly, -29 is not greater than 65. So, the computer thinks you’re not old enough to get medicare benefits! The logic goes haywire unless all the date codes are expanded to 4 digits. Once you do that, 2000 – 1929 = 71.

Apply this simple calculation error to anything that needed to compare dates, or determine how old something is, or how much time has passed. This is why people were expecting a computing catastrophe when the date rolled over.

Categories
Algebra Graphs Life

The older you get, the faster each year passes by. Why?

RE: Birthday Dinner
Yes, life does go by fast.  Strangely, the older you get, the faster it goes.  I do not know why this is.

Ever get an email like this?  Well, as your age varies, the percentage of your life that a single calendar year represents also varies.  As you get older, a year is a smaller percentage of your overall life.  In other words, 1 year represents 50% of a 2 year old’s life.  However, it is only 2% of a 50 year old’s life.  So, perhaps that is why each year seems to go by faster.

Want to see the percentage for every age from 0 to 80?  Let’s make a formula and graph it.  The percentage of your life that a single year represents is just a function of your age:  \(f(age) = \frac{1}{age}\)  If you graph this on a spreadsheet, you’ll get the following:

How would you interpret this graph?  You’ll notice that once you pass the inflection point, the percentage seems to flatten out.  So, at what point can a person legitimately start saying “Wow, this year really flew by?”  Based on the graph, teenagers might feel this almost as much as middle aged people.

Lastly, do you notice how scaling of the y-axis makes the difference between age 15 and 50 look trivial?  In order to properly display percentage changes, I will scale the y-axis logarithmically.  Here is the result:

With this scaling, you can see a year in the life of a teenager (~6%) is quite different than a year in the life of someone in their 50s (~2%)