# Zürich from a Scientific Lens

Note: I don’t usually publish what I write in my journal but this just has to be an exception.

July 8, 2017

Entry 1 As I head to Zürich, I cannot help but feel an elevating sense of excitement. I have been there once before on Ankit’s invitation to visit ETH Zürich’s computer science department but I barely explored anything else in that visit. This time, however, I have fully planned the trip. As soon as my train reaches Zürich in 20 minutes, I will put it into execution.

I will begin by visiting the ETH Bibliothek (ETH Zürich’s library). Then I will wander across the building of ETH Zürich. By 1045, I will enter the Swiss National Museum, followed by a visit to the Kunsthaus Zürich (the Zürich Museum of Fine Arts) at 1230. At 1415, I will take a walk in the Chinese Garden in Zürich followed by a visit to Lake Zürich. At the end of the day, I plan to take the train on platform 31 at 1802 back to Lausanne and reach my room by 2054. Here’s to an educational, informative and exciting adventure!

Entry 2 As I sit here in the main wing of ETH Bibliothek, I cannot hide my admiration and amazement at the cultural wealth and beauty of the ETH Zürich campus. I wonder how Einstein must have felt while studying here and later in his life teaching here. How Von Neumann attended lectures in these auditoriums while pursuing his undergraduate degree here. Twenty one Nobel laureates have been part of this wonderful place. An even larger number have set foot in it.

Entry 3 Once again, I find myself in the main building of ETH Zürich but this time after having visited and marvelled at the splendour of the Universitat Zürich Zoological Museum, the Swiss National Museum and the Zürich Museum of Fine Arts (I visited them in the order I mentioned them). As a science enthusiast, it is unneccessary to mention the fact that I liked the Zoological Museum most. It contained the skeleton of a mammoth and the fossilized skeleton of one of  the first fish species to evolve tiny legs for crawling onto land. That skeleton (or the individual it belonged to) may as well be my ancestor! (and an ancestor to the homo sapiens, our species).

The Swiss National Museum contained a display on migrants including Albert Einstein mentioning how he moved to Zürich after completing school, studied at ETH Zürich and kater in developed the general theory of relativity here before migrating to the United States. The Zürich Museum of Fine Arts technically had a ticket not covered by my Swiss Pass but the nice attendants there (secretly) gave me a free ticket. No doubt it contained amazing stuff. Unfortunately, I have not learnt to understand or critique art yet but I took lots of pictures (of all three museums) so maybe some day when/if I manage to learn the skill of comprehending artistic expression I can take a look at the pictures and experience some of the admiration and awe that comes with comprehension and which I sadly missed today.

I returned to the ETH Zürich main building because my phone’s battery was almost completely drained due to all the camera, mobile data and GPS usage. Since I need my phone to find my way in Zürich, it was a necessary delay. There are only two things left in today’s plan. the Chinese Garden and Lake Zürich. Due to the extra stop made at the Zoological Museum, I might end up having to give up on one of the spots if I intern to catch the 1802 train back to Renens but I will try my best to make the most of the remaining time.

Entry 4 Change of plans. I just fiund and ETH Bibliothek pamphlet titled “Einstein’s Zürich”. The pamphlet mentions ten places relevant to Einstein’s life and work in ETH Zürich’s many buildings spread all over Zürich and other places. My new plan is to spend the remaining time I have before the train arrives in visiting as many of these ten places as possible.

Entry 5 I succeeded in visiting four of the ten places. The first being ETH Zürich itself. The second Einstein’s residence between 1886 to 1888 and from 1889 to 1900 at Unionstrasse 4. It even contained a memory plaque commemorating Einstein. The third was Einstein’s residence from 1900 to 1901 and fourth place was the site of ETH Zürich’s old physics department where Einstein was a full professor of theoretical physics from 1912 to 1914. The site now has the ETH Zürich electrical engineering department. It started raining after that so I was forced to hurry to the Zürich central train station. Overall, this was a truly amazing day. Quite possibly, one of the finest days of my life.

# Fluttering For A Day – An Elegy

No matter how eloquently put by Carl Sagan, the thought is still agonizing. We have too little time. Eighty years? Ninety years? Is that enough to live a happy and meaningful life? I cannot say. Is it enough to gain an adequate amount of knowledge? No. Let alone research, it is not even enough to complete the current past records of our own species. It is not even enough to complete one form of the records of our species.

According to Google, in 2010 there were 129, 864, 880 unique books (~130 million) in the world. (source) Imagine if a person lives for 80 years and begins reading one entire book a day ever since he learns to read at the age of 10. That translates to a mere $70 \times 365 = 25550$ books. That is a little less than $0.02$ percent of the books our species currently possesses. Of course this is only a ballpark figure as a lot of books probably containing similar information but it is not inaccurate to claim that even a life spent in the pursuit of information will result in an individual gaining an almost negligible slice of what is present.

How do we resolve this tragedy? My own take is not to think of knowledge as something to be completely acquired by an individual but more like a network of ideas and information collectively owned by the entire species. Somewhat akin to a distributed file system or a cloud architecture like the one used for Google’s page ranking or Facebook’s TAO abstraction. A researcher caches a small slice of this entity in his or her lifetime and uses it to (if he or she is fortunate) add a yet undiscovered and exciting piece to the entity, leaving it larger and more elegant than what it was before.

# How Carpal Tunnel improved my Code

“Waterfall”. M.C Escher.1961.

When I started waking up with annoying and persistent tingling every morning around one and a half years ago, I didn’t take it very seriously which probably was the wrong thing to do. By the middle of 2016 however, the pain had gotten annoying enough to affect my concentration which is when it was evident that I had carpal tunnel. With help from my father who is luckily a medical doctor and told me about wrist braces and various lifestyle changes, the pain became a little manageable however I was still left with an engineering constraint.

Here is what usually happens when I sit and type: After the first ten minutes the area between the thumb and index finger of my left hand begins tingling (I am left handed so it starts with the left hand). Around the seventeen minute mark, my right hand starts feeling similar tingling. After around half and hour, my hands are pretty much in pain and I also begin feeling pain around my shoulders. After forty minutes, I simply have to stand up and either walk around or lie down for a bit before resuming work. The pain subsides more or less completely after ten minutes of rest but my breaks typically last twenty minutes as I am lazy.

To summarize, every forty minutes of typing incurs a cost of 20 minutes. Initially, I was pretty depressed as I made the mistaken and naive assumption of time spent writing code was directly proportional to my productivity as a programmer. With that assumption, carpal tunnel meant a ~33.3% loss in productivity. I have been measuring my roughly productivity by assigning difficulty levels to tasks I store on Google Tasks. This includes research projects, course projects, assignments, reading textbooks/documentation etc. Surprisingly, after eight months of this, it seems my initial assumption of a ~33.3% loss in productivity could not have been more inaccurate. In fact, it seems to me that my productivity has actually  increased over this period.

Yes, I am aware that correlation does not imply causality. Understandably, there are a lot of factors involved in this increase in productivity from the fact that I gain more knowledge and experience with time to the fact that my caffeine consumption has also increased significantly. However, I am still convinced that carpal tunnel is playing a significant role in this trend. Here are a few reasons why I think that is the case.

1- The 20 minute “break” isn’t time wasted

In fact, during the 20 minute break I think about the code I have written and what I plan to do in my next 40 minute work session. In other words, this has turned into a kind of planning session that precedes every work session. The key advantage to this is that, earlier on if I had say ways to approach subproblem X, I would first mentally sort them in descending order with an order principle like: ($w_{1}$ * ease of implementation + $w_{2}$ * probability of working – $w_{3}$ * computational resources required) where the $w_{i}$s are weights. Then, I would mentally execute the following algorithm:


approach_list = []

while not tired:
new_approach = think_of_approach()
approach_list.push(new_approach)

sort(approach_list)

while not working_fine(current_approach):
current_approach = approach_list.pop()
implement(current_approach)
test(current_approach)



until I managed to come up with one that worked fine.

Now what the planning session allows me to do is prune the approach_list before the implementation and testing steps by simply thinking through all the approaches and removing the ones I can deduce (or when I’m really unsure, mathematically prove) will not work. In other words, now I execute the following in between the two while loops (after sorting, although it doesn’t matter):


approach_list.filter(approach => deduce_correct(approach))



Since the deduce_correct function takes less time in the average case than implementtest, this method of pruning the dataset more than offsets the 20 minutes “wasted” in the planning session.

2- Pain incentivizes cleaner code

When every key-press hurts your hands, it is not difficult to motivate yourself to write code that is more:

• Clear: as altering, say, variable values to figure out what a piece of code is doing later in case I forget will result in more agony.
• Concise: the less code I write to address every problem, the less it hurts.
• Reliant on the standard library and third party APIs: reinventing the wheel hurts too much.
• Better commented: The last thing I want to do is rewrite a routine because I’ve forgotten how it works. The clearer (and more concise) comments I write, the less painful my future.

3- Picking the right tool

This is in some ways a corollary of reason 2. I have now also become more inclined to begin projects using programming languages and technologies that will help me get them done with the least amount of boilerplate code etc. While admittedly this can add performance and scalability challenges as things get more complex, I realize I often over-complicated my life by thinking that far ahead resulting in even bare-bones functionality taking a long time to get implemented and in me often resorting to hacky solutions. For example, it is almost redundant to mention that a simple web-crawler written quickly and beautifully with python + urllib or node-js + https/http libs (or even bash + wget) can take over twice the time (and twice the code) if implemented in certain other languages (Captain obvious: “He means Java”).

Statistics: Writing this took me 1.575 writing sessions and 2 planning sessions. 🙂

# 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. 🙂

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?

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