Quotes: Programmers on MacOSX vs Programmers on Linux

A programmer will eventually tell you to use Mac OSX or Linux. If the programmer likes fonts and typography, they’ll tell you to get a Mac OSX computer. If they like control and have a huge beard, they’ll tell you to install Linux. Again, use whatever computer you have right now that works. All you need is gedit, a Terminal, and python.

– Zed A. Shaw,  Learn Python the hard way

Posted in Quote | Tagged , , , , , | Leave a comment

Griffith Ramayana: Balakanda: Canto 1

The first sarga of Balakanda begins with Valmiki questioning Narada  about the existence of a special kind of human being. He was inquisitive to know:

In all this world, I pray thee, who
Is virtuous, heroic, true?
Firm in his vows, of grateful mind,
To every creature good and kind ?
Bounteous, and holy, just and wise,
Alone most fair, to all men’s eyes?

Thus he began his question inquiring about the perfect human who was living amidst them at that point in time. The kind of qualities that Valmiki was expecting in such a person appear contradictory at the first glance. For example, he asks if such  a person was:

Devoid of envy, firm and sage,
Whose tranquil soul ne’er yields to rage ?
Whom, when his warrior wrath is high,
Do Gods embattled fear and fly ?

It wasn’t good enough for Valmiki if these qualities were present in some person, but were never put to any use! He was interesting to know about the person:

Whose noble might and gentle skill
The triple world can guard from ill?
Who is the best of princes, he
Who love his people’s good to see ?

A man who was blessed in so many ways that he was

The store of bliss, the living mine
Where brightest joys and virtues shine?
Queen Fortune’s best and dearest friend,
Whose steps her choicest gifts attend.

A man, who if made to stand alongside the high lords of the sky, they would be honoured. A man:

Who may with Sun and Moon compare,
With Indra, Vishnu, Fire and Air ?
Grant, Saint divine, the boon I ask,
For thee, I ween, an easy task,
To whom the power is given to know
If such a man breathe here below”

Narada muni, pleased with Valmiki’s question tells him that rare is a person in whom all these qualities can be found at once. But there is one such person, who goes by the name Rama, who is born in the famous Ikshvaku’s family and currently ruling the land of Ayodhya. As if to answer Valmiki’s question “Alone most fair, to all men’s eyes?”, Narada describes the physical appearance of Rama as follows:

Tall and broad shouldered, strong of limb,
Fortune has set her mark on him,
High destiny is clear impressed
On massive jaw and ample chest
Deep in the muscle, scarcely shown,
Embedded lies his collar bone,
His lordly steps are firm and free,
His strong arms reach below his knee,
And limbs in fair proportion set:
The manliest form e’er fashioned yet,
Graced with each high imperial mark,
His skin is soft and lustrous dark,
Large are his eyes that sweetly shine
With majesty almost divine.

And this man was well versed in the Vedas, was skilled in archery, was trained in arts and versed in law. At the same time, he was also

High souled and meet for happy fate,
Most tender and compassionate;
The noblest of all lordly overs,
Whom good men follow, as the rivers
Follow the King of Floods, the sea:
So liberal, so just is he.

And when it comes to Godliness, he was

The peer of Vishnu’s power and might,
And lovely as the Lord of Night
Patient as earth, but, roused to ire,
Fierce as the world-destroying fire;
In bounty like the Lord of Gold,
And Justice’ self in human mould.

However Narada doesn’t just stop at this enumeration of qualities of Rama, but also goes on to narrate the story that makes Rama so great. We shall see that story in the next post.

Posted in ramayana | Tagged , , , , , | Leave a comment

Teaching

“If teaching is reduced to mere data transmission, if there is no sharing of excitement and wonder, if teachers themselves are passive recipients of information and not creators of new ideas, what hope is there for their students? If adding fractions is to the teacher an arbitrary set of rules, and not the outcome of a creative process and the result of aesthetic choices and desires, then of course it will feel that way to the poor students.

Teaching is not about information. It’s about having an honest intellectual relationship with your students. It requires no method, no tools, and no training. Just the ability to be real. And if you can’t be real, then you have no right to inflict yourself upon innocent children.

In particular, you can’t teach teaching. Schools of education are a complete crock. Oh, you can take classes in early childhood development and whatnot, and you can be trained to use a blackboard “effectively” and to prepare an organized “lesson plan” (which, by the way, insures that your lesson will be planned, and therefore false), but you will never be a real teacher if you are unwilling to be a real person. Teaching means openness and honesty, an ability to share excitement, and a love of learning. Without these, all the education degrees in the world won’t help you, and with them they are completely unnecessary.

It’s perfectly simple. Students are not aliens. They respond to beauty and pattern, and are naturally curious like anyone else. Just talk to them! And more importantly, listen to them!”

– Paul Lockhart, “A Mathematician’s Lament”

Go read it all!

Posted in academia | Tagged , , , | Leave a comment

Griffith Ramayana: Invocatory Verses

I mentioned in my previous post that I have been reading Ralph T.H Griffith’s translation of Ramayana in verse. I finished the Balakanda and am planning to write a summary of the interesting verses and events I encountered therein. This is the first post in that series.

Griffith begins with the invocatory verses in the praise of Valmiki.

Praise to Valmiki, bird of charming song
Who mounts on Poesy’s sublimest spray,
And sweetly sings with accent clear and, strong
Rama, aye Rama, in his deathless lay.

This corresponds to the popular verse that can be found in the Ramaraksha stotram

कूजन्तं राम रामेति मधुरं मधुरक्षरं  |
आरुह्य कविताशाखं वन्दे वाल्मीकि कोकिलं ||

I like the imagery in this next verse whose sanskrit equivalent I do not know:

The stream Ramayan leaves its sacred fount
The whole wide world from sin and stain to free
The Prince of Hermits is the parent mount
The lordly Rama is the darling sea.

One more nice invocatory verse, again in the praise of Valmiki is apparently a standard shloka that is recited before reciting Ramayana.

Glory to him whose fame is ever bright!
Glory to him, Prachetas’ holy son!
Whose pure lips quaff with ever new delight
The nectar-sea of deeds by Rama done.

I didn’t know the sanskrit equivalent of this verse until yesterday when my professor recited the following verse on seeing this translation:

यः पिबन् सततं रामचरितामृत  सागरं |
अतृप्तः तं मुनिं वन्दे प्राचेतसं अकल्मषं ||

Griffith has translated it rather well, since in the sanskrit verse, अतृप्तः must not be interpreted as “unsatisfied” since it makes no sense. Instead, it alludes to the fact that Valmiki never grow tired of drinking nectar from the ocean of Rama’s deeds.

One of my favourite mangala shlokas comes from Tulasidasa’s Ramacharitamanas.

सिताराम गुणग्राम पुन्यारण्य विहारिणौ |
वन्दे विशुद्ध विज्ञानौ  कवीष्वरकपीष्वरौ ||

I am not a poet and I very well know it. So, here’s a translation in my own words, fortunately it’s not in verse. Hope it’s not really that worse!

I salute both the king of hermits and  foremost among the vanaras! Blessed are these enlightened ones who had the good fortune to wander about in the enchanting woods of the glorious qualities of Sita-Rama!

In the next post, we shall see a few selected verses from the first canto of Balakanda where Narada narrates the summary of the events that occurred in Rama’s life in answer to Valmiki’s deep question about the ultimate man!

Posted in ramayana | Tagged , , , | Leave a comment

Bought Griffith’s translation of Rámáyańa

Finally I got my copy of Ralph T.H. Griffith’s translation of Rámáyańa in verse. For the past two weeks, whenever I could find some free time, I have been reading it on my android phone. The epubs are available on Project Gutenberg and the Aldiko reader renders the e-book quite nicely. I finished Bálakáńda and was quite impressed with the translation. The parts I liked in particular were the ones where Ráma fights Tádaka and the one where Viśhwamitra’s story is narrated by Śhatananda. Since I have not read the original (which requires me to learn sanskrit first!) I cannot say how true the translation has been to the original. There are some portions which have been translated quite well. I shall blog about the interesting verses some other time.

For now, I shall leave  you with the last few verses of Bálakáńda.

Rama and Lakshman honoured still
Their godlike sire with duteous will.
Two constant guides for Rama stood,
His father’s wish, the people’s good.
Attentive to the general weal
He thought and wrought to please and heal.
His mothers too he strove to please
With love and sonly courtesies.
At every time, in every spot,
His holy guides he ne’er forgot.
So for his virtues kind and true
Dearer and dearer Rama grew
To Dasharatha, Brahmans, all
In town and country, great and small.

And Rama by his darling’s side
Saw many a blissful season glide,
Lodged in her soul, each thought on her,
Lover, and friend, and worshipper.
He loved her for his father’s voice
Had given her and approved the choice:
He loved her for each charm she wore

And her sweet virtues more and more.
So he her lord and second life
Dwelt in the bosom of his wife,
In double form, that, e’en apart,
Each heart could commune free with heart.

Still grew that child of Janak’s race,
More goddess-fair in form and face,
The loveliest wife that e’er was seen,
In mortal mould sweet Beauty’s Queen.

Then shone the son Kaushalya bore,
With this bright dame allied,
Like Vishnu whom the Gods adore,
With Lakshmi by his side.

The highlighted portions in the verses above correspond to the verse 1.77.29 (read it here)

प्रिया तु सीता रामस्य दारा: पितृकृता इति। 
गुणाद्रूपगुणाच्चापि प्रीतिर्भूयोऽभ्यवर्धत ।।

I remember this verse from an upanyaasa on Ramayana by Shatavadhani Dr R Ganesh.

Posted in classics, ramayana | Tagged , , | 3 Comments

A case of sour mangoes

I read/heard this story a few months ago. However, I cannot recall the context where I came across it. It goes something like this:

Long ago, there was a king named Bhartrhari who ruled his kingdom in a just and an able manner. The king was also a proficient poet and had composed famous works such as the nIti SaTaka and the SRingAra SaTaka. One day, when a saint paid a visit to his kingdom, Bhartrhari treated him with the due respect. Pleased with the king’s hospitality, the saint gave him a mango fruit and told him that it was a special mango fruit whose sweetness surpassed the sweetness of any other. So  it should only be given to the person whom the giver loved the most. The king gave the fruit to his wife telling her that this wasn’t any ordinary fruit, but a special one which was being given to her because he loved her the most. The king however was unaware of the fact that his wife was having an affair with the commander of the army. She secretly gave the fruit to the commander, while telling him about the speciality of the fruit. The commander didn’t really love the queen. He had the hots for a famous courtesan whom the king was patronizing at that time. So, he visited her and gave her the fruit, without failing to impress upon her the fact about the specialty of the fruit and the significance of his gifting her the same. The courtesan who was used to receiving gifts from the connoisseurs of her art accepted the gift without making a big deal out of it. That evening she performed for the king who was with his queen and the other prominent members of the kingdom including the commander of the army. After her performance, she requested the king to kindly accept a rare fruit that she had come across earlier that day. She told him that the fruit must be given to the person who is most dear to the giver. She couldn’t think of any person who deserved to be gifted this fruit other than her patron. When the king heard that, he realized that it was the same fruit which he had given to his wife. Guessing what might have transpired, the king burst into the following verse:

yAM cintayAmi satatam mayi sA viraktA
sApyanyamicchati janam sa jano’nyasaktaH
asmatkrte ca pariSuShyati kAcidanyA
dhik tAm ca tam ca madanam ca imAm ca mAm ca

The one of whom I think all the time-
that one ain’t interested in me.
She likes another, a fool I gather-
since loves some other doth he.
Desires of ours have wrecked the life
of one other person you see,
Fie on her, and on him, and on the cupid,
on all these and fie on me!

[Translation is my own. Doesn’t do justice to the brilliance of the original]

And it seems that’s how Bhartrhari realized the pointlessness of love and began composing the vairagya SaTakaM.

This story and verse interests me for a several reasons. The last line in the original verse has a nice alliterative quality that makes you feel as if some cymbals were clanking in the background as the king was denouncing everyone (including himself). I remembered only the last line of this verse and had to use google to find the verse itself.  The verse lends itself nicely to the description of a linked list, which one gets to see in real life as well! Coming to the story, the fruit was supposed to be sweetest fruit on the earth. But the common knowledge generated by the fruit soured the minds of everyone involved. Now you see why God prohibited Adam and Eve from seeking the fruit of knowledge! Because He was quite sure, like Col. Nathan Jessup, that they won’t be able to handle the truth! However, if you think of it a bit more, you’ll also realize that the sourness produced by this little knowledge was sufficient to help Bhartrhari curdle the milk that was his sensual love and churn out from it the butter which was the essence of all love – his own Self! The fact that after changing several hands, the fruit finally ended up with him emphasises at some level the fact that the entity whom we really love the most is our own Self.  So in the view of this knowledge,  the fruit was indeed sweet!

The other thing that interests me about this story is the states of knowledge of different people involved in the story at different times. Before the dancer offers the fruit to the king, everyone apart from the dancer was pretty much on the same boat. They all think that their respective beloveds have eaten the fruit. The moment the dancer makes the announcement about her possession of the fruit in the open court where everyone of interest was present, it makes each one of those people suspect the faithfulness of their beloveds.  The king knows that the path traversed by the fruit is a cycle and that apart from him, there was at least one other male involved in this cycle.  He has no way of knowing that the commander of the army was involved. The queen also knows that the fruit travelled in a cycle. She knows that king is involved, she herself is involved, the commander is involved and the courtesan is involved. She cannot ascertain that these were the only people involved. The commander knows that the fruit has travelled from the queen to the king through him and the courtesan. He doesn’t know that the path traversed by the fruit was cyclic. Nor does he know the exact number of people who had a hand in this transfer of fruit. The courtesan knows even less. She just knew that the fruit travelled from the commander to the king via her. She doesn’t know that it was a cycle. At this point, the only person who could have guessed the exact number of people who had handled the fruit at some point in time was the queen, since she needed only one bit of information – that the commander liked the dancer and not her. Every other person would require some more information than to arrive at the exact number of people who were involved.

Now, when the king bursts into the verse mentioned above, everyone comes to know that fruit was originally with the king and it came back to him. So, at this point, the fact that the path traversed by the fruit was a cycle becomes common knowledge. Thus, at this point, the commander and the queen both require exactly one extra bit of information to figure out who were the people involved in this cycle.  If the queen somehow comes to know that the commander liked the courtesan then she would have the complete knowledge about the cycle. On the other hand, if the commander came to know that the person whom the king loved the most was the queen, then he would also possess complete knowledge about the cycle. The king and the courtesan, at this point need more than one bit of information to deduce the number of people involved.

I shall leave it to you guys to speculate if it’s easier for the queen to obtain the information about the commander’s infidelity or is it easier for the commander to obtain the information about the king’s fidelity.

The only other story that I can recall where the knowledge generated by some object changing hands moves the story forward and seals the fate of the people involved is Othello where the object is Desdemona’s handkerchief which was gifted to her by Othello. For the one’s who don’t know about Othello, Vishal Bharadwaj has successfully adapted the story in his hindi film Omkara. The “shared-object” of interest in this case was Dolly’s kamarband.

Posted in humor, interesting, logic, love, Uncategorized | Tagged , | 1 Comment

A month away from twitter

I had mentioned a month ago that I would be indulging in a social-network detox experiment by not logging on to twitter and gtalk for a month.

I couldn’t stay off gtalk since from time to time I had to converse with my colleagues who are in college when I was at home. However, I have been able to stay off twitter for a whole month. What was the experience like ?

My greatest worry about twitter was that when I felt a bit bored or tired, my first impulse was to check my twitter feed and get lost in the world of puns and politics. However, the problem started becoming worse when I found myself craving for information even when I was doing something that required hard focus, say like making a presentation or reading a paper, or some lengthy blogpost. After a couple of minutes into any of these, subconsciously I would start thinking, “Wait, let me check if @XYZ has posted anything funny”, or, “Did anyone respond to that pun I posted.”. I was beginning to realize that if I don’t curb this now, it would be hard for me to do so at a later point in time. I tried resisting the urge, but there were times when I would be trying to make sense of some convoluted argument in something that I am reading, and despite having spent quite some time on it, it wouldn’t make any sense. During such times, I couldn’t resist the urge of escaping this temporary boredom by checking my twitter feed. This was bad, because when I revisited that paper/blogpost after sometime, I had to do the mental gymnastics all over again. In other words, I was observing that my ability to focus on one thing was deteriorating rapidly.

Having sensed this, I decided to take a break. Just not log on to twitter at all. For a good measure, I set my password to something lengthy random string, which I had no hope of remembering. I did the same for the email account through which I had registered for a twitter account. The idea was that whenever an urge to check the twitter feed would arise, it would conflict with the extra work that had to be done to log on to twitter.

And it worked! For the first few days, there were withdrawal symptoms. I wasn’t able to read anything for more than 5-10 minutes without feeling the need to check the twitter feed. But I would remind myself of the hoops I had to jump if I wanted to do that and get back to reading. After a few days, the situation improved, and these days, I am able to read for an hour without feeling distracted.

As a result, I was able to read a couple of papers that I had to finish. I also finished reading DVG’s “bALigondu nambike”. I have made quite a bit of progress in my sanskrit studies(which I shall mention in another post), I finished listening to a bunch of upanyAsas on rAmAyaNa by Shatavadhani Dr R Ganesh which inspired me to write the rAmAyaNa post. Also, these days I am able to read lengthy blogposts/new articles in full without feeling the need to switch tabs!

From my experiences, I do feel that twitter (or for that matter any social network of this kind) can create a positive response feedback loop that rewards you with instant gratification each time you login and slowly your brain becomes addicted to it. Initially it appears harmless, because you’re spending just a couple of minutes reading/posting about something. But as time passes, as you start following more and more people, as you get involved in a social circle, you get attached to it.

Having said this, I ask myself, what if I had nothing else to do. Would twitter still be a hindrance? I think not. In fact I have discovered several interesting things through twitter  and have come across some really awesome persons as well. So, I need to learn to moderate my twitter use. Probably the best thing to do would be to allocate sometime in the day for just this. Not login to twitter during any other time. The only potential disadvantage of this is the Abhimanyu syndrome, i.e, “able to login, but unable to log-out”, especially if you are in the middle of an interesting discussion.

So that’s the plan for the next one month. Use twitter sparingly. Enforce time-limits. And learn to let go when it is time to. I am sure this is going to be harder than refraining from logging on to twitter at all!

Posted in crowd-sourcing, experiences, reflections, social networking, twtter, Views | Tagged , , , | 6 Comments

My encounters with rAmAyaNa

My mother taught me alphabets long before I joined school in 1988. So, when I was between the ages 2.5 and 3.5 I had learnt how to write my A,B,C’s. The earliest memory from my life that I can recollect is the one where my mother is making me practice the alphabets. She had associated each alphabet with some object that would remind me of the shape of that alphabet. When I got stuck at ‘U’, I recall her telling me, “‘U’. The one which looks like Rama’s nAma (mark on rAma’s forehead).”. That is how early I was acquainted with rAma and his stories.

Since we got a TV in our house only after 1988, we never got to see the famous rAmAyaNa TV serial at home when it was telecast for the first time. I think we were one of the few families which gave that series a miss. However, I was introduced to these stories much before the TV series started. I had mentioned earlier on this blog that I was one of the few grandchildren who used to humour my grandmother by listening to the stories she narrated. Given that her knowledge of our itihAsAs and purANAs was quite vast, she often used to narrate to us the stories from rAmAyaNa, mahAbhArata, purANAs and other sources. So, even as I was beginning to learn my mother tongue Konkani, I was being introduced to the stories from rAmAyaNA. Bows made from slender branches or long enough twigs and broomsticks used as arrows was a common sight in our homes during my childhood. Whenever we we played amongst ourselves enacting episdoes from rAmAyaNa, we all wanted to be rAmas. The fight for the second place, needless to say, would be for the role of hanumanta.

Despite rAmAyaNa featuring in my earliest memories, the story is still fresh in my mind. I must have come across it hundreds of times through nATakas, yakshagAnas, stories, poetry, essays, lectures, harikathAs, bhagavatas, and still, I haven’t gotten bored with it. Each time I come across any of the prasangas, I am able to relive them as if they are happening right in front of me. And all this is without being forced to listen to it, without having read it as a lesson in the text book or without attending the “culture-classes” that seem to be growing popular in our cities these day. Such is the power of simple verbal narration of this wonderful story.

If you remember your rAmAyaNa, you’ll know that the whole of bAlakANDa is filled with stories where we learn about rAma’s prowess, his ability to learn new things, the way he interacts with his brothers, fellow students, and elders. We see him slay tATaki with a single arrow. Later on, we see him slay subAhu and dispatch mArica off to a distant shores in order to protect vishvAmitra’s yajna. We see the ahalya-uddhAra episode and the famous sItA-swayamvara. And then we see him lock horns against that bull amongst the bhRgus, bhArgava rAma and emerge victorious. Thus we are introduced to our hero rAma who can do no wrong and can set things right. There is no trace of sadness in bAlakANDA.

Thus having firmly established rAmA in our hearts, ayodhyA-kANDA begins on a positive note with dasharatha desiring to crown rAma as the the future king of ayodhya. When all the ministers wholeheartedly support this decision, we rejoice just like the prajA of the ayodhya did when the news reached their ears. This is the perfect thing we all wanted for our perfect hero. However, our jubiliation doesn’t last long since the spoil-sport comes in the form of that kill-joy manthara who, to use rAja bhojA’s phrase, like a she-buffalo dirties the clean pond that was kaikeyi’s mind and sets things into motion by prompting kaikeyi to force dasharatha into exiling rAma to the forest for 14 years and coronate her son bharata as the king of ayodhya. This is where we encounter sadness for the first time. I find it hard even now to sit through that episode where a character as pure and blameless as srirAmachandra is deprived of the kingly life that was his to enjoy by all accounts. The sorrow becomes magnified when except for kaikeyi we see the whole of ayodhya ruing the fact that rAma won’t be their king. In their curses, we find an expression for our sorrow. When rAma’s mother kausalya pleads him to take her to the forest along with him, he calmly tells her that she is a wife to his father first, and then his mother. So her duties lay in ayodhya and not in danDakAranya. We can feel for kausalya who despite being the eldest queen was mostly relegated to the role of the dharma-patni while dasharatha took kaikeyi to be the kAma patni. Kausalya explicitly says that the respect which she was deprived of during the reign of her husband, she was hoping to enjoy that during the reign of her son. But kaikeyi deprived her of even that joy. We cannot see the pious kausalya lose to kaikeyi just like that. lakshmaNa, who followed rAma more faithfully than rAma’s shadow itself gets enraged and tells rAma, to use rAja bhoja’s phrase again, the he need not bloody his legs walking on the thorny forest floor when he his younger brother would bloody his hands by killing anyone who comes in the way of rAma and the throne, even if that person is their father himself. We find in lakshmaNa a conduit to channel our own anger. But rAma refuses this help and calms lakshmaNa down, thereby letting our dip in the waters of vIra rasa to remain just a dip for now. And then, for the first time we see rAma cry. That’s when he has to inform sIta about the 14 years of vanavAsa. In his heart, rAma knows that sIta would insist on accompanying him. He knows that no matter what vAda he put forth, she would be able to counter it. And hence, he knows the difficulty that lay ahead of her. He couldn’t bear the thought of sIta walking bare-foot in the forests. rAma is a husband who doesn’t want his wife to suffer. He loves her to such an extent that later on when a crow pecked her, the enraged rAma let loose nothing short of a braHmAstra on the crow. How could that rAma expect his wife to experience the pains that were his to suffer? When he tries to dissuade sIta, we see sIta outsmart him in every argument. She taunts him with his own words and tells him that as his wife, her place is by his side in the forest and not in ayodhya. Such a devoted wife gets to taste the first slice of hardship right inside the palace when kaikeyi gives her the chIrAmbara, the uniform of the vAnaprasthas. sIta is truly at loss, because she doesn’t know how it is worn. rAma, realizing her predicament comes to her rescue and helps her wear the chIrAmbara on top her saree itself and ensures that no scene is created. But kaikeyi doesn’t, and objects to sIta wearing jewellry. Here, we see even vasiShTa lose his cool and warn kaikeyi of her excesses. He goes so far to say that he will install sIta on the throne of ayodhya right then and there, leaving nothing for bharata. Amidst all this agony and anger, rAma’s face glows calmly and not once does he allow the clouds of sorrow pass over it. However, the same cannot be said about the other members present there, whose sorrow covered faces were already raining tears. The citizens of ayodhya follow rAma, lakshmaNa and sIta all the way till they reach the borders of ayodhya. They don’t want to bid him goodbye. This whole episode pulls the rug beneath our feet and makes us walk on the hard ground along with rAma. And walking on the hard ground does hurt quite a bit.

Each time I hear/see this episode I wish that it hadn’t occurred. I wish that kaikeyi doesn’t fall prey to manthara’s words. I wish that dasharatha falls dead the moment he hears kaikeyi’s demands so that he doesn’t have to grant them. I wish that lakshmaNa  puts an end to this episode while he was still bubbling in anger. I wish vasiShTa steps in. I wish all this, not because I hate kaikeyi. She did what she did, keeping her son’s interests in mind. We see that later on when bharata rebukes her in every way for sending his elder brother to the forest, she breaks down and repents. We see her repentant in the ashrama of bharadhvAja muni and later during bharata’s meeting with rAma. No, the only reason I wish that things didn’t happen this way is because it’s too hard to bear the sorrow that one is made to experience all of a sudden. In some variants of rAmAyaNa, especially the adhyAtmika oriented ones, we find an explanation that it was the devAs who inspired manthara to do such a thing so that earth can be rid of the menace that was rAvaNa. Since rAma was the only person on the earth who was capable of this task, they had to make rAma go to lanka. And hence they prompted manthara to do what she did. Whatever others think about this explanation, more than giving rAmAyaNa the interpretation of being a divine play on earth, I feel that the explanation is given to provide comfort against the sorrows that one encounters during the above mentioned episode. The explanation is a float for the ones among us who aren’t strong enough to cross the river of sorrow but still wish to see what lies in store on the banks. In the araNya kAnda we encounter similar pangs of agony when rAvaNa abducts sIta. I cannot count the number of times I wished that sIta had not fallen prey to the golden deer,  that she hadn’t forced rAma to fetch it, that she did listen to lakshmaNa when he told her that this was all AsurI mAya since no one was capable of defeating rAma,  that lakshmaNa had not truly gone in search of rAma but stuck around in the vicinity of the parNa-kuTIra so that the mishap wouldn’t happen,  that jaTAyu beats rAvaNa to pulp when he tried to stop him from abducting sIta. But no, none of these happen. And as a result, we are made to cry with rAma when he finds that sIta is no longer in the kuTIra. We are made to feel the vengeance when he threatens to destroy the entire creation when his beloved wife was taken away from him. We want to console him when he speaks of giving up his life. How can we bear to see rAma broken like that? Why did any of this happen at all, we wonder. And we are provided with the explanation of “mAya-sIta” where in both rAma and sIta knew what was in store for them, and the person whom rAvaNa had abducted was not sIta, but vedavati and that the real sIta was safe with agni-deva and was restored to rAma latter on during the sIta’s agni parIksha. With a single explanation, we are comforted against the sorrow emanating from two heart-rending episodes namely sItApaharaNa and sIta-parityaga.

We do all this because we feel deeply for these characters. We are happy when good things happen to them and get extremly upset when they are made to undergo difficulty. We relate to these characters. rAmAyaNa is the story of our family of our society seen through a magnifying glass. As a result, all the emotions get magnified. The sorrow is intense and so is the joy which follows the sorrow. Thus rAma, sIta, lakshmaNa hanumanta are like family to us. This is the reason why the story of rAma, the first poem ever to be composed is so beloved to the people of bhArata. In no other part of the world is a literary work “lived” by its people. One doesn’t find discourses, debates, plays, series, comics, poems on Homer’s Illiad or Odessey outside the academic circles. But this is not true with rAmAyaNa. In every nook and corner of every city, town, village in our country you’ll find a person who knows the story , who cherishes the story of rAma. If rAmAyaNa is alive today, it is not because it was published on the glossiest of papers, bound with the best quality leather, kept in the best of bookshelfs in the most prestigious library having been decorated with the various literary awards. No. rAmAyaNa is alive today because it people live it daily. They don’t need to consult a book to narrate you the story of rAma. In the truest sense, rAmAyaNa is printed on the pages of our mind, bound with our emotions and placed in the bookshelves of our hearts. As long as this tradition continues, rAma’s story shall be told and retold.

If in devakinandana kRShNa we found a friend with whom we could climb trees, play cricket, share a coffee, discuss our problems, seek counsel, rAma for us has  been the dignified father figure we looked up to and wanted to be when we grew older. They say that for kids, their father is their first and the ultimate superhero. So is rAma for us.

Posted in classics, experiences, Hinduism, ramayana, reflections, Views | Tagged , , , , , , , , , , , | 3 Comments

Social Networks Detox experiment

I want to perform an experiment. For the next one month, starting today, I don’t want to login to twitter and gtalk. I am anyway not on facebook, so don’t have to worry about that.

I shall read my mails two times a day but no more.

I shall try blogging more often. 

I am doing this to find out how addicted I am. 

Oh, while you are here, do take a look at this article which talks about how “solitude is slowly becoming a value that society no longer cares about”.

Posted in Uncategorized | Tagged , , , , | 1 Comment

Reversing a list in Haskell

Totally bored and jobless over this surprisingly silent weekend, I decided to revisit some of the Haskell programs that I had written when I took the Functional programming course during the previous year. While I was at it, I remembered this particular topic which struck me as interesting back then (..and it still is). So I am going to write about it despite the fact that it is something that would be covered by any basic Haskell textbook or tutorial. Well, that just goes to show how jobless I am!

The first time we were asked to reverse a list in Haskell, I did it using the extremely straightforward method I could think of.

revList :: [a] -> [a]
revList [] = []
revList (x:xs) = (revList xs) ++ [x]

What we are doing here is, given a list of the form (x:xs) where x is the element at the head of the list and xs is the tail of the list (which is again a list!). We recursively apply revList to the tail and then concatenate the result with the singleton list containing the head x.

Turns out this really bad way of reversing a list.

Let us analyse why.

One of the ways of looking at a Haskell list, say [x,y,z,w] is
x:(y:(z:(w:[]))), reflecting the head:tail pattern mentioned earlier.

Observe that to append the element x at the end of the reversed list, we concatenate the reversed list with the singleton list [x]. Now, the concatenation of two lists even in Haskell is at best a linear time operation. One could think of a way of concatenating lists as follows

(++) :: [a] -> [a] -> [a]
(++) [] l = l
(++) (x:xs) l = x:((++ ) xs l)

Thus the concatenation operation would have to walk to through the first list at least once.

Let T_{rev}(n) represent the time taken to reverse the list of n  elements. Clearly T_{rev}(0) = 0. And suppose T_{concat}(n_1, n_2) = n_1 represent the time taken to concatenate two lists where the size of the first list is n_1 and the size of the second list is  n_2. From the code, we can set up the following equation:

T_{rev}(n) = T_{rev}(n-1) + T_{concat}(n-1,1)
T_{rev}(n) = T_{rev}(n-1) + n-1 which solves to
T_{rev}(n) = \frac{(n-1)(n-2)}{2}

Thus T_{rev}(n) is quadratic in n. This is hardly the time complexity we would have liked!

The reason for this is the fact that appending a single element to a list takes linear time proportional to the length of the list. This is due to the manner in which lists are internally represented in Haskell.

However, adding an element to the head of the list is a constant time operation. The code for doing this would look something like:

add_to_head :: Int -> [Int] -> [Int]
add_to_head x l = (x:l)

Thus, given a list (x:(y:(z:(w:[])))) appending, say an element v to the head would amount to storing the list as v:(x:(y:(z:(w:[])))). Thus we don’t have to worry about the length of the list. In this sense, the Haskell list is similar to a stack. Adding an element to the top or removing an element from the top is a constant time operation. But adding to the bottom requires popping out all the elements, pushing this new element, and pushing all the elements (ok, lists do better than that.)

So, we can make use of this fact to optimize revList so that the operation takes linear time proportional to the length of the list. And the optimization would involve same trick that is used in reversing a stack. i.e pop out the element at head of the stack, push it into another stack, and repeat this till the first stack is empty. This requires only linear time.

listRevFast :: [a] -> [a]
listRevFast l = _listRevFast l []
    where
        _listRevFast :: [a] -> [a] -> [a]
        _listRevFast [] l = l
        _listRevFast (x:xs) l = _listRevFast xs (x:l)

And this one, you can verify requires linear time since it accesses each element of the original list exactly once.

Posted in academia, geek, grad school, programming, tech | Tagged , , , | Leave a comment