Road to Nerdvana

The Best Course I’ve Taken Yet


CS210 – Discrete Mathematics. Hands down the best course I have ever taken. I will argue my case from three different perspectives.

Discrete Mathematics as a Mathematics course

a.k.a Why Formal Math is good too, but Discrete Math is better.

I took both Discrete Mathematics and Introduction to Formal Mathematics in the same semester. I found Discrete Mathematics to be better. Why? It covers almost everything one learns in a formal mathematics course plus more exciting stuff! Formal mathematics covered proof-writing, set theory, cardinality, equivalence relations, functions and (very very) introductory group theory. Discrete Mathematics covered all of this except for the group theory part. However, it also covered introductory number theory, RSA Encryption (we missed that part, though. Due to cancellation of the last class), principles of counting and (the best and most exciting part) graph theory.

Discrete Mathematics as a Computer Science course

a.k.a Mathematics makes code fast and pretty.

Every Computer Scientist on the planet should take a course on discrete mathematics. It gives one the mathematical maturity needed for algorithm design, automata theory, data structures, computational complexity etc. On top of that, it helps one become a better programmer. It teaches one a way of thinking that enables one to write more efficient and, indeed, more beautiful code.

Discrete Mathematics as a Liberal Arts course

a.k.a One can’t argue with a sound mathematical proof

“Liberal arts and math? Lol, who is this nerd trying to kid.” I’m serious, though. To start with, Discrete Mathematics teaches logic. What’s better? It teaches quantified logic and proof writing. This helps one make better arguments and (more importantly) accept only claims backed with rational arguments, which helps one understand the world better.

Contemplations on Algorithmic Earth-Keeping


Here’s an idea that came to me just I was about to sleep right now. Why not… computerize the earth? Create one huge planetary network?

*readers shouting* “Maybe you mean… the internet?”

I know. What I mean is something more centralized and more intelligent. I’ll give you an example. A very  simple one.

Stabilizing Climate Change

First, divide all of the land of the planet into (geographical, not political) regions and assign a node to each region in the global network. Now create a world-wide fund for forest-preservation and rehabilitation. Let’s create an algorithm like the following:

Input: Carbon contribution (= CO2 emmission – CO2 consumption) at each node

Output: Weight of each node which in this application is the percentage of the world-wide reforestation fund assigned to that node.

A smart algorithm designed for this kind of network will finally create the effective, highly organized and intelligently executed world-wide reforestation effort that is needed to save the planet right now. Regions with less fertile soil e.g the Persian Gulf will, of course, require more funds per tree than regions like Indus Plain but our theoretical algorithm is intelligent enough to consider all such factors.

Of course I have mention reforestation only just for the sake of simplicity. There is no reason not to extend this to automobile restrictions, industrial pollution regulations, mass transit funding, solar panel / wind farm subsidies etc.

World Humanitarian™ Algorithm

Input: “Disaster Reports” from every node. Quantified on a scale that is proportional to the number of people affected, land area affected, population density and demographics of the region. To be more general, the HDI of every node, the living standards, levels of oppression etc.

The algorithm analyses the urgency of the situation in case of any disaster or generally measures a quantified ‘prosperity’ property for the node. Then it does the following:

  • Publicizes donation requests on the nodes with higher prosperity for the nodes with critically low prosperity. In case of a disaster, also publicizes relief and volunteer requests.
  • Calculates amount of international development funding assigned by more prosperous nodes for less prosperous ones.
  • Creates economic simulations for best possible bail-out strategies.

Estimates of the number of relief workers

Global Smart Grid

Same concept at play. This time with energy exchange.

Maybe something like this could help our civilization reach Type 1 status on the Kardeshiv scale. That’s my two cents, anyway.

Four Stanzas Down, The Sonnet is Still Incomplete.


Hello there.

The stream will cease to flow;
The wind will cease to blow;
The clouds will cease to fleet;
The heart will cease to beat;
For all things must die.
All things must die.

“All Things will Die” Verses 9-14 – Alfred Lord Tennyson

On the other hand,

The stream flows,
The wind blows,
The cloud fleets,
The heart beats,
Nothing will die.

“Nothing will Die” Verses 9-13 – Alfred Lord Tennyson

Yesterday was the fourth anniversary of my blog. Looking back, a lot has happened. Four years… woah. When I began this blog, I was a sixteen-year old nerdy high-schooler who really didn’t get out much and had lots of tics which aggravated whenever he met people or was nervous. Look how things have changed. Now I’ve become so awesome. I am now a twenty-year old nerdy college-student who really doesn’t get out much and has lots of tics which aggravate whenever he meets people or is nervous. Okay fine, not much has changed. Sigh. -_-

But hey, I met two of my heros. Usman Naseer and Pervez Hoodbhoy. 🙂

hoodbhoy and naseer

I was tremendously obsessed with Computer Programming, I remember. Most of my first posts were about design patterns in Java, along with some SDL Tutorials and Programming humor.  I made video games, applications and whatnot. Then my interests slowly changed and I got increasingly interested in Physics. That was the only subject I got a good grade in, in my A Levels, but I got a distinction in it so luckily got into a reasonably good university. At around this time, my blog was filled with physics posts upon physics posts. Hilarious part is, it kind of burned out. Faded away, and back came Computer Programming but now in its more mature and mathematically rigorous form, Computer Science. In a way, perhaps Computer Science was a line and Physics was a squiggle:

How did this come about? Well, four years ago I thought Computer Science was Software Engineering. That was quite possibly one of the biggest misconceptions of my life. Computer Science is far more than Software Engineering. In fact, Computer Science is much more than just computers. As one of the greatest Computer Scientists of all time, Edsger W. Dijikstra said, “Computer science is no more about computers than astronomy is about telescopes.“. As I wrote in the Facebook group I created for my batch’s Computer Science majors, Computer Science is, among other things, about finding simplicity in complexity. It is about understanding abstract machines and the fundamental problems that can be solved with them. It is about understanding reality better using mathematical models. It is about solving problems that allow the creation of medicine and vaccines that save the lives of millions and cure cancer. It is about finding techniques that solve the most fundamental problems humanity has ever faced. Most importantly, it is about finding truth and beauty.

Why write a blog in the first place? Well, I have no idea. Initially it started out just because I was bored. The more I wrote, though, the more I felt empowered. I could express myself far better than I could ever do in person. I could share information, share my passions, my opinions, teach people stuff, complain about things. It was my voice. My corner in cyberspace. “Mistakes have been made”, though. I have written several posts I do not agree with anymore. I have written several things I’m downright embarrassed about. On the bright side, though, I’m kind of proud of some of the things I wrote. Such as this post.

The best part is, writing helps me fight one of the things I fear most… loneliness. There have been several times in part four years when I have been friendless. It is scary. Eats you up, one feels purposeless. In those dark times, I have written some of my best posts. Kind of reminds me of that amazing poem by Maya Angelou…

Leaving behind nights of terror and fear
I rise
Into a daybreak that’s wondrously clear
I rise
Bringing the gifts that my ancestors gave,
I am the dream and the hope of the slave.
I rise
I rise
I rise.

“Still I Rise” Stanza 9 – Maya Angelou

What do I think of life? Life is wonderful. I don’t mean that in the personal sense. Whether my life is wonderful or not, life in general is a wonderful thing. How amazing is it that we have been given this brief period in time to observe the beauty and mysteries of the Cosmos. One of Carl Sagan’s quotes especially appeals to me, “we make our world significant by the courage of our questions and the depth of our answers.” I also love how Richard Dawkins puts it (non-youtube link for people in oppressive regimes):

At the end of the day, even though one must never lose sight of the big picture. It is the little things in life that turn out to be the more important. Curiosity. Empathy. Love. Wonder. Kindness. Helping someone out, being kind, being sympathetic. This world has so much pain and suffering. Children starving, terminal diseases, people in pain, people in misery. I can never understand how anyone can ever have the audacity to kill another being. Life is precious, life is beautiful. Make the most of this life. Bertrand Russel’s words, I think, sum it all up the best in the prologue to his autobiography. Which is perhaps the most beautiful passage anyone has ever written:

What I Have Lived For

Three passions, simple but overwhelmingly strong, have governed my life: the longing for love, the search for knowledge, and unbearable pity for the suffering of mankind. These passions, like great winds, have blown me hither and thither, in a wayward course, over a great ocean of anguish, reaching to the very verge of despair.

I have sought love, first, because it brings ecstasy – ecstasy so great that I would often have sacrificed all the rest of life for a few hours of this joy. I have sought it, next, because it relieves loneliness–that terrible loneliness in which one shivering consciousness looks over the rim of the world into the cold unfathomable lifeless abyss. I have sought it finally, because in the union of love I have seen, in a mystic miniature, the prefiguring vision of the heaven that saints and poets have imagined. This is what I sought, and though it might seem too good for human life, this is what–at last–I have found.

With equal passion I have sought knowledge. I have wished to understand the hearts of men. I have wished to know why the stars shine. And I have tried to apprehend the Pythagorean power by which number holds sway above the flux. A little of this, but not much, I have achieved.

Love and knowledge, so far as they were possible, led upward toward the heavens. But always pity brought me back to earth. Echoes of cries of pain reverberate in my heart. Children in famine, victims tortured by oppressors, helpless old people a burden to their sons, and the whole world of loneliness, poverty, and pain make a mockery of what human life should be. I long to alleviate this evil, but I cannot, and I too suffer.

This has been my life. I have found it worth living, and would gladly live it again if the chance were offered me.

– Prologue to Autobiography, Bertrand Russell.

I usually only reserve this phrase for very awesome people but…

Take care and don’t forget to be awesome.

Thoughts on Nuclear Bombs


Moreover, the enemy has begun to employ a new and most cruel bomb, the power of which to do damage is, indeed, incalculable, taking the toll of many innocent lives.   Should we continue to fight, it would not only result in an ultimate collapse and obliteration of the Japanese nation, but also it would lead to the total extinction of human civilization.            ~ Emperor Hirohito

Note: Yes, this post and short and I’ve just shared stuff. You try writing original content a day before a Linear Algebra exam.

So you decided to be a Scientist?

By Muhammad Ahmad Tirmazi

So you decided to ignore

And refute fables from the days of yore

So you decided instead, to soar

And sail out of the cosmic shore

So you decided to open the door

And let go of the delusions you bore

So you decided to let the pleasure roar

And fulfill your curiosity to the core

Shoveling Away the Earth

Disclaimer: I’m brain-damaged.

Ridiculous question, but let’s say you took a shovel and tried to shovel away the entire planet. How long would it take to shovel it all away? Firstly, it doesn’t take an Einstein to figure out that doing this isn’t really that easy. You can’t actually shovel away all of Earth, with its hot plasma core and whatnot with a bloody shovel, but let’s oversimplify everything to an “assuming the chickens to be spherical and in a vacuum” level and assume we have a shovel that can essentially shovel away any possible substance, without breaking, disintegrating or melting. How long would it take one to shovel away all of the earth?

The capacity of an average bucket is about 8 m^3, we’re already ridiculously oversimplifying everything, might as well assume the shovel we’re using to have the same capacity. Next, what about the Earth? The circumference of the earth is approximately 4.0075 \times 10^7 m, and since the radius equals the circumference divided by 2\pi. the radius of the Earth is about 6.38 \times 10^6 m. Since the volume of a sphere is \frac{4}{3} \pi r^3, and we’re being super simplistic and assuming the Earth is a sphere, the volume of the Earth turns out to be a whopping 1.09 \times 10^{21} m^3.

Now, not considering the fact that the Earth also has fluids etc. and different materials on Earth have vastly different densities, the number of shovel strokes we’ll need to shovel away all of Earth is \frac{1.09 \times 10^{21} m^3}{8 m^3} = ~1.36 \times 10^{20} strokes. Let’s say we’re working at a rate of 1 stroke every five seconds i.e \frac{1}{5} strokes per second, then the time needed to shovel away all of Earth is about 6.8 \times 10^{20} s or about 22 thousand billion years! The current age of the universe is about 13.8 billion years so that is one heck of a lot of time.

Note: Since I gave the answer in years, I’m assuming we’re using a definition for a year based on the speed of light and not the orbital period of the Earth around the Sun since the mass of the Earth will be decreasing because of our stupid shoveling endeavor. But then again, since the equation for orbital period only takes into account the mass of the more massive body (i.e the Sun), I don’t think decreasing the mass of the earth will change its orbital period assuming the semi-major axis of its orbit remains constant. 

However, as we shovel out the mass, because momentum is always conserved, Earth will gain a very tiny velocity in the opposite direction to the direction we’re shoveling out the mass. We can sum up all these tiny gains in velocity (probably by integration) to figure out the semi-major axis of orbit and hence the orbital period every year. I have a hunch that if one begins shoveling on the equator and throws the mass shoveled directly upward, since the earth is rotating all the tiny gains in velocity will cancel out and the orbital period will not change and hence the answer will still turn out to be the one I stated above.

There is no Formula

Shortly before I got mercilessly rejected from MIT last year, I read an article on the MIT Admissions blogs titled “There is No Formula” which highlighted how there wasn’t an easy set of checkpoints you could complete to ensure your ticket to MIT. Being but an MIT reject, I am focusing on other goals like becoming a scientist.

Most people think you have to be super smart to be a scientist. Popular culture depicts the scientist as possessing a higher IQ level and level of intelligence than an average person. I used to think that too. I believed that only smart people became good scientists. I also believed I was smart. Both of these beliefs have been shaken completely now that I’ve actually embarked on the journey.

As the great Carl Sagan said in his book Pale Blue Dot: A Vision of the Human Future in Space,

“Modern science has been a voyage into the unknown, with a lesson in humility waiting at every stop.”.
Something I’ve realized us that you don’t need to be smart to be a good scientist. The biggest requirement for becoming a scientist is to be passionate and endlessly curious. There is no formula to become a scientist. Science is a risky profession and a risky tool. It brings with it lots of responsibilities. It isn’t always used correctly. Science has been used to create horrifying weapons they harness the energy stored in the nucleus of an atom. At the trinity test, the first successful test of an atomic bomb, the physicist Robert Oppenheimer quoted the following verse from the Bhagavad Gita:
“kālo’smi lokakṣayakṛtpravṛddho lokānsamāhartumiha pravṛttaḥ”
The English translation of which is
I am become Death, the destroyer of worlds.
And yet, even though I don’t support nuclear weapons at all, is there any way us puny humans can ever wield that kind of power if not for science? We must remember that we weren’t the first to harness nuclear energy. There is a nuclear reactor in our cosmic neighborhood that has been using this technology long before we emerged as a species. In fact it is the reason we emerged as a species. The Sun.

Our ancestors lived a life of bleak prospects. Their average life expectancy was about 20-30 years. In between all the hunting, gathering and foraging, there was little time to wonder about the reason behind our existence and our goals as a species. And yet, those are the very questions that drove our ancestors to accomplish their most mythic achievements. Science is what has been driving our species forward. It is what drives our economies and what grows our industries. But most importantly, it is the one thing that can vanquish the darkness that surrounds us.

We may be tiny ape-like germs on a speck of dust, but we have developed  a tool that can predict the motions of galaxies and determine the origin and fate of the cosmos. Merely thinking about this gives one a sense of euphoria. Whether they are accepted as such or not, scientists have always been the real heros of our species. They are the equivalent of brave wanderers who, in olden times, set off to discover lands unseen and bounties unimagined.

Yes. Science is flawed. I never said it wasn’t. It can take lives at a mind blowing scale. But hasn’t it also saved lives at an even larger scale? There are more people alive today  than there ever were in history. This has all been possible due to science. Science increases agricultural productivity and survival chances. It is the reason the planet can sustain more than seven billion people.

The British poet W. H. Auden wrote, in the final stanza of his poem, “After Reading a Child’s Guide to Modern Physics” (click here to read the full poem. It’s amazing),
It has chosen once, it seems,
And whether our concern
For magnitude’s extremes
Really become a creature
Who comes in a median size,
Or politicizing Nature
Be altogether wise,
Is something we shall learn.
And indeed, we do not yet know whether it is wise for ‘median sized’ creatures like us to concern ourselves with the knowledge of ‘magnitude’s extremes’ from the infinitesimal quarks and leptons to the humongous galaxies and nebulae, but we can’t help it. We crave to understand where we came from and why we are here.

The Candle in the Dark

By Muhammad A. Tirmazi

Note: The title of this poem has been derived from the title of the book: “The Demon-haunted World – Science as a Candle in the Dark” by Carl Sagan.

The darkness does indeed haunt
The unknown does surely daunt
And Ignorance tempts one to flaunt
And concoct comforting fables
To replace the answers we want

Yet there is one way
To let Nature convey
Its mysteries and lay
Its beauty before one’s gaze
And help one seize the day

If one dares to learn
The language Nature yearns
To use to express and adorn
Its passions and wonders
One can, against the tide, burn

The heroes of the past
Those whose ideas last
Are not the conquerers who cast
The curse of mysery and death
In search of splendors shiny and vast

Pythagoras will be remembered long
After Hitler, Napoleon and Mao Xi Dong
Are lost to history and all the wrong
They committed drowned in oblivion
And Euclid’s legacy will be forever strong

The fluxions of the one who unweaved
The rainbow shall forever seed
Awe and wonder, and breed
Curiosity in generations to come
While none shall recall Victoria’s greed

The mathematical principles in print
Of Natural Philosophy that hint
At the workings of planets, glint
In an immortal shine. While none
Know of the master of mint.

In the same light shall forever shine
The identity that dares to align
The five symbols deemed divine
Of Euler, Hero, Babylon, Unity, India
In a melodious intertwine

This profound and beautiful embrace
Of logic and proof, a race
To unravel the secrets of space
Is perhaps the most noble of goals
We humans shall ever grace

No amount of inquisitions and popes
Can ever stifle the hopes
Of using science to grope
Into the darkness and discover
The candle that lights up our scope

The candle in the dark
Will always be a mark
Of humanity’s courage to embark
On a quest to understand the cosmos
From dark matter right down to the quark

For only if we continue to prod
Into the unknown and applaud
The triumphs of those who trod
And discovered wonders undreamt of,
Shall we know the mind of God