Monday, July 23, 2018

Recursion to calculate Factorial

Recursion is the method of breaking down a problem into sub-parts, progressively into smaller and smaller parts, such that the last part's solution becomes easily/manually solvable.

To know factorial of 5 i.e 5! which is 5*4!, we need factorial of 4.

Hence the recursive code, recursively calls the same logical code/method to find 4!, which in turn would require 3! ; then 2! ; and then 1! and ultimately 0! which is known to be 1.

Knowing 0!=1 ; would trace back the path in backward way i.e we would know 1!=1*0!=1*1=1
2!=2*1!=2*1=2
3!=3*2!=3* 2=6
4!=4*3!=4*6=24
5!=5*4!=5*24=120

Generalizing this algorithmic logic

Similarly to know factorial of any integer n, Recursion goes back all the way from n to (n-1) to (n-2) and so on to 0! ;
and then traces back in the reverse direction, from 0!=1 to 1! to 2! to 3! and so on to ultimately get the answer of n!







          

Sunday, July 22, 2018

Conceptual, Java: Understanding modularization in Programming Code

Objective: Displaying need and benefits of modularized code in Programming
using a sample case scenario- To display first three positive odd integers, and their sum.

Learning: Instead of writing all code within a single Main class, using the Main class as controller class, and different methods of different classes ,specialized to perform specific functions.

Benefits: Code becomes generalized, same program can be used for adding other computational operations like Substraction, Multiplication, Division etc by adding the methods to one class, without other classes and methods getting affected. Similarly, code re-usability, maintainability becomes high.

*****************************************************************
Directory and Package Structure



*****************************************************************
/Java_Core/src/Controller.java




/Java_Core/src/DataProvider.java





/Java_Core/src/Display.java



Result/Output on Running






Friday, May 18, 2018

Why I believe in the optimism of Data Science

It’s  the wee hours of the day and as I pass through the subway at Barakhamba , I often stand witness to a tragic unfolding event. This dimly lit subway is a routine passage for everyday commuters, hustling to meet their  fast receding deadlines. However not everyone seems to be in a hurry. There exists a family of four  here, who have made this passage their home ; the so called home of the under-privileged, with a single wall to rest besides and the temporary plastic sheets on which lays haphazard objects, epitomizing the  parched, abject poverty of the not so unfortunate ones.


The exit of the subway opens up a new door to a new world, not just literally but also metaphorically. In the night sky today, these posh clubs and the happening casinos here, outshine everything else-  a glaring contrast with the emptiness and nothingness of the futile world, I witnessed moments before, as I walked past the subway tunnel. Is mankind so insensitive and alienated to the miseries of fellow brethren,  to allow the existence of two sharply unequal worlds, a mere few meters apart? Can Data Science do nothing about it? Is Data Science only a technological construct to be relegated to the ivory towers of the corporate glitz? My answer would be in the negative.

Data Science is that beautiful science which could, and is already impacting billions of lives all over the world. What existed as meaningless dumps of hollow, useless data is being slowly transformed into rich, purposeful insights. It is these predictive insights that allow us make decision trees and action maps – slowly but surely a scientific procedure driven by data-driven action agenda , would transform for the better, several lives, not just those group of four that I regularly witness in my subway passages but their entire generations to come. It is this inter-generational shift , which behooves the future of Data Science.
Armed with visualizations and statistics ;  cluster maps ,R and Python languages ;  complemented with Big-Data and Social Media Analytics , Cloud , Mobile and Ubiquitous computing ; along with Internet of things , Robotics and Artificial Intelligence – we can surely create a better world.

Data driven policies would not only be more precise in meeting localized needs of poverty estimates but would also offer real-time , flexible, adaptable, customized solutions for various multi-dimensional purposes – be it faster, efficient surveys ; accurate and enriched computational models of data-analysis ; facilitation of those ‘aggregation benefits’ and nudge-units of Applied Behavioral / Functional interventions  ; thematic clusters maps and decision models ; qualitative and quantitative data plots throwing up scenarios , permutations and combinations that previously didn’t seem to exist  - and the list goes on.

Today, the world needs data-scientists to not just be passive observers, reacting to changing scenarios but actively engage proactively in solving problems here and now. If the data scientists of today, mobilize community participants as citizen-scientists, volunteers – billions of lives around the world could be lifted out of debilitating poverty ; interventions can be made more specific thereby ensuring every Rupee spent reaches the intended beneficiary; eliminating leakages of corruption and inefficiency; cities can be made more safer  and more resilient to both natural and artificial disasters ; food can be more nutritious and education more relevant to changing needs of the technocratic society; jobs can be matched to skills and the aspirations of billions of youth made to fructify.

The hope that Data Science in the above discussion brings is not exhaustive. There are countless possibilities that are ever increasing and awaiting for someone, somewhere to realize their potential. In my opinion, if there is any single technological solution that can dramatically alter the fortunes  for better, of that unprivileged, impoverished family of four dwelling in the subway passage , it is only Data Science ; for what petro-dollars can’t do , I believe Data Science can.  



Monday, April 16, 2018

“Data is the new oil.” - Clive Humby

Clive Humby, the world renowned Data Innovator, once said – “Data is the new oil. It’s valuable, but if unrefined it cannot really be used. It has to be changed into gas, plastic, chemicals, etc to create a valuable entity that drives profitable activity; so must data be broken down, analyzed for it to have value.

As another wave of Industrial Revolution, the so called ‘Fourth Industrial Revolution’ unfolds right before our eyes, albeit at different intensities and speeds in the developed and developing parts of the world, it is absolutely thrilling to not only witness the data driven changes but to be a part of it – Like photons and neutrinos of the cosmic world interacting seamlessly with all forms of matter, we see data touching our lives and impacting every moment of it. Indeed this very ubiquity of data, and myriad forms in which it is being analyzed and presented – makes Data Science, such a fascinating subject to study.

Data Science is not just a technical buzzword or another specialist domain relegated to classrooms of Computer Science and Information Technology courses ; but a process live and happening throughout the world , cutting across subject domains , geographical barriers , education divides etc – from the farmer banking on organized data-sets , rich visualizations to predict sowing and harvesting timings according to anticipation of atmospheric moisture and local weather patterns , to the scientists exploring the mysteries of the ‘Dark Matter’ and ‘Gravitational Waves’ – the sheer width and depth of data churning from the ivory towers to the common streets , makes this subject beautifully inter-disciplinary in nature.

Just like the oil polity and oil economics, we have a data polity outlining and shaping, national and international policies around data privacy, transparency, autonomy, rights , consent and violation principles ; we have a data driven economic world – the hype around ‘Crypto-Currencies’ and the associated ‘Shared Public Ledger Technology’ ; data and big-data analytics throwing up new insights, patterns and relatedness among factors that previously didn’t seem to exist ; be it the latest data driven innovations in Machine Learning , Robotics , Artificial Intelligence ; ‘Precision Medicine’ customized to individual needs; faster, efficient, more accurate diagnostics techniques saving billions of lives all around the world ; be it data-driven climate models helping understand the vagaries of climate change and weather fluctuations all around the world, thereby helping in disaster preparedness and mitigation efforts ; be it better education and health policies  or the charm of ‘Nudge Units’/’Functional Behavioral Economics’ allowing for innovative , constructive innovations to be applied in several multi-dimensional ways – the world has certainly arrived at a stage where data is indeed omnipresent.
               
Like any new innovation, data science too would have it’s share of supporters and criticizers. But one thing is for sure , love it or hate it , you simply can’t ignore it. The webs of data science are spread far and wide. It is this data revolution that is shaping and actively modifying, not only the inanimate external world , but also the biological, psychological, living world of animals and humans. Researchers are predicting that the world in the age of Fourth Industrial Revolution , revolving around ‘Internet of Things and Internet of Everything’ , ‘3-D Printing , Computer Aided Design and Computer Aided Manufacturing’ , ‘Robotics, Artificial Intelligence’ , ‘Quantum Computing , Super Computing and Green Computing’ woven around the lynchpin of Data Science and Big Data Analytics – would surely affect branches of science like Neuro-Science , Brain-Mapping , Computational Linguistics , Psychological constructs of Perception, Visual Reality and Augmented Realty etc in unique fascinating ways. So can it be any wrong to say that such a self-adapting , dynamic , ubiquitous science of ‘Data Science’ is an organismic entity on it’s own. Just like the human civilization adapts to changing realities of time-space and adapts continuously , like an ever evolving specie, so will evolve the science of Data Science.             

Friday, September 6, 2013

THE TRAP




It  was 7 in the evening. The last of the fading rays swept across my face, as I stood inclined to the railings……….. Waiting for the next metro, a few bundled pages occupied my grasp while my mind meandered away in a distant world…….I wasn't  there but my presence was….The presence that witnessed a toddler escaping the clutched prisons of his mother ,who had long denied his ever seeking attention….
on HIS knees  his vision explored…… And so did mine.…following each sight of his….. For us the world had simply stopped existing!. ………An everlasting stillness absorbed the backdrop,as my mind  saw the repainted world  through  HIS beaming eyes..

His tiny palms ,muddled in the last remains of the leathery traps, he was almost free …….but he wasn't...  The last of those  chained locks , the only difference that stood between him and his freedom was proving too much. …..And he knew it….his might was eluding him as his desperation gave way to despair………….Moments trickled past And  finally the cruel strap had sacked ……......
...Perhaps he had given up ……but his eyes carried hope as it explored again….On its journey, his sight met mine and a new game began!….We  spoke a silent language…..HIS were brimming with hope… Perhaps he needed a savior …For that shimmering twinkle was pleading ….pleading to set him free, for once forever……But something was changing and changing fast ! Those shimmering eyes were getting big and the twinkle bright!..........Bigger and brighter with each passing second !…..BIGGER~BRIGHTER.................my hallucinated eyes were constantly failing  to comprehend, as my enslaved conscious was paralyzed long ago……...Was my memory playing pranks?? .....And then it paused!...................
I saw him and he saw me…..mere centimeters apart!.......”Helloo!”….”Hellooooo……” ,Was the toddler speaking?????

The toddler wasn't but his mother was….. And my senses brought me back! My sheepish gaze  shifted to  her  stare…..She was  whimsical….perhaps she wanted an explanation, for  the doings of my eyes….for she had been playing a mute spectator  all along, while our mind games were on….perhaps she doubted my intentions...And in a treacherous world ,could she be faulted? There seemed no escape ….until my conscious finally came to my rescue….
I flipped to the cover  of the slender book----“HUMAN PSYCHOLOGY”, it read!

The day was saved ,as her radiant smile diminished in the shadows………..I caught the last impressions of the toddler, and there HE was……with a grin….a grin of a victory of HIS over mine!...for  the tiny enchanter had won for the day!


-Image Soucre:Google Images

Thursday, September 5, 2013

Re-Ignition

Their car which stood witness to many of their intimate moments was no less than a home to them. As the last of the fading rays filtered through the half open window pane, she sat with a serene silence, a silence that echoed the turbulence of a storm raging within.

They had a fight today. He knew it wasn't his fault, yet he was helpless.

With each passing moment, the reverberating silence pricked his heart deep to the core. The stillness of her uncharacteristic calmness were like the arrows thrusting a wounded heart, the answers were few and his desperation growing by the moment.

The power steering had taken to the driving wheel as his mind meandered away in figments of creativity. Through sharps turns and curvy meadows, the gusty winds swept across his face perhaps mocking his state of misery.  Like the howling winds sweeping a forest floor, free of the aching dry remains, his furious machine was zipping through the streets. Yet the irony was that the moments remained still.

An hour had flown past, but the two souls remained stagnant as ever. Perhaps time had paused for them; it was as if the creatures were waiting for a divine intervention; an intervention that could somehow infuse life into an ever pervasive silence of a graveyard.

Perhaps he too had given up. With a sinking heart, he turned on the car’s air fragrance.

Occasionally his gaze shifted to her, a few split seconds of a glance expecting to catch the emotions simmering in her eyes. The mind games were on and none knew the rules. The princess had turned hostile long ago, for she deliberately turned to the world on the other side. As if her mind floated in a dreamy land, she seemed adamant to find something in sheer nothingness.

Like the fork of a cross-road, their bodies may be close but their minds were poles apart; each traversing a pathway that remained ever so desolate. Perhaps she was re-living her memories of nostalgia, her mind brimming with a few enigmatic moments - the moments of their first long drive , far away from the maddening rush, the ambiance , the aroma , the serenity  of the cosmos and the mesmerizing tranquility of an ever confounding mysticism - her senses were lost , as if she was spell-bound by an aromatic charm, the world had simply stopped existing for her, for with each trickling moment she kept drifting in an ambrosial trap - his genuflecting on the knees for a stammering proposal , her acceptance and those purposeless long drives , those cuddles and the instantaneous bursts of laughter - within moments, everything seemed to have brightened up to the shimmering glitters of  yesteryears.

Hey.... hello !! I'm speaking to you!......there??here??where??What now?? Grrhhhhhhh.

Perhaps, the cackles of a crow and the croaks of a frog had soon shattered her pristine state. And there he was; the night had set in and standing among the shadows of their garage , he stood with keys in his hand, as if begging for the mistress to get down.


She swooped on him, clutching against his chest. It was as if the moments had suddenly turned eternal for her.


Like a nomad lost among the ruins of deserted barrens, who has somehow magically found an oasis; his emotions swayed from one extreme to another. Within moments, those very clouds of dark gloom had turned azure. Hopelessness turned into ecstasy and a new life was breathed into him. Hand-in-hand trolled the stupid couple!  He however was still contemplating the source that churned magic in thin air.....As the stair-case approached, his mind re-ignited to the eureka moment! Perhaps he had sensed it all; for he turns around to bid adieu to the master cupid, 'that car air fragrance’ - that was still creating magic in thin air.


Rohit

-Image Source:Google Images

Thursday, January 19, 2012

न जाने मैं कहाँ आ गया

मीलों तक छाया सन्नाटा,
बस अँधेरे रौशन हैं यहाँ,
वीरान गलियों से गुजर कर,

न जाने मैं कहाँ आ गया !

खामोश वादियों के बीच,
ख़ामोशी के आलम में,
अपने ही साये से बोलता,
न जाने मैं कहाँ आ गया !

कुछ धूमिल खवाब संजोए,
कुछ धूमिल आशाएँ लेकर,
अनजाने सपनों को तलाशता,
न जाने मैं कहाँ आ गया !

निकला एक काफिला था,
मेरे कदम थम गये क्यूँ ,
काफिले से बिखर कर,
न जाने मैं कहाँ आ गया !

सदियों से अकेले,
एक मुसाफिर चल रहा है,
एक खोया राहगीर बनकर,
न जाने मैं कहाँ आ गया !

कुछ लम्हें फिसल रहे हैं,
मंजिलें हैं ओझल,
लम्हों को बटोरता,
न जाने मैं कहाँ आ गया !

मेरी मंजिल न जाने कहाँ है,
मेरी चाह न जाने क्या है,
एक कब्रिस्तान की ख़ामोशी में,
न जाने मैं कहाँ आ गया !

Rohit


-Image source:Google Images