Tuesday, March 22, 2011

Leap Year

For me when I was child or for that matter until I got into engineering leap year was the year which was divisible by 4. This is what I was taught in my school. Everything was fine until one day I had to write a C program for finding whether a given year was leap year or not. In my exam I thought I wrote the program well and expected to get full marks. I think it was first mid term in my first year of engineering at JNTU, Hyderabad.

When I got back my answersheet with half mark out of 3 ( or 5, I am not sure), first I was like what the hell and then felt happy to think that I would get full marks. Then I went and asked the instructor to give me full marks. I still remember his expression on his face. It was a huge ridicule. He announced it loudly in the class that definition of leap year was not just divisible by 4. I felt very embarrassed. Definitely not because he ridiculed me but because I didn't know it.

Anyway, here is the actual definition. You might or might not be knowing it. Even if you knew it I'm not sure whether you know the actual reason behind it. So the definition goes like this.

The given year should be divisible by 4 and shouldn't be divisible by 100 or should be divisible by 400. So the logic is simple. In any programming language you can use logical operators to define this. As an example I wrote the C program and put it in one of my previous posts. Check it out. So in a way you can say that any year that is divisible evenly by 4 and not evenly by 100 or evenly by 400 are leap years. For example, 2004 is evenly divisible by 4 and not evenly by 100. So 2004 is leap year. How about 2100. Even though it is evenly divisible by 4 is not leap year as it is also evenly divisible by 100. So 2100 is not leap year. How about 2400? It is leap year even though first half of the logic fails. Because the second half of the logic works here. Logical operator OR comes into picture here. 2400 is divisible by 400 and hence it is a leap year.

Up to this point it was just academic stuff. But the good stuff comes now. At least for me the most interesting part was why we do follow something of this critical to find out whether the given year is leap year or not. There is a brilliant reason behind this.

These days thorough out the world we follow Gregorian calendar. In this calendar we have 365 days per year. Right? In reality this is 6 hours shorter than solar year. Solar year is nothing but the amount of time it takes for earth to finish one revolution around sun. So to compensate this lost 6 hours per year we put 4 of these 6 hours together to make one day and put it in the month February every 4 years. Which means February in that year has one extra day and a total of 29 days. We call this year a leap year. This explains the first of the leap year being divisible by 4. How about second and third part. Let's go to next paragraph.

Ok. In my previous paragraph I said the time of 365 days is 6 hours shorter than solar year. Right? Let me take back those words. The exact value is slightly smaller than 6. In other terms you can say every year we are going little bit ahead of solar year by considering 6 hours in stead of an exact value which is slightly smaller than 6. So people found that after 100 years the little bit extra time sums up to become one day, i.e., 24 hours. Now you can say how much extra time we are going ahead every year? Got it? yep it is 1/100th part of day, which is nothing but 14.4 minutes. So you can say solar year is 365 days + 6 hours - 14.4 minutes. This explains year not being divisible by 100 in the logic. It is just that we don't consider leap every 100 years so that we lose one day we went ahead by taking leap years every 4 years in those 100 years. Ok let's move onto next paragraph. It's not over yet.

In my last paragraph I calculated the solar year as 365.25-0.01 (6 hours is 1/24=0.25 days, 14.4 min=14.4/60/24=0.01 days). So the number is 365.24. Not exactly. It seems the number is slightly bigger than this. How big? It is big enough in a way every 400 years it equals one day. So by taking this number and not considering the exact number we are a day behind the solar year every 400 years. So you can say that solar year is 365.24+1/400 (it takes 400 years to become 1 day. So in one year it is 1/400 th day which equals 3.6 minutes). So the solar year comes to 365.2425 days.

After all this if you think you have got the right number for solar year I say you are wrong. It seems the solar year value keeps increasing. It never stays constant. For now the exact value for solar year is 365.242374 days. You can see that it is slightly shorter than our value by 0.000125 days. Which means in another 8000 years it becomes one day. So in 8000 years we got to come back one day to sync with calendar. Which means the year 8000 should not be leap year. Again there is another catch though. Like I said the solar year keeps increasing. The time it takes for earth to go around the sun is increasing little by little every year. So in a way in another 8000 years the solar year keeps increasing and this way both the calendar and solar year sync.

Overall the way calendar system works is amazing. Don't you think so? Best part is people figured it out. Always amazes me. Anyway, got to go. If you are interested in knowing more go ti wikipedia and they have wonderful stuff.

2 comments:

Kranthi said...

haha.. i remember sreedhar. In the first midterm, even i did the same mistake...dividing the year by 4 ..hahha.. really ridiculous :-)

By the way...ur blogging quotient got increased :-) .good. nice to have you back ... keep posting :-)

Did i say u that i like the way u write or express in blogs ?? :-) .

My Knotty Mind - Labyrinth said...

Yeah. For no reason got all the interest to start again. Now I feel like blogging all the time. I want to write so many things I don't think I'll have time. But soon, I'm going to write very interesting stuff. Just keep checking and if possible implement them on your laptop.

By the way, felt great to see a comment from you Kranthi. I guess it makes me very very happy when I see comments from friends rather than unknown people. I guess makes sense.

PBS Script Generator: Interdependent dropdown/select menus in Javascript

PBS SCRIPT GENERATOR
SH/BASH TCSH/CSH
Begin End Abort

About Me

LA, CA, United States
Here I write about the battles that have been going on in my mind. It's pretty much a scribble.

Sreedhar Manchu

Sreedhar Manchu
Higher Education: Not a simple life anymore