Monday, December 26, 2011

Mountain (de)Range(R/D)s...!! :)

Making Mountains out of a mole-hill...! ;-) :)

It was Christmas, & I was lazing around with my friends in the utter cold weather...

And my dear friend Prashant "woke me" up with some of his suggestions on making 'nice-looking' mountain-ranges when he happened to see my following creation, which is essentially a Mathematica(l) plot of Sin(2x)+ Cos(2y) where both x & y are in the closed-interval [0, 3 Pi][click the pic below to see better! ]

He wondered if we can have better approximations to real mountain ranges...

And that got me thinking...(& literally, rummaging the cup-boards in my memory-p(a)lace (a dingy hut rather..!! :P))...

And soon, i found something interesting, an utterly simple way of making mountains...based on pairs of Parentheses which can be nested together as well as shown below...[click the pic below to see better! ]

I was working on an alternative way of making mountains out of "strings' while my dear friend Prashant came up with this beauty ( :)

Jusst made my own, "verbose" (like me moron..!:P) version...which is more like instructing a robotic arm(or a child) to draw the mountains, with a simple rule as below:
  • Traverse the string of brackets...given as input
  • If you encounter a "(", ASCEND i.e., draw a line moving towards the UPPER-RIGHT hand corner.
  • Else (if it is a ")"), DESCEND i.e., draw a line moving towards the LOWER-RIGHT hand corner.
Here's the output of my baby Mathematica(l) program: [click the pic below to see better! ]

As I came running DOWN the Stairs & shared with Prashant [it's always the Eureka! phenomenon, albeit with my clothes on..! ;) ], the thing of JOY (& BEAUTY!) that I discovered, & want to point out in this 'technique', is that it is a "look-see" device, or a sort of visual "check" fer whether a string of parentheses are properly 'balanced' or NOT! :-)
The simple heuristic/observation is that the brackets are 'okay' if the mountain-ranges reach 'back to ground-zero' i.e., the same height that they started out with/frem!

This assumes that the input-string begins with a "(" else, a trivial counter-example is : "())(" -- Can you see why..? :P

Any sort of 'imbalance' in the brackets, gives rise to a 'limping' Mountain-range...!:P

I request you to please check it out yourself!

The beauty of this is the utter simplicity; NO Need of sophisticated programs, nothing..!! :)

Even a child can doodle it & discover...& create a infinite number of mountain-ranges of different shapes & sizes...!

Note the following points:
  • The deeper the nesting, the taller the mountains become.
  • Also, YOU can 'guess &/or calculate & prove' the relationship between the TOTAL number of bracket-pairs & the TOTAL possible number of ways in which a 'proper' mountain range could be created.
Feel FREE to EXPLORE & share...!! <3 :)

Cheers, to the weird werld of Patterns around (which includes u (s) ! ;-) ...! ♥ :)

Merry X-mas & a Wonder-Filled Happy New Year to YOU n oLL your dear ones..!

Take care, & Keep Smiling, AL(L)-ways..!

Love & Best Wishes,
The boy in "rags" :-)

"Math is sometimes called the Science of Patterns."
: Ronald Graham

Wednesday, December 21, 2011


Coins...Fer a Change...!! :)

Was feeling 'lost'...and then decided to pay ettention to my thoughts....

I was thinking randomly...a lot about random numbers... 
(Hmmmm....i've not yet stopped...nor will I ever...hahaha!)

You can't imagine the MAGICAL things that lurk behind a seemingly RANDOM Universe....!

As one of my thoughts encouraged me to do, I took out a coin...& flipped it...
(yeah...Cricket -match coin-TOSS! :P )...

And as it turns out...fer a few tosses, it appeared to be biased towards HEADS or TAILS...
[Out of 10 chances...7 will be heads, or even 8 or 9 will be tails...!]

But then, I imagined....
WHAT if...what if I extend this tossing OVER & OVER & OVER egain....& egain..!?!?

In the short-term...we may feel the Universe/God is biased...but over a Loooong term...there is JUSTICE..n EQUALITY (of Probability..)..?? :P

So armed with this thought...and tonnes of emptiness....i sat blinking before my monitor....waiting....fer the magic to happen...

And happen it did...!!

Before long, between my work....I had whipped up a couple of lines to show me graphically the results of 1,000 coin help me 'see'...

And the results...are (t)here fer YOU to see...! :)
  • n(heads)  = 504 
  • n(tails)    = 496
{ Click on the picture below !} 

    Moral: EVEN a state of ORDER has CHAOS & Randomness underneath...! :) 
    It is just amazing HOW a seemingly random set of events...can aggregate and 'appear' to be 'orderly' to our Mind/Brain...! 

    Is it not pa..? :)

    Phew..! :)

    Love & Best Wishes,
    The boy in "rags"