Entering the US using an Advance Parole

January 3rd, 2008 admin

I have been using my H-1B Work Visa to enter the US the last few times I traveled abroad. A few days back I entered the US using an Advance Parole document, instead. I provide a few tips here for someone in the same situation. An hour or so before the inbound flight is expected to land in the US Port of Entry the airline staff will pass around a Customs Declaration form, a Visa Information form (white in color) and a Visa Waiver form (green in color). Everyone has to fill out the Customs Declaration form. Its purpose is to declare to the Customs official at the port of entry, how much money and what other goods you are bringing in to the US. It is straightforward to fill out and requires you to make some quick estimates about the value of the stuff you are bringing in. For the purposes of this form and the others, if you are traveling on an Advance Parole, you are a “resident”. That is, you are not a visitor and you are not a citizen. You do not have your Green Card yet, so you are not a permanent resident yet, but you still are considered a resident. The green, Visa Waiver form applies to some specific countries and the airline staff can help you identify if you need to fill that form. India is not one of those countries. Indians, traveling on either a visitor or work Visa, or an Advance Parole, will need to fill out the white, Visa form. A part of this form eventually becomes the I-94 card that is stapled to your passport by the immigration official at the port of entry. A question in the white Visa form ask for the place and date of Visa approval. I simply put in the place and date of the Advance Parole approval, since I was using that document instead of a Visa to reenter the country. After landing at the port, Newark, in my case, I went through the Immigration Check first. There are 2 separate groups of lines. One group is for US Citizens and Residents. Another is for visitors and other Visa holders (such as H-1B or F-1 visa). I went to the US Citizens and Residents line. This line is much shorter than the other one. An Immigration Officer checked my Advance Parole, Customs form, the white, Visa form and my passport, put them all into a clear plastic envelope and asked me to take those to another officer who would verify the Advance Parole details. I assume this is needed only for people traveling on Advance Parole, and not for Citizens or Permanent Residents (Green Card holders). I took an elevator down to this next officer. His cubicle was actually right next to the baggage claim carousels and I think their office also inspects luggage which fails customs clearance. After sitting for about 10 minutes in the waiting area there, the officer got to my envelope and called me over. He checked everything was good and gave me my stamped and dated Advance Parole original, the stamped and dated Customs Form, the stamped and dated I-94 stapled to my stamped and dated passport. Then I stepped out of that area, picked up my checked-in baggage from the baggage claim carousel and joined the customs inspection line. I handed over the Customs Declaration form to the officer there and walked out of there with my luggage. Some people were being diverted, along with their luggage, for a customs inspection. I am not sure if it was because their Customs Form was not stamped like mine was, or because they wanted to actually inspect something in the luggage because of what was declared by the traveler. The last step, in my case, was to re-check-in the check-in baggage and go through the security check again because I had a domestic flight to catch to get back to Raleigh. The re-check-in area was placed, conveniently enough, right after the Customs. So I could not miss it. My bags had been checked in all the way to Raleigh at Delhi itself. So I did not have to actually check-in again. I simply dumped by bags in the re-check-in area, where it was helped on to the moving luggage belt by a couple of guys. Then I walked a but further and noticed the long security check line to reenter the terminal. That was it. My international journey was over and the domestic journey began.

Posted in Experiences | No Comments »

On the nature of religion

October 27th, 2007 admin

Recently, we had a long discussion on our IIT Guwahati, Class of 99, Google groups. It was related to a petition filed with the Indian Supreme Court regarding a song in a Bollywood movie, the lyrics, costumes and imagery in which were deemed derogatory to religious people in India. The discussion meandered its way through several interesting topics and opinions. Here I present a glimpse of my views on the topic of religion and why it is futile to judge what is religiously right or wrong. My friend, Samya, encouraged me to put these views up on the website. I present my thoughts verbatim from my email and therefore any contextual references that seem out of place or emotional here should, kindly, be excused.

I find the notion of religion an interesting subject to think about. Even in this short discussion we have found many points of view, many frames of reference, many notions hidden behind the word “religion”. Thinking of religion reminds me of the story of the 5 blind men trying to understand what an elephant is. I do not see those men, as the story seems to imply, as lacking any specific faculty. I see them as normal humans. I do not see the elephant as an understandable subject that is only difficult to understand. Finally, I do not see the blind men as failures because their “limited” point of view. If those were blind men and that elephant was their large unassailable subject, what makes us, the reader of that fable, special in that we are able to see the big picture? In the real world, we are one among those men, and, therefore, we will not be able to see the entire elephant. Even more importantly, what *is* the “entire elephant” in such a real world? Just because the blind men are feeling around does not mean there is an elephant to be discovered. If there was no one to tell those blind men that they were touching an elephant, how would they *ever* know that it was an elephant they were touching? To me the “elephant” is the ability to be able to simultaneously acknowledge that each of the billions of blind men do have a piece of the view that the others will never have. Further, to me the elephant is the ability to distill those billions of view points into some common, uplifting, purposeful goal. This live interaction between the minds and view points of these billions of people is not just impossibly difficult, thankfully, it is unnecessary. Why should there be one common elephant that all have to agree to have understood?

Search for a common religion is like this search for the one elephant. It is impossible. Again, careful when I say impossible, it is nothing to be dejected about. It is an elevating feeling. It is like the blind men saying, “Hold it off for a minute…why do we *have* to *all* see the same thing?” It is an elevating feeling because you can, finally, let your conscience guide you without the haunting feeling that you are missing something. We have a faculty for thinking. The blind men still had the sense of touch. Let us use what we have and figure out what purposeful goal we see from our vantage. Let there be a billion religions for a billion people. Anytime we *name* a religion we are in trouble. There are not enough names to make it worthwhile. And anytime two people who name their religion the same but are at different ends of the elephant, there is bound to be frustration. Anytime two groups of people name their religion differently, they try to evaluate the better point of view, the “true” religion. They try to *help* the other group out by bringing them to their end of the elephant, while not acknowledging that there is no *reason* why their end is really better, except that *they* feel so. This brings in ego. The problem with ego is that it is the tendency to prioritize your thoughts over another person’s thoughts *without* reasoning through them, that is, without using your faculty of thinking honestly.

Therefore, I am cautious anytime I am asked, “What is your religion?”. If I thought about it long enough, I might be able to convey some ideas about what my “religion” is, but it will not make complete sense to anyone else in the world, because no one else shares my exact same position next to this impossible elephant. Why? Because no one else is me.

Here is the conclusion from a John Saxe poem

So, oft in theologic wars
The disputants, I ween,
Rail on in utter ignorance
Of what each other mean;
And prate about an Elephant
Not one of them has seen!

The complete poem is here

Posted in Philosophy | No Comments »

On the need for religion

October 27th, 2007 admin

After thinking a bit about the nature of religion, I started thinking about the need for it. Why are the blind men so intent on discovering an elephant? Here are some thoughts related to that topic. Again, Samya was the motivation behind putting these up on this website, and once again, a fable helped me explain the thoughts.

Another fable that I think applies to real life is the “grapes are sour” story . That one, as I recollect, portrays a fox that gives up on reaching a grape vine, consoling itself by saying that the fruit is not worth the effort. The way the story was presented to me seemed to imply that such an attitude is laughable and that one should be honest with oneself.

However, I believe that there is much to look up to in the fox’s attitude. The fox was able to weigh the cost and the benefit given the situation it found itself in, and decide the cost is more than the benefit. Such analysis is very important in real life too. It keeps us from getting stuck. Further, the fable seemed to imply that the fox wrongfully chose to “believe” in falsehood. It knew that the grapes would be sweet, but it still walked away thinking and saying they are sour! But think about it. Lots of people are able to live their life without going insane because of such an attitude. If a poor person suffers from a dreaded illness that has a cure but is expensive (or if a poor person, for no fault of his, gets run over by Salman Khan’s SUV), often they or their relatives resign to their fate saying that such is their karma, or saying that they must have done something wrong in their past lives, or that such was God’s plan, or even more tragically, that God loves that person more than others.

Those we call religious and those we call superstitious might actually be very reasoning oriented. They are so starved for a reason for why bad things happen to them that they create, or succumb to, this pacifying fantasy of their being a superhuman controlling their destiny; that there is someone who sees and cares. If you read the book “The Life of Pi”, this is the underlying theme in the book. There is a plain, calculated, probabilistic world where you do have a certain vaguely measuarable probability of dying in a freak road accident. And then there is the world where the accident had a reason behind it. Someone had a plan for why it had to happen. You did not die a meaningless death. No wonder we choose the latter view of the world under extreme helplessness.

The fox could have walked away acknowledging that it was completely helpless and that it would never, in its lifetime, be able to taste grapes, or, the fox could have walked away genuinely believing that grapes are sour. Guess which way the fox would be able to continue living with some sense of equanimity? Afterall, sometimes, we do take life too seriously, And sometimes, these grapes *are* overrated.

Posted in Philosophy | No Comments »

In Phase Interview

September 30th, 2007 admin

A little over a month ago, Sourabh Sriom, a current student at Indian Institute of Technology, Guwahati, contacted me for an interview. IITG is where I earned my Bachelors degree. Our class, the class of 99, was the first to pass out of the new institution. The ECE Department at IITG has an ECE society called Cepstrum. On september 20th, 2007, Cepstrum released the first issue of the monthly magazine called In Phase. The purpose of In Phase is to both help the students be in touch with the happenings in their field, Electonics and Communications Engineering, and to help restore the social networks between alumni, faculty and students. I was honored to be asked for an interview. It helped me give the current students a view of how my career progressed, after graduating from IITG, and also helped me a chance to reflect on a few things. I would like to thank IITG and Cepstrum for giving me this opportunity. I also was pleased to see the continued support of the faculty at IITG, many of whom I studied under, in this endeavour. It was great to read Dr. P. K. Bora’s communication to the In Phase team, which appears in the magazine too. Here is the original link to the magazine, which appears in the Cepstrum webpage here. I also made a local copy of the magazine on my webpage here. Note that this is a 5.8MB pdf file. It might take some time to open up, and your browser needs to be able to open pdf files. A few questions and answers form my original response had to be removed due to space constraints in the magazine. If you just wish to read the interview questions and answers, the full interview follows.
1. Being a student of the 1st batch of our IIT, tell us about your apprehensions and pre-conceived notions, if any, about IITG.

From what I recollect about my state of mind then, I believe I was more excited than apprehensive. The opportunity to study at an institution where the quality of education, faculty, students and facilities was reputed to be at par with the best in the country excited me. My inclination was towards ECE as a subject area and I was only grateful that I could pursue that subject at IITG when I probably could not elsewhere, given my rank in the JEE. My only preconceived notions about IITG were that it would be a young institute looking to build itself, both in literal terms and in its beliefs and character. I knew it would be an institute that would not have much to show for itself in the first few years in brick and mortar terms. I also knew that when you put smart, motivated and courageous people - people who were smart enough to get into IITG, motivated enough to prioritize their area of academic interest over the place of study, and courageous enough to choose an hitherto unexplored destination – the chances are good that you will end up with an institution you can be proud of.

2. Did these feelings live up when you finally entered IITG? That is, how were your first few days at IITG?

The disappointment of seeing the small, unassuming, pale, four-storied building tucked in the cramped, commercial heart of the city, further isolated by the agonizing groans and rumbles of slow-moving trains on railway lines on one side, and the noisy arch of the Pan Bazaar flyover too close for comfort on another, could have been overwhelming; for me, however, there as no disappointment. The lack of a tangible, photographable campus with large buildings and facilities was probably compensated for, subconsciously, by trying harder to do the best we could with what we had. And what we had were a batch of 64 motivated students, great faculty and the hope that everything else an institution needs would come in due time. I think the one thing that IITG had from day one was fantastic people. And that takes care of the two main aspects of undergraduate education – developing academic skills and developing social skills.

3. Did you feel let down at any point during your stay here? (If, yes what or who boosted your confidence?)

No. I do not recollect feeling let down at any point. The reason might have, partly, been that I had nothing to compare our experiences to. But even in absolute terms, I think the IITG Administration was sensitive to our needs and were always receptive to our suggestions. Even when there were the occasional drooping shoulders, the administration, faculty members and other students would boost the morale by providing honest perspective.

4. Talk us through the experiences of the rest of your B. Tech, the faculty, other students, and, the placements.

We were lucky to have some highly motivated faculty members whose knowledge of their subject was thorough, and, enthusiasm for their craft, contagious. It was a pleasure to actively learn from them in the classroom and beyond. With 63 other students to begin with and with more joining in the future years, it was a non-stop learning experience in social behavior. The emotional support, comic relief, opinionated exchanges and lifelong friendships are experiences we students shared with each other and the faculty. The combination of our being in our late teens, the 4 years we were together for and the shared adventure that was IITG, might be the reason why the friendships made in those days are still so strong. The placements and higher studies are but a blur in my mind. I remember that even then we were able to attract some of the best companies and were offered good jobs with competitive pay.

5. What prompted you to go for higher studies abroad?

My main motivation for higher studies was that I felt I had only begun to skim the surface of my field and there was a lot more for me to learn. The other school of thought was that what you really need to learn you can learn while doing a job. Though that was true to the extent of doing your job well, I wanted to learn more for its own end. That is, I wanted to learn what great minds of the past had thought up or discovered, for no other reason than that I wanted to know. I had no plans for how I was going to use that knowledge. Why abroad? I wanted to explore the kind of academics and research that is practiced in other reputed institutions of the world. It was, in some sense, IITG all over again - the yearning to put yourself in a new situation, to, hopefully, gain a new perspective.

6. Did the department guide you in this goal of yours? If yes, then in what way?

Yes. Because we did not have any student history to go by, being the first batch, we had to research the process of applying for a PhD or a Master’s ourselves, to a large extent. We had faculty members who were extremely helpful in educating us on how to go about applying, how to attempt standardized tests for graduate school entrance, and which schools to choose, based on their experience and contacts. Lastly, they wrote us honest recommendation letters.

7. What were the major differences you felt graduating from a premier institute in India to doing your PG from a reputed university in the US?

I went to Purdue University in West Lafayette, Indiana, USA for my Master’s in Electrical and Computer Engineering. It was a gigantic University compared to IITG and certainly a bit overwhelming. The size, the history and the bureaucracy were the first things I noticed. It worked like a giant machine with things happening like clockwork running on old but well-oiled and well-cared-for parts. However, I was able to find myself an apartment, make new friends, get a decent understanding of the geography of the large campus, get my head around the official rules and requirements, participate in a different culture, continue good performance in academics, and participate in sports and other extra-curricular activities. So all in all, I think IITG prepared me well to take up the new challenges in the new environment.

8. How did you land up in IBM? Tell us something about your stint there.

Similar to placement interviews at the end of a B.Tech at IITG, there was a job fest organized at Purdue University’s ECE Department. I interviewed with several companies and decided to get some exposure to the industry. I joined IBM, primarily, because of the company’s reputation, the breadth of knowledge the company seemed to possess and because the team that interviewed me seemed to be doing very interesting work. The main difference between academia and industry is that industry tries to channel research into an end product that is tangible, useful and therefore, sellable. IBM has a Research division too; however, the team I joined is part of Development. I work as a Future System Performance Engineer. My work deals with helping hardware designers and system architects optimize the design of a future computer system such that it performs the best it can, given various requirements, such as expected workloads, throughput and latency requirements, and constraints, such as the area and power budget, architectural or microarchitectural extensions allowed etc. I learn a lot of new things on the job and work with some very sharp people.

9. At what point during your job did you make up your mind to go for a PhD?

I noticed that high importance is given to innovative thinking at IBM. I realized that with better knowledge of the Computer Architecture field, I could not just solve the current design problems better, but more importantly, I could foresee future problems and try to incorporate that vision into the current solutions. I also noticed that in the region where I live and work, there were several good Universities and IBM management was always supportive and encouraging in allowing me to go back to school for either an MBA or a PhD. So after working for about 4 years at IBM, I applied to and joined North Carolina State University in Raleigh as a part-time PhD student. By then I had gotten a reasonable understanding of the types of design and technology constraints computer architects and hardware designers face in their work and the kind of solutions that make a product competitive in the market. I thought the time was right to look at the directions academia was taking in this field. Academia and Research are typically a few years ahead of the Industry and Development. Therefore, being in touch with academia allows you to see patterns that would be harder to see from within the industry.

10. How was research in ECE different from a job in the area?

Though I have not yet started serious research as part of my PhD, and am currently taking classes and only recently formed my Advisory Committee, I can give you my current view on this topic. Since I joined my PhD after some exposure to the industry, I can research a topic that is a new and interesting problem both in academia and industry. Such overlap is usually not perfect, but if research in an academic setting is guided to some extent by real problems faced by engineers, it leads to research that is more purposeful.

11. How would you compare India and the US in terms of opportunities in the ECE field?

Having limited exposure to the industry in India, I have to go by my understanding of what I have heard or read. I believe that India has a foot in the door to becoming a knowledge superpower. India is already a major player in the software and services industry. From being a middle-man providing support to the producers and the consumers, India is itself moving towards being a big producer and a big consumer. That is a significant shift, because as a producer you create value where it did not exist before, and as a consumer, you provide a reason for the producers to produce. India seems to be on the threshold of a gear change in this engine of value-creation and value-aware-demand. In ECE and related fields the differences in opportunities between the US and India will continue to shrink as long as India continues to take the opportunities that come her way and discover or create new opportunities on her own.

12. Would you like to share a piece of advice with our readers about how they should plan their career moves.

Based on my limited experiences, based on what has served me well, assuming a vast majority of the readers are students at IITG, and assuming a general guideline rather than a strict example is useful, my advice is, be honest and positive. By honest, I mean several things. Be forthright in your assessment of where you are, where you want to be, how to get there. Be a humble follower when you should be, and likewise, a confident leader when you should be. Be connected to reality by being aware of your thoughts, your motivations, your limitations, your duties and your actions. By positive I mean, most importantly, try to keep improving yourself. Try to do the best job in everything you do. How you define “improvement” or “best” depends on how honestly you can judge where you are and where you want to be. Try to improve that ability to judge as well. By positive I also mean be creative. Get into the habit of practicing your innate creativity. We have the brains and the training to actively create value, rather than passively consume it. Even when being a consumer be an active one. Be a good follower (active consumer) and be a good leader (active producer). Let the opportunity to partake in creativity guide your career moves.

13. Finally, a word for the very first people at IITG, the director, the faculty of the department, the HOD. I’m sure they all would be proud of you.

I am and have always been impressed by the positive energy of the IITG Administration and Faculty. In twelve short years the progress made by IITG has been remarkable and most of the credit should go to these nurturing souls. I am grateful and proud to have been, and still be, a part of IITG. I am positive it will continue to grow in stature and fulfill its role in shaping the world.

Posted in Experiences, Information, Philosophy | No Comments »

Finally, one Contact List to rule them all

July 29th, 2007 admin

I have a Yahoo email account. I have a Google email account. I have a few more that I do not use much. Each email application or service provider typically has an Address Book or Contacts List, which we can use to list the names, email addresses and other information about people. For a while, I have been thinking about getting the contact lists organized. There were several layers to the word “organized” and I was apprehensive about starting to peel those layers. The first layer of the problem was figuring out which mail server I wanted to stick to. The next thought was to create a superset of all the contact lists, currently scattered across applications and mail servers, at one place. The next issue was to find a way to update the contact list quickly, rather than clicking around a web-based Address Book or Contact List applications such as the one provided by Yahoo and Google Mail. Then there was the hope that I could keep a copy of the contact list locally on my personal computer, in case, at some point, I did not have internet access to get to the Yahoo Address Book.

This list of requirements seemed formidable in itself, yet, what made me skeptical of a final solution, was one last requirement I had. I had maintained a list of birthdays and anniversaries in a text file separate from the contact lists in the mail servers I mentioned. It was a simple text file and a simple Perl script I wrote could go through this text file everyday and send me an email if it found any upcoming event. I wanted to retain the ability to do such scripting and not have to maintain a separate text file version of the contact list, just for the purposes of being able to run such a reminder script.

After collecting and formulating these thoughts over a long time, I finally spent a few minutes last week looking for a solution to the multi-layered problem. Searching on the internet revealed that there WAS a relatively easy solution that fixes ALL the above problems, including giving me the ability to run a simple script to extract birthday and anniversary information! Here is the solution. Yahoo and Google Address Books allow the existing contacts-list to be exported as a CSV (Comma Separated Variable) file, or a CSV file to be imported to populate the Contact List or Address Book application. A CSV file, as the name suggests, is just a regular text file, with many fields belonging to a record typed across a single line, with the comma symbol (”,”) separating the fields. A new record starts in a new line. The file can be opened with a regular text-editor such as Notepad, Wordpad or Textpad in Windows and vi, pico and emacs in Unix. The file may also be opened using Microsoft Excel spread sheet and the fields show up in separate column and the lines show up in separate rows. This solves the problem of easily modifying the contact list in bulk and storing the contact list as a local file on your personal computer. The CSV file is compatible across Yahoo and Google, and probably across many other applications like Microsoft Outlook and Orkut (web-based networking application). The CSV file can then be imported into Yahoo Mail, Google Mail or other such applications. Problem solved. Single contact list. Storable and updateable locally. Uploadable to multiple web-based servers.

The CSV file based common contact list also allowed me to enter the anniversary and birthday in appropriate columns. I wrote a script called contact.py in the Python scripting language to read the contact list file as a simple text file (in the CSV format) and search for upcoming events. This allowed me to get rid of the earlier text file I had my Perl script read. The CSV file, I called it contactlist.csv, was truly the one file I needed to retain for all my address-book related needs. Whenever I want to add a new contact or update information about an existing contact, I update the local copy of the contact list, contactlist.csv, and then import it into Yahoo Mail and Google Mail to keep them up to date. I have noticed that before I import the latest contactlist.csv file into Yahoo or Google, I need to delete all the existing contacts from Yahoo and Google, respectively. Once, we have an empty contact list on the mail server, the importing of contactlist.csv recreates the complete list. Not starting with an empty contact list on the mail servers, creates duplicates, probably because the “import” function is not smart enough to recognize duplicates.

Here is an example of what a few rows from the CSV file contactlist.csv looks like. It gives us idea of what the fields are. The example also shows that all the fields in a CSV file need not be filled. A field can be left empty if we do not know the information relating to that field for a given contact. Also, I use xxxx for the year field of a date (such as a birthday or an anniversary date), in case I do not know the year. This is OK because the script that parses this CSV file, called contact.py, and which is shown later, does not use the year field to determine if an anniversary is approaching. It only uses the day and month parts of the field.

First,Middle,Last,Nickname,Email,Messenger ID,Home,Work,Pager,Fax,Mobile,Other,Yahoo! Phone,Alternate Email 1,Alternate Email 2,Personal Website,Business Website,Title,Company,Work Address,Work City,Work State,Work ZIP,Work Country,Home Address,Home City,Home State,Home ZIP,Home Country,Birthday,Anniversary,Custom 1,Custom 2,Custom 3,Custom 4,Comments,Messenger ID1,Messenger ID2,Messenger ID3,Messenger ID4,Messenger ID5,Messenger ID6,Messenger ID7,Messenger ID8,Messenger ID9,Skype ID,IRC ID,ICQ ID,Google ID,MSN ID,AIM ID,QQ ID
Shahrukh,Mayur,Khan,srk,srk@bollywood.com,,,,,,,,,,,,,,,,,,,,,,,,,1/2/xxxx,,,,,,,,,,,,,,,,,,,,,,

Here is the contact.py Python script which then works on the CSV file called contactlist.csv with contents as shown above, and sends email to your email account. You might have to appropriately fix some of the fields in the script to get it to work. I present it here just as a hint.

import csv, datetime, re
from string import split
filename = “contactlist.csv”
warnZone = 8 #number of days before which email reminder should be sent

daysInMonth = [’31′,’28′,’31′,’30′,’31′,’30′,’31′,’31′,’30′,’31′,’30′,’31′];
def dayOfYear(month, day):
#print “%s %s” %(month, day)
doy = 0
for n in range(0,int(month)):
if(n == int(month)-1):
doy = doy+int(day)
return doy
else:
doy = doy+int(daysInMonth[n])

now = datetime.datetime.now()
today_month = now.strftime(”%m”)
today_day = now.strftime(”%d”)
today_doy = dayOfYear(today_month, today_day)
#print “%s %s %s” %(today_month, today_day, today_doy)

reader = csv.reader(open(filename))
content = “”
for row in reader:
firstname = (row[0])
middlename = (row[1])
lastname = (row[2])
anniversary = (row[30])
birthday = (row[29])
anni_split = anniversary.split(’/')
bday_split = birthday.split(’/')
#print “len anni_split %s” %(len(anni_split))
#print “len bday_split %s” %(len(bday_split))
if(len(anni_split)>1): #keeps “a/b/c, gets rid of “A”, as in 1st row
anni_month = anni_split[0]
anni_day = anni_split[1]
anni_doy = dayOfYear(anni_month, anni_day)
diff = anni_doy - today_doy
if((anni_doy >= today_doy and anni_doy <= today_doy + warnZone) or (anni_doy <= today_doy + warnZone - 365)):
# print “%s %s %s’s anniversary is on %s/%s” %(firstname, middlename, lastname, anni_month, anni_day)
content += firstname+” “+middlename+” “+lastname+”\’s anniversary is on “+anni_month+” “+anni_day+”\n”
if(len(bday_split)>1): #keeps “a/b/c, gets rid of “A”, as in 1st row
bday_month = bday_split[0]
bday_day = bday_split[1]
bday_doy = dayOfYear(bday_month, bday_day)
diff = bday_doy - today_doy
if((bday_doy >= today_doy and bday_doy <= today_doy + warnZone) or (bday_doy <= today_doy + warnZone - 365)):
# print “%s %s %s’s birthday is on %s/%s” %(firstname, middlename, lastname, anni_month, anni_day)
content += firstname+” “+middlename+” “+lastname+”\’s birthday is on “+bday_month+” “+bday_day+”\n”

#print “%s” %(content)

import smtplib
smtpserver = ‘mailserver.department.company.com’
AUTHREQUIRED = 0
RECIPIENTS = [’gol345die@gmail.com’]
SENDER = [’con789vey@po.doc.com’]
session = smtplib.SMTP(smtpserver)
smtpresult = session.sendmail(SENDER, RECIPIENTS, content)
if smtpresult:
errstr = “”
for recip in smtpresult.keys():
errstr = “”"Could not deliver mail to : %s Server said: %s %s %s”"” % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
raise smtplib.SMTPException, errstr

Posted in Information, Tutorials | No Comments »

Whaatay Wondraful!!

June 1st, 2007 admin

The old joke goes, “Are you ready?”. “No, I am Zail Singh.”. Zail Singh, a former President of India, misinteprets the question to mean “Are you Reddy?”, where Reddy refers to Neelam Sanjiva Reddy, the President of India prior to Zail Singh’s term. In any case, here, though Reddy was not part of a joke, he was responsible for keeping the jokes coming along at a fast clip thoughout the weekend. Sandeep Reddy’s non-stop nonsense, off-the-cuff lines kept us all in good spirits. His “Whaatay wondraful!” or “What it is?” or “No way! Jose.” or the dozens of other mimicry/impersonations of popular phrases were inimitable. Nandu’s “Let’s make a U-turn”, “Let’s all calm down” and his forays into telegu literature (restricted to “Aithey?”, “Ouna?”, “Yenti?” etc, through sheer self-control), or my “Have a happy” also come to mind as other quotes that were overheard during the trip.

Memorial Day weekend, 2007, was May 26th , 27th and 28th. Kavita and I left Raleigh on Friday evening, May 25th, and reached Cincinnati at 9:30 PM. Sandeep and Gayatri picked us up while Nandu and Shalini picked up the 7-seater, Hyundai Entourage, which we were to use for our trip to Gatlinburg the next morning. The occasion was the yearly reunion that Mili organizes and this year we had 20 members participating. Mili and Sandeep live in Florence, Kentucky and people (related or otherwise, like us) converged onto Florence from places as varied as California(Nandu and Gayatri), Chicago(Kavita akka, Kanth uncle, Shalini, Ashwini, Kavita akka’s brother Karthik and Kavita akka’s parents), Anderson, Indiana(Uma auntie, Guna Uncle, Deepak and Guna uncle’s sister), Kansas City(Varun, Sushant and Prasanna) and Raleigh(Anil and Kavita). The influx went on until 4:30 AM on Saturday. The venue of this gathering changes every year and this time it was decided that after initially coverging at Florence, the group would head to Gatlinburg, Tennessee, which is at the northern foothills of the Great Smoky Mountains.

Friday night, when we got home, dinner preperations were going on, although mostly done - Grilled vegetables on skewers, barbeque chicken, vegetable biryani, Raita, bottle Gourd curry and Sandeep’s ‘hit’ dessert made from Marie biscuits stacked together side by side with cocoa and cream sealing them together. After the wonderful dinner, our hostess, Mili, clarified what everyone’s sleeping arrangements were, and everyone prepared to get some sleep, although I hear from Kavita that they were talking deep into the night.

We left at 7:30 AM on Saturday in 4 cars, after a thankfully brief discussion of whether to fit 20 people into 3 cars and save both gas (which is hovering around $3 a gallon) and the communication/co-ordination overhead, or, to take 4 cars and pay the extra price but get some flexibility with space in the cars. We wisely decided on the latter. 7:30 AM was surprisingly nimble-footed for a group with the inertia that 20 people generate. Mili, Uma auntie, Kavita akka and her mom took care of the kitchen activities with utmost efficiency. Throughout the trip they made sure we all got our morning teas or coffees, breakfast, lunches and dinners. In whatever was prepared in the kitchen, there was usually a range of choices, no repeats, and everything was prepared with gusto, speed and expertise.

In our car (a 7-seater van to be more accurate) were Sandeep and Mili, Nandu and Gayatri, Kavita and I, and 11 year old Shalini, aka Shalu or Leany. The drive, both during the onward and return journies was smooth sailing except in the vicinity of Gatlinburg. Sandeep’s Garmin, his portable GPS (Global Positioning System), would show exemplary patience, calculating and recalculating routes for us even when we missed innumerable exits and turns. Enchanted by the patient, sagely, mastery of the roads, Sandeep referred to “her” as his girlfriend, Garmin Electra. (By the way, there is a real actor by the name Carmen Electra.) However, by the time we got to our cabin, the relationship was a disaster. Sandeep lost his faith in Garmin Electra’s sense of direction and “patience being a virtue” notwithstanding, conceded that she took us for a ride towards the end. After countless U-turns on steep, hilly roads, we somehow got to our lodge two hours behind schedule. The U-turns were lent an added dimension of thrill because there were three other vehicles in tow and the ‘leader’, me in this case, had to keep them in mind when making any U-turn decisions or pull-over decisions.

The lodge at “Gatlinburg Hills” resort was a full-fledged, all-furnished house with 4 bedrooms, a living room, a kitchen, 3.5 bathrooms, 3 balconies with rocking chairs and one with a hot tub where Shalini and Ashwini had a great time and an entire floor devoted to the entertainment/game room with a pool table, a video-game machine, an air-hockey table, a big screen TV, a long L-shaped couch and a 2-storey bunk-bed. On Saturday, after reaching the lodge, we mainly relaxed. We had an early, yet sumptuous, dinner, which mainly Kavita akka and Uma auntie expressly prepared. Dinner included sambar, rasam, curd-rice, egg-curry etc. Later we enjoyed a short walk downhill to the rental office for the luxury homes, came back and played a lot of games in the game room. Eventually, everyone retired for a night of well-deserved sleep. I slept on the lower level of the bunk bed in the game-room.

On Sunday, we woke up a little late to make up for the lack of sleep everyone subjected themselves to the previous night, thanks to the excitement of seeing old and new faces. The checkout time was 10 AM, so we all got ready and had a wonderful breakfast of scrambled eggs, tea or coffee, and upma. Once we were all ready, packed and loaded, and after we completed a final inspection of the lodge to make sure we were leaving it in good shape, we checked out of it on time. Then we drove towards Clingman’s Dome. We stopped along the way at several lookout points as our cars began the climb into the hills. There was a beautiful creek that the road was never too far from, for a while, during the drive. We stopped and went up to the creek at one spot and took some pictures there. We took about an hour to reach the Clingman’s Dome parking area, from where a 20 minute hike took us to the highest point in the Smokies. The lookout tower on the Clingman’s Dome point had a long spiral ramp that allowed us to get to the lookout platform, which gave us a 360 degree view of the Smokies around us. The point is at a height of 6643 feet, the highest point in the Smokies and the second highest point in the US, east of the Mississippi river. Also, half the hill is in Tenessee and half in North Carolina. So in one way, Kavita and I went from North Carolina to Florence, Kentucky twice this weekend and came back twice this weekend. On the way back down to the parking lot from the Clingman’s Dome tower, Gaay suggested we take a hiking trail called the Appalachian Trail, instead of walking down the same paved path that we came up on. Some of us were up to it and took the trail, the others, especially elders and children, went down the regular paved path. Many of us taking the trail were not sure it would eventually get us back to the parking lot, but gauging Gaay’s confidence, decided to be obedient followers. After Clingman’s Dome we drove down to downtown Gatlinburg where we took the “Sky Lift” (chairlift) trip up a different hill. With our feet dangling in the air, and the landscape we crossed including a large creek, it was a fun ride. Sandeep and Mili in the chair in front and Nandu in the chair behind our’s (Kavita and mine) kept us good company. Kavita was semi-petrified, clung on the the chair and refused to turn around when Nandu wanted to take a picture.

The return drive, for the most part, was uneventful. We did spend a lot of time getting out of Gatlinburg because Garmin Electra was still confused and we did not have good maps. We were late enough that it did not make sense to try and return the car the same day and pay late charges. So, Sandeep called Hertz and extended the rental by a day for the same daily rate ($71, I think). Nandu and I shared the driving while Sandeep navigated. Kavita and Gaay’s murmuring could be only faintly overheard as it deflected the beautiful strummings of Simon and Garfunkel, whose music we played.

Monday was a relaxed day. The families/groups left one by one. Nandu took care of the rental and the gas for the van throughout the rental. Sandeep took care of paying for the lodge, the groceries etc. Kanth Uncle had paid for the Sky Lift tickets. Monday morning we decided to let Sandeep get back to all of us with the expense report and payment options later. Overall, in spite of the the minor driving direction fiascos, rental extension etc., it was a good break from work and life. I had semi-voluntarily (upon Kavita’s request) decided to not carry my laptop during this trip. My cell phone decided to use the opportunity and die on Friday evening. So I was disconnected from the rest of the world in more ways than one. A few minutes of checking email and cricket score on Kanth uncle’s laptop, Sunday night, were my only contact with the outside world. As we await the flight to Raleigh, to start boarding at Gate C3, at Charlotte’s Douglas International Airport, I look back at the last few days as a happy experience where I met lots of wonderful people, saw a beautiful part of the country, relaxed and refreshed myself for summer 2007. Next year’s meet might be in San Francisco, Yellow Stone National Park or Raleigh. Nandu, of course, wants an advance notice in case it is in SFO, so that he can make other arrangements and sneak out before the troops show up.

Anil Krishna
May 28th, 2007

Pictures from this trip are here

Posted in Experiences, Friends, Travel | No Comments »

Visiting the Somanis

May 21st, 2007 admin

It is Sunday evening, May 20th, 2007. Kavita and I are currently driving back home to Cary, North Carolina, after a weekend with Sandeep and Anu Somani in Maryland, and Tarun and Sarmishtha Pruthi, who drove down from Cleveland. The main motivation for the trip was Tarun’s commencement ceremony at University of Maryland, College Park, which drew the Pruthis down. We wanted to use this opportunity to meet with them all, and so we drove up from Cary to Columbia, Maryland. Kavita’s Pontiac Vibe has a 100W, 110V power outlet built into the dashboard, which makes it easy for me to use this time, sitting in the passengers’ seat, to recollect or form my thoughts about the last few days, type them out on my laptop, free from any concerns about the battery in my octogenarian (in computer years) laptop running out.

The weekend with friends was relaxing and enjoyable thanks especially to some excellent, yet almost unnoticed work by our hostess, Anu. Kavita and I reached Friday night around 11:30 PM, stifling away yawns the entire second half of the 5-hour drive. It had been a long day for both of us. I had several long drives that day even before embarking on the one to Maryland - drive to work, then to NC State to meet Dr. Gehringer, and finally to UNC to pick up Kavita. A few minutes after we reached, Tarun and Sarmishtha reached the Somani residence. Seeing them all, the aches and sleepiness of the journey, and the entire day, slowly evaporated. The night returned more than the lost evening hours, turning younger, refueling our energies. The chatter of catching-up cheerfully filled the air. The night, with wives’ reporting on their newly discovered traits of their respective husbands to each other, and the husbands, selectively reflective, selectively opaque, enjoying the harmless jabs, drifted on until about 4:30 AM. Even then, in that state between sleep and waking, as practical considerations of plans for the next morning waged small battles in every mind with the anticipatory urge to spend just a few more minutes to relate one more story, it was hard to notice, let alone resist, the soothing and welcoming shoulder of sleep. Through individual failings or general consensus, sleep, deemed inescapable, was respectfully accepted.

The highlights of Saturday were the ladies going out together for pedicures, manicures, facials and other such maintenance procedures, apparently required for continued warranty coverage, the men breakfasting at the Double T Diner and, later, discovering new muscles in their body after playing squash in a racquetball court (the discovery followed the play by a few hours for took that long for the soreness to set in), a wonderful lunch of exquisitely decorated dahi-vadas, black gram curry, jeera (cumin-seed) rice, poppadams (rice crisps) and almond pudding thanks to Anu, and, an evening visit to downtown Washington DC, where after enjoying a stroll through Dupont Circle, Claude’s photo shop, a couple of coffee shops and swinging to street jazz, Dr. Tarun Pruthi treated us all to dinner at Taberna Del Alabardero, celebrating the completion of his PhD. Earlier, during the day, Sandeep and I also planned to go to see the famous Preakness horse race. We eventually gave up after a call to the racecourse informed us that only General Admission tickets were available, were $25, and would only allow us to see the horses on monitors.

The first highlight of Sunday was a trip to an IHOP (International House of Pancakes) near College Park, for breakfast, where exceptionally long lines and unavailability of a table in spite of making a reservation, forced Sandeep to generate a brain wave, suggesting we go to a nearby Hindu temple, where we could also eat. Manish Saxena (Mau) and his wife, Archana, also joined us at IHOP. We all headed to the temple, had “darshan” followed by lunch. We did start out with breakfast in mind, but settled on using a more appropriate name for the eating performed at the temple, with a sincere regard for time. The second highlight of Sunday was a visit to IKEA, the Scandinavian furniture/home-furnishings store, which due to its sparse locations across the country, and due to its cheap, yet good decoration ideas and furniture, is often on our list of places to visit when in the Baltimore area. In the morning, Tarun had to also, in parallel to the activities of the others, exchange his convocation gown because Sandeep, who was supposed to pick up the gown and cap for Tarun, mistakenly reported Tarun to be 5 foot 10 inches in height. The gown Sandeep picked, therefore, did not fit the 5 foot 7 inches frame of Tarun’s when he eventually tried it, although, interestingly enough, the cap fit perfectly. We attributed Tarun’s PhD to his disproportionately bigger head. He did manage to get a correct-fitting gown today. Tarun and Sarmishtha headed out for the convocation ceremony by around 6 PM, and Kavita and I, started our return journey around the same time.

Of course, Anu, starting Friday night itself, prepared or arranged for tea and snacks or other beverages for all of us, at regular intervals. Everyone was quite appreciative of my photography experiments using my Canon Rebel XT, and everyone was quite content to let me click around as they played scrabble, or sipped their drinks, or generally displayed a range of natural emotions. I, in my role as a cameraman, was ignored, and I was thankful for it, just as I am currently, in my role as a writer.

The sun is setting to my right, as we hurtle down I-95. Tomorrow is another day, in another week, in another May, of another few lives. Not a big deal, this weekend, nothing to write back home about, but then, I did think it was special in its own circumstance, in its unplanned, uneventful, unsurprising way. I did decide to write about it.

Anil Krishna
May 20, 2007

Pictures from this trip are here

Posted in Experiences, Friends, Travel | No Comments »

A puzzled family

April 22nd, 2007 admin

This year started with several of my family members contributing several puzzles. I decided to compile them here since the puzzles were, firstly, interesting and secondly tell you a little bit about the people who asked them. Anant, my brother, sent the following in an email to me and my family. He said he found it on an IBM puzzler website. He, however, modified it a bit to make it more interesting to us all. Here’s Anant’s puzzle.

Anant’s Party Puzzle

Anil and Kavita attend a party with 3 other couples,including Srini and Shyamala (a couple). During the party everyone shakes hands with a certain number of other people that doesn’t include oneself and one’s spouse. At the end of the party Anil asks each person (apart from himself) how many people they shook hands with. He finds that each person answered truthfully and each one gave a different number. Anil did shake hands with Srini. From this information find out
1: Did Kavita shake hands with Srini?
2: Did Kavita shake hands with Shyamala?
Adapted from a puzzle found here (the last but one puzzle June 1998): http://www.research.ibm.com/ponder/

Solution:

Anil asks 7 people and gets 7 different handshake counts. The maximum count can be 6, since a person does not shake his own hand or his spouse’s. The 7 non-negative numbers (there cannot be negative counts) with a maximum of 6 are 0, 1, 2, 3, 4, 5, 6. Whoever has a count of 6 shakes hands with all the other people (other than his or her spouse, of course). Therefore, only that spouse can be the one with the 0 count. If Kavita were the person with the count of 6, no one but Anil could have had the count of 0. But Anil did hear someone else say 0. If Kavita were the person with a count of 0, no one else could have claimed 6. However, someone did. So Kavita does not have a count of 0 either. There is some couple with counts of 0 and 6. If that couple is removed from contention, everyone reduces in count by 1, the 1 coming from their handshake with the person with count 6. Anil and Kavita shook hands with one person in that couple (the one with the count 6). The remaining counts become 0, 1, 2, 3, 4. Whoever has the count of 4, partners the spouse with count of 0, using logic similar to above. Also, this couple cannot be Anil and Kavita. If Kavita had a count of 4, no one could have claimed a count of 0. If Kavita had a count of 0, no one could have claimed a 4. Therefore, the 4-0 pair is not Anil-Kavita. Again, Anil and Kavita shook hands with one person in that couple (the one with the count 4). Removing the 4-0 pair (originally the 5-1 pair) from contention, we have the counts of 0, 1, 2.
Using similar logic as above, the 2-0 pair is not Anil-Kavita. Removing them (original pair 4-2), leaves Kavita alone with the count of 0. Bumping it back to the original count gives us 3. Kavita and Anil shook hands with one person in each couple, and, Anil and Kavita shook hands with the exact same people. So, to answer the specific questions - Yes, Kavita shook hands with Srini, and, No, Kavita did not shake hands with Shyamala.

Raghu’s Peanuts Puzzle

Later, when we visited my cousin and his family in New Jersey, he asked me and Anant a high protein mathematical puzzle laden with peanuts. I will recreate the puzzle from memory here.
There are 5 friends and a pet monkey. They also have a bag of peanuts. The are travelling through a tropical jungle in southern India when they decide to stop for the night in a clearing. They pitch the tent and go to sleep. One of the 5 friend wakes up in the middle of the night, a little hungry. He remembers the peanuts. He steps out quietly, careful not to wake anyone up, with the peanuts bag, divides up the peanuts into 5 even parts. He finds one extra peanut remains after the division. He feeds the remaining peanut to the monkey, eats his share and goes back to sleep. The other 4 friends wake up one after the other also and do the exact same thing as the first guy. Then, morning comes. Everyone wakes up refreshed and, unsurprisingly, a little hungry. They divide up the peanuts in the clearly smaller looking bag. And again just like each of them had found in the night, they find one peanut remaining. They feed that to the monkey, taking the monkey’s total intake to 6 peanuts, and eat the remaining peanuts. How many peanuts were in the bag when they pitched the tent?

Solution:

Raghu had asked me this puzzle about 4 years ago, when I had visited them in Alpharetta (near Atlanta), Georgia. I am not sure if my then recent exposure to discrete mathematics at Purdue University helped, or, as might be more likely, my mathematical intuition worked better then. I was actually able to solve the puzzle without resorting to a spreadsheet or a computer! This time around I found it harder to imagine up a way to solve it without a computer. I did find the answer with a spreadsheet program, but that was hardly consequential. More than getting the answer, this exercise was, for me, a journey in figuring out how to solve it without a computer. And in doing so I learnt something about what such problems are called and a generic way to solve them. This problem appears in several places in the web with coconuts in place of peanuts. The solution also appears in several places. I will try to recreate my approach.

Say, the initial number of peanuts is N.
When the first guy wakes up he sees N peanuts. When he is done eating there are (4/5)(N-1) peanuts.
When the second guy wakes up he sees (4/5)(N-1) peanuts, which is
(4/5)N - (4/5).
Similarly, when the third guy wakes up he sees, (4/5)[(4/5)N - (4/5) - 1] peanuts, which is
(4/5)2N - (4/5)2 - (4/5)
Extending the pattern, when the fourth guy wakes up he sees,
(4/5)3N - (4/5)3 - (4/5)2 - (4/5) peanuts
Extending the pattern, when the fifth guy wakes up he sees,
(4/5)4N - (4/5)4 - (4/5)3 - (4/5)2 - (4/5) peanuts
When they all wake up the next morning, they all see,
(4/5)5N - (4/5)5 - (4/5)4 - (4/5)3 - (4/5)2 - (4/5) peanuts
This, is again divided evenly amongst the 5, after a peanut is given to the monkey. That implies that the above count of peanuts is precisely 5k + 1, where k is some integer.
The final equation looks like,
(4/5)5N - (4/5)5 - (4/5)4 - (4/5)3 - (4/5)2 - (4/5) = 5k + 1

This reduces to,
(1024/3125)N-(1024/3125)-(256/625)-(64/125)-(16/25)-(4/5) = 5k+1
=> (1024/3125)N-(1024/3125)-(256/625)-(64/125)-(16/25)-(4/5)-1 = 5k
=> (1024/3125)(1/5)N-(1024/3125)(1/5)-(256/625)(1/5)-(64/125)(1/5)-(16/25)(1/5)-(4/5)(1/5)-1(1/5) = k
=> (1024/15625)N-(1024/15625)-(1280/15625)-(1600/15625)-(2000/15625)-(2500/15625)-(3125/15625) = k
=> (1024/15625)N-(11529/15625) = k
=> 1024N-11529 = 15625k
=> 1024N-15625k = 11529

Finally, we got the equation we were after. But wait a second, there are two variables(N and k) and only one equation! That is the equation of a line. You choose any value of N and you can always find a k. How are we to solve that for a single solution or a set of solutions?
Aha! Integers. N and k can take only integral values. So, even though this is the equation for a line, we are trying to find out if this line passes through the lattice points. Such equations have a special name - Diophantine equations. The one at hand, specifically, is a Diophantine equation of the first order, in two variables. These equations have been studied and solved in texts written between 800 BC and 500 BC in India. Aryabhatta and Brahmagupta (around 400AD to 650AD) gave general solutions to such equations and extended the study to higher order Diophantine equations and ones with more variables.
A generic Diophantine equation looks like ax + by = c, where x and y are the variables that must take integer values. a,b,c are integer constants. A equation of this type may have no solutions or infinitely many solutions. An example of an equation with no solutions is
2x + 2y = 5 (No Solution!)
The above equations has no solution because whatever the values of integral x and y, the left hand side is even and right hand side is odd.
A way to think of it is, you can draw a line on a graph paper such that it neatly avoids all the lattice points. I am not sure about this, but intuition tells me that if a line does cross through one lattice point, it will cross through infinitely many. That is, in other words, there are are either no solutions or infinitely many for a given Diophanine equation of the above form.

Now, coming back to the equation at hand, it is easy to see why a spreadsheet is a tempting approach. You vary N from 1 through a big number. You write k in terms of N, and visually inspect if K ever takes an integer value. Though this approach is what I tried at first, it is both ugly, unsatisfactory and unbounded. There might be no way to figure out if there exists no solution!
The solution that follows is based on the approach shown at this BBC webpage about Diophantine equations.

1024N-15625k = 11529
Now pay careful attention. The right hand side (11529) is odd. The first term on the left hand side (1024N) will always be even, whatever the value of N. The second term on the left hand side (15625k) will be even if k is even, and odd if k is odd. If k is even, the whole left hand side will be even. But since the right hand side is odd, this can’t be. Therefore k must be odd. We can, therefore write k is 2a+1. And the equation becomes,
1024N-15625(2a+1) = 11529
1024N-2(15625)a - 15625 = 11529
1024N-2(15625)a = 27154
Now notice that all the terms have a common factor of 2, which when cancelled out, leaves
512N-15625a = 13577, where k=2a+1
Continuing the above logic, and successively substitution 2b+1 for a, 2c+1 for b etc, when a or b should be odd and 2b for a, 2c for b etc. when a or b should be even, we get the following equations.
256N-15625b = 14601, where a=2b+1
128N-15625c = 15113, where b=2c+1
64N-15625d = 15369, where c=2d+1
32N-15625e = 15497, where d=2e+1
16N-15625f = 15561, where e=2f+1
8N-15625g = 15593, where f=2g+1
4N-15625h = 15609, where g=2h+1
2N-15625i = 15617, where h=2i+1
N-15625j = 15621, where i=2j+1
The final equation gives us,
N = 15621+15625j

The smallest positive solution therefore is N = 15621, when j = 0. This is one valid solution. Substituting N in the original Diophantine equation gives us k = 1023. So the 5 friends could have started with 15621 peanuts and had 1023 peanuts the next morning. Of course, they could have also started with 15625 + 15621 = 31246 peanuts (j=1 case) or even more.
I vaguely remember that this is how I had solved it in Alpharetta, GA, four years ago, without knowing anything about Diophantine equations and Brahmagupta or relying on spreadsheets.

My father’s Walkers Puzzle

Then, a few days back, my father, who loves his daily hour-long walks sent us this walking related puzzle. Later, when I wanted to confirm my answer, he informed me that he made the problem up but had not been able to solve it yet! The fact that he was able to think this up is by itself impressive considering the solution is not straightforward, yet, involves elegant abstraction. Since he thought this up when walking with his good friend who I call Subbanna Uncle, I will recreate the puzzle with my father, Kishore, and Subbanna Uncle participating in the activity.
ABCD is a rectangular park with a walking trail on all four sides. The rectangle is of dimensions a units by b units.
Two walking enthusiasts, Subbanna and Kishore, start walking around the park’s trail with same speed, S units per hour.
Subbanna starts at A and goes around the park covering all 4 sides each time repetedly, AD->DC->CB->BA->AD->DC… and so on.
Kishore starts at the same time as Subbanna but starts at B and walks around the park covering 3 sides repeatedly, BC->CD->DA then he turns back to trace AD->DC->CB, turns back again and so on.
1: How many times do Subbanna and Kishore cross each other while walking for a time period of t hours?
2: How many times do Subbanna and Kishore walk side by side in the same direction?
3: What is the time period before the two walking routines repeat an earlier pattern?

Solution:

The park is a rectangle with sides measuring a units and b units as shown.


The pattern that Subbanna follows is shown with a yellow/orange line and the pattern that Kishore follows is shown with a green line.

The beauty of this problem is that it is easier to solve the puzzle by opening up the paths. Both the paths taken by the two walkers are repetitive. What we need is a repetitive representation that would show intersections of the paths accurately, while clearly laying out the paths in time, so that a repetition does not overlap a previous representation. I chose to keep time on the x-axis and label the corners A,B,C,D on the y axis. The speed being constant keeps the path traced by the walkers straight lines on this graph, and also helps assign a scale for the x-axis.
Subbanna’s pattern repeats every (2b+2a)/S hours, while Kishore’s repeats every 2(2b+a)/S hours, as is clear from the graph. While Kishore is going in the BC->CD->DA direction (downward) he intersects Subbanna’s path once or twice. He cannot avoid intersecting because the distance between two parallel orange lines is less than the length of Kishore’s downward path. If Subbanna’s orange line intersects Kishore’s upward path (AD->DC->CB), that has to be the time they walk together.


After time t, the projection of time on to an axis parallel to Kishore’s downward path, is t*S distance units. This is shown as T is the figure, however, to avoid confusion let us continue to use S*t for that distance. In this time, every orange line (Subbanna’s one loop) causes an intersection with Kishore, except if they overlap. Put mathematically,
the total number of intersections = total number of orange lines - number of times orange line and upward green line coincide
total number of orange lines = (t*S - (2b+a)/2)/(b+a) + 1
“number of times orange line and upward green line coincide” is a little more involved. The first time they coincide, (2b+a)/2+n*(b+a)=m*(2b+a), where m and n are integers. This implies,
n*(b+a)=(m-1/2)*(2b+a)
Multiplying by 2 on either side,
2n*(b+a)=(2m-1)*(2b+a)
If (b+a) and (2b+a) are integers,this will happen if 2b+a is even. If 2b+a is odd, this will never happen and Kishore and Subbanna’s paths never coincide. If (a+b) and (2b+a) are not integers, then I am not sure what the condition is for the paths to not coincide. I assume they will always coincide.
From them on they coincide when k*(b+a)=l*(2b+a), which is every LCM(b+a, 2b+a) units.
Therefore, “number of times orange line and upward green line coincide” = (0 or 1)+(S*t)/(LCM(b+a,2b+a))
Here are the final answers:
1: How many times do Subbanna and Kishore cross each other while walking for a time period of t hours?
(t*S - (2b+a)/2)/(b+a) + 1 - (0 or 1) + (S*t)/(LCM(b+a,2b+a))
2: How many times do Subbanna and Kishore walk side by side in the same direction?
(0 or 1)+(S*t)/(LCM(b+a,2b+a))
3: What is the time period before the two walking routines repeat an earlier pattern?
The time period is when the original situation repeats. That is Kishore is at B and Subbanna is at A.
LCM(2*(2b+a)/S, (2b+2a)/S)
Note: I have used LCM for Least Common Multiple, and I do not restrict it to integers alone.

Posted in Tidbits | No Comments »

Bringing beauty back to the eyes of the beholder

April 16th, 2007 admin

Anant sent me a wonderful article from the Washington Post newspaper today. The article, titled “Pearls Before Breakfast”, by Gene Weingarten, appeared on Sunday, April 8th 2007. Here is the link to the article, hoping the link continues to work for a long time.
Pearls Before Breakfast by Gene Weingarten
Reading the article evoked many thoughts which I sent back to Anant in an email, and also present here, hoping that my thoughts might futher thinking on this issue.

Anil: Anant, this is a brilliant cultural and psycological experiment that results in what the author might have found a little baffling, but fails to surprise me as much. That said, I was very happy to have read it, since it confirms my suspicions. My elation in having correctly identified human nature is matched by my disappointment at its meaning. The article distills the theory of three philosophers, regarding beauty, thus - “What is beauty? Is it a measurable fact (Gottfried Leibniz), or merely an opinion (David Hume), or is it a little of each, colored by the immediate state of mind of the observer (Immanuel Kant)?”. Yet another viewpoint, we have all heard of, is “Beauty is in the eye of the beholder.” But I wonder if it really is. Why do people pay hunderds of dollars to go listen to Joshua Bell at a concert? Why do people pay millions for a Van Gogh painting? Are they all acting out of the pure lure of beauty? I sincerely doubt it. Are many a people in the concert audience there because they want to please someone - maybe spouses, maybe bosses, maybe for their own future cocktail discussions? Are many collecters buying paintings to be able to sell it in the future for a higher price, or maybe to appear appropriately dignified and aware in their social circle? Who is judging or defining beauty here? Is it the observer or has the quatification of beauty already been done by a select few; a panel of “experts” who have been given the job of branding, evaluating and weighing beauty of an art-piece? Does their word then percolate down to the ticket costs and price tags? Is this branded beauty making people more aware or less aware of what beauty truly is? Is it training people to not heed to their own sensibilities and evaluations, but rather to always be skeptical of their own belief and to habitually fall in line behind the sensibilities of the masses? This ties in with, and runs against the grain of the overrunning theme in Zen and the Art of Motorcycle Maintenance. “What is good, Phædrus, and what is not good…need we ask anyone to tell us these things?” But is that what is happening? Are we handing over the responsibility, and therefore the return, the true joy, of appreciating what is beautiful, to others? And this ties in with the overriding theme of Ayn Rand’s “The Fountainhead”. The book talks about a world full of second-handers who depend on and imitate, yet resent and try to extinguish the prime movers, the first-handers, the visionaries of this world. This article highlights a subtler expresion of the same distinction; one within a single human being. It points to how, within a single human being, the second-handedness matures and stifles out the primal motivation to be honest, capable judges of beauty that every child is. Thanks for the forward. I hope we can continue to be aware and honest.

The following are a few more thoughts on this issue based on my reply to Anant’s email response, presented as a dialogue (though it was not, Anant’s response came together all at once, not in response to my statements presented below).

Anant: Anil, your analysis was very thought-provoking. I definitely do not think beauty is measurable and even if it is the majority of the people would not have the inclination or time to make that measurement.

Anil: I think beauty is measurable. It is not standardizable. The measure is individual and subjective. The International Standards Organization cannot come up with a “unit” for beauty. However, each one of us, has the capability to distinguish between greater beauty and lesser beauty. Indeed, is that not the resource we tap into when we say “I loved this movie” vs. “It is an Oscar winner, but I did not think it was that great”. What makes me sad is that even though we all have this skill and the sensitivity to appreciate beauty, it is the opposing quality of insensitive honesty that is found lacking. The courage to honestly and individually appraise beauty, rather than meekly submit to others’ appraisals, is what we allow to slip away over time.

Anant: If it is subjective, is there a basic sense of what is beautiful in every person that is built in, like an instinct? Like you said, it is this instinct that is being stifled due to a number of factors: the need to conform, lack of time, wrongly ordered priorities etc.
Another thing that came to my mind was that they really didn’t need Joshua Bell to prove this. For an untrained ear like mine or the majority of people who walked past him, there is no difference between how a world-famous violinist plays and how a merely good violonist would play. But I guess the stamp of “genius” that the experts have put on Bell does make the story more dramatic.

Anil: The whole point of beauty is that even to untrained ears like ours it should still qualify as beautiful! The ear of a child is probably untrained, at least in the sense you probably meant it, yet, if the music conformed to his or her sense of beauty, the child would be attracted to it. It is important to recognize that I am not saying the passers-by were stupid. Maybe the music itself was overrated! Afterall, the music that some Victorian-era musician composed with great elation and suffering, does not automatically qualify to become beautiful. As a slight diversion, my take on the issue of effort is that honest, sincere creative effort more often results in beauty than secondhanded imitation. So, for all the effort the composer and the violinist put in to the performance, the result likely will be quite beautiful. But it does not necessarily have to be. My take on the experiment itself, however, is that things of great beauty might still need time to familiarize themselves to the observer; they might not be beautiful at first sight and might need the “state of mind” that Kant talks about. The results of the experiment were partly sullied by the requirement that music, more than visual art depends on the “state of mind” and time to prove its worth. In any case, my thoughts in the previous mail were more or less independent of this particular experiment, although the article certainly evoked those thoughts.

Posted in Philosophy | No Comments »

Settling into a new year - compilers, coats, cars and cricket

April 1st, 2007 admin

It took me till April Fools’ Day to make my first post this year. Among several reasons and excuses I can come up with the main one is that the compilers’ class I am taking at NCSU. The class kept my weekends busy with all the project work it involved. However, since I am learning a few new things, I guess that’s alright. Another reason, now that I think about it, is that Kavita and I took up the grand challenge of painting our house on the inside. We have as of now only completed painting two rooms, one of which was a half-bath that originally had wall paper. The wall paper had to be removed first, and then the two coats of paint went on the walls. As the compilers’ class picked up steam, the painting adventures subsided. Also, it took a while to get used to our new life, now that Kavita and I are living together for the first time over the last few months. The adjustments, the catching up with life, which does not wait for you, took its toll on my ability to spend time with my webpage. Happy to report that we did accomplish a few minor milestones this year. The big one of course was Kavita getting a job. Then she bought a Pontiac Vibe after much research. We both love that car. Then we sold her old car, the Infinity G20. That took some effort with the repairs, the ads and the title transfer. All in all this post is a testimony to my return to some semblance of normalcy. I sense a brief and temporary settling-down at a phase of our lives where unsettling will likely be the norm.

The Cricket World Cup is going on in the Carribean islands. After almost four years I chanced to watch a couple of cricket matches live on TV a few weeks back when we visited my cousin, Raghu, at New Jersey. He had gotten installed a satellite dish that received live coverage of the Cricket World Cup. The two games I watched were India playing Bangladesh and Pakistan playing Ireland. It was fascinating that the two games I watched in so long, turned out to both be massive upsets. Bangladesh beat India and Ireland beat Pakistan. These games threw the teams’ expectations, betting odds and the statisticians’ calculations into relative disarray, and ended with both the losing teams, two cricketing giants, being eventually eliminated in the opening round of the cup. The defeats brought great outbursts of emotion from the fans (the lights and pretty much everything Indian and Pakistani). Weeks of introspections, evaluations, shock therapy and retirement announcements later, one thing that is clear is that an era of subcontinental cricket, one that I can relate to the most, is over. The defeat and the ouster from the competition, though surprising and disappointing, does not worry me a whole lot. If this provides a dose of practicality to the millions of sports-starved fans for whom the only sport that exists is cricket, it would be a welcome change. Maybe it will bring with it a dose of professionalism into a game. Professionalism into how the players perform indifferent to the pressures and expectations they are subjected to, and, more importantly, professionalism into the spectators and fans who need to realize that it is a game all said and done. The basic problem in a sports-starved country where sports has always taken a back seat to getting through life’s other challenges is that the few sporting events India does participate in take on an intimate and overly emotional dimension that cannot be dissipated easily through other avenues.

Posted in Events, Experiences | No Comments »