Monday, July 30, 2012

The Price of Achievement

"A lot of unnecessary pain in the world is caused by people running on their own racetracks, furiously trying to get ahead of one another with their heads bowed and their blinkers on. They keep running: trying to go faster, higher and stronger in the hopes of achieving that which has yet to be achieved. In that they sometimes pay a hefty fee - the price of family, of friendship, of kinship and of health. The price of pain is indeed the price of achievement and it must be paid generation after generation but the racetrack does not demand of you the price of love, for you may run on it just as well in a spirit of camaraderie, respect and fellowship. So take some time, raise your head, lift a glance, and acknowledge your fellow runners for it is they that make your race worth running."

~ Divye Kapoor

Saturday, July 21, 2012

Coke Studio: Madari English Meaning and Lyrics

Thanks to Sanat Rath, I had the absolute privilege of listening to this superb rendering of Madari by Vishal Dadlani and Sonu Kakkar and an absolutely stunning composition by Clinton Cerejo as part of Coke Studio. Here's the official video. The lyrics of the song are interspersed with the meanings translated to English. Credits for the superb lyrics go to Manoj Yadav. Hope you enjoy it.

Make sure you watch this in HD, it's worth the extra audio quality.

Song: Madari
Producers: Coke Studio
Singers: Vishal Dadlani and Sonu Kakkar

(Intro music with chords)
(Slow build up)
(Sharp guitar riff)
(Drums kick in...)

[Vishal Dadlani sings]

Madari, Madari, Madari,
Madari mera tu,
Main Jamura re Jamoora, 
Jamura re Jamoora... 

Master, master, master*
you're my master
I'm an obedient assistant*,
an obedient assistant...

Madari, Madari, Madari,
Madari mera tu...
Main Jamura re Jamoora, 
Jamura re Jamoora re... 

Master, master, master
You're my master...
I'm an obedient assistant,
an obedient assistant, obedient assistant!

(Madari intro repeat)

Tera damroo baje, baje damroo,
Man ka mayura, 
Man ka mayura,
Jam ke naache...

Your drum beats, the drum beats,
The peacock of my mind, (x2)
dances intensely.

Teri waani ke dam par, 
Waani ke dam par!
Jag saara bhaage
Aage paache.

On the strength of your voice/words,
On the strength of your voice/words!
The entire world runs hither tither.

Tu hi dhare muskan ki booti, 
Cheetein tu ashuwan ki phoohar.
Tu hi dhare saagar kaa thela, 
Tu hi bhare nadiyaan mein dhar.

You are the one who holds the medicine/herbs of smiling (keys to happiness).
You spray a fountain of "ashuwan" (youth?)
You're the one who takes care of the seas.
You're the one who gives flow to the rivers.

(Madari intro repeat with terminating aalap after Jamoora...)

[Sonu Kakkar sings]

(Sonu Kakkar: Aalap)

Haaji lok maakke nu jaande. (x2)
Assa te jaana Takht Hazare.
Te jis wal yaar, Us wal kaaaba...
Te assan phol kataabaan chare...

The people who do the Haj go towards Mecca. (x2)
But I'm going towards the throne/shrine of Hazare~ instead.
In whichever direction is your beloved, that's the direction of the Kaaba# (of prayer).
We have read and scrutinized the books rigorously for this.

(Context: This stanza references the eternal love story of Heer and Ranjha where Ranjha was from Takht Hazare and Heer was from Punjab.)

(Repeat above)

Itt kharakke, dukhhad wajje,
Tatta hove chulha. (2 lines repeat)
Aan fakir tey khakhaar jaawan,
Razi hovay Bullah.

Bricks clang, the dukkhad plays,
The stove is heating up. (2 lines repeat)
Ascetics may come, have food, be merry, and go.
Bulle Shah (a famous sufi poet & ascetic) - do you find all this agreeable?/are you in agreement?

(Context: In the olden days, wood fired stoves made of brick were used for cooking. They were kindled by blowpipes called 'dukkhads' and housewives would do charity by cooking for ascetics.)
(Repeat above)

[Vishal Dadlani sings]

Teri rukhi-sookhi, sookhi-rukhi, kha ke dekha,
Har ek niwalah amrit laage.
Tere rehmo karam se, rehmo karam se!
Har phoote kismat uthke bhage...

I tried having your plain, simple, dry food and
every bite now feels like the elixir of immortality. By your graces, your graces,
Every person's bad luck/poor destiny goes away..

Jitna bhar le khilonein mein chaabi,
Utni hai uski raftar.
Tu chalata hai jeevan ka mela,
Tu hi sunein hum sab ki phuhaar.

The amount of winding you give to a toy,
That's the speed at which it runs.
You run the circus of life,
You're the one who listens to our spoutings.

Madari, Madari, Madari,
Madari mera tu,
Main Jamura re Jamoora, 
Jamura re Jamoora... 

Master, master, master
you're my master
I'm an obedient assistant,
an obedient assistant...

Madari, Madari, Madari,
Madari mera tu...
Main Jamura re Jamoora, 
Jamura re Jamoora re... 

Master, master, master
You're my master...
I'm an obedient assistant,
an obedient assistant, obedient assistant!

(Madari intro repeat)

Mein tera Jamoora...

I'm your obedient assistant...

(Sonu Kakkar: Aalap)

Jamoora mein tera tu mera Madari...

I'm your obedient assistant, you're my master.

(Sonu Kakkar: Aalap)

Madari, Madari (x5)



---
* The master is in reference to the Indian tradition of "Madaris" who make monkeys dance to their commands and they perform shows and street plays. The "Jamoora" is an oblique reference to the monkey who obeys the master's commands ("obedient assistant") though the term is usually applied to a human assistant who follows his master's orders without question.

~ The shrine of Hazare is a place of religious importance for Sikhs.

# The Kaaba at Mecca is the point towards which all Muslims turn to while praying.

This song is a Sufi composition that speaks of a tale at two levels - at the literal level, you can see this as the statement of an assistant whose mind is fired up by the teachings and commands of his master and whose teachings when followed feel like you're being conferred immortality; a deeper interpretation is that this song is a communion with God and the singer is merely a puppet following the wishes of his master, the Lord, and he has tried an accepted the teachings of God and is willing to follow in his footsteps because he controls the keys to happiness and runs the circus of life.

Thanks a lot to @jamshidmehmood on Youtube for helping clarify the Punjabi sections of the song.

Monday, July 02, 2012

How do you determine if a number N is a Pentagonal Number?

Just yesterday, I decided to do a couple of problems from Project Euler. I hadn't been to the site in a long long time, but I was happy that I got through Problem 19 and Problem 43 in short order, but then I've temporarily hit a wall with Problem 44. The problem is phrased in terms of Pentagonal numbers and while working through it, I derived an interesting result that I'd like to share with you, namely "How do you efficiently test if a number is Pentagonal?".


Recall that a Pentagonal Number is a number N which is representable by a formula   where n is a Natural number. To test whether N is a Pentagonal Number, all we need to do is to solve the equation: which is a simple quadratic and check if n is a Natural Number. That's pretty easy for humans to do when N is a small quantity but programming languages aren't very good with quadratic equations, so we need to do some pre-processing of the quadratic equation for them.


Simplifying the above equation, we get:



The roots of this are:



Let's analyze the first root:



Now, since n is a Natural number, 1 + sqrt(1 + 24N) should be divisible by 6. In more mathematical notation,



(Note: Here I'm using the mathematical notation of mod rather than the CS notation of mod. The mod 6 at the end applies to both sides of the equation.)

Simple analysis would then indicate that



Just checking the above condition is enough to determine if a number N is a non-generalized Pentagonal Number. But can we do better?

It is well known that the following property holds in modular arithmetic:




Applying the above property to square the previous equation results in:



or,  

or,  

or,  

The above constraint is always true, irrespective of the value of N. Therefore, the only constraints on testing if a number is Pentagonal is that 1 + 24 N must be a perfect square. A small caveat though is that we've used a squaring procedure to map x mod 6 to x^2 mod 6 - this mapping is not 1:1 since a squared number may have multiple roots in mod 6 space (indeed 1 mod 6 has two discrete square roots 1 mod 6 and 5 mod 6). What that means is that this test is actually necessary but not sufficient.

For numbers where (1 + 24 N) is a perfect square but sqrt(1 + 24 N) == 1 mod 6, the above squared equations are satisfied but they are not "normal" Pentagonal numbers. A quick glance will show that numbers which have sqrt(1 + 24 N) == 1 mod 6, when put into the formula for the root of the quadratic equation   (note the negative sign) will always yield a value that is 0 mod 6 thus guaranteeing an integral value for n (though negative in sign).

In other words, either



or



always holds if (1 + 24 N) is a perfect square. Thus, we will always get an integral n (though not necessarily positive) as long as 1 + 24 N is a perfect square.


Therefore, in all cases, to test if a number is a Generalized Pentagonal Number, it is necessary and sufficient that (1 + 24 N) is a perfect square. If you want to stick to just non-Generalized Pentagonal numbers, then use the additional restriction that sqrt(1 + 24 N) mod 6 == 5. QED.

NOTE: A previous version of this post claimed the simpler test to be necessary and sufficient for non-Generalized Pentagonal Numbers. There was a flaw in the analysis and the post has been updated to indicate that the simpler test holds only for Generalized Pentagonal Numbers. Many thanks to Dave Evans for providing a detailed counterexample over email and apologies for the incorrect analysis and claim the first time around.