“The most beautiful thing we can experience is the mysterious. It is the source of all true art and science. He to whom this emotion is a stranger, who can no longer pause to wonder and stand rapt in awe, is as good as dead: his eyes are closed.” – Albert Einstein

Wednesday, 22 May 2013

More Conformal Maps With OpenCV

So I finally got the conformal maps code to work with some of the  other functions and the results are quite interesting and strange. Not really what I expected to get. The transformed images vaugely resemble the ones in my math textbook but don't match them exactly.

So again, here's the original image for reference:


I then applied the transformation $w = z^3$ to the image.

The results are quite satisfactory. No surprises there.











$w = z^3$ transformation
Next I tried $w = z + \frac{1}{z}$. I didn't really get what I expected ...

$w = z + \frac{1}{z}$
$w = log(z)$ looks like someone flattened the thing along the third dimension.

$w = log(z)$
Another version of $w = log(z)$ with the image in a different position.
The results for $w = sin(z)$ and $w = e^{z}$ were just plain weird.

$w = sin(z)$
$w = e^z$
But my favourite one was the transform $w = tan(z)$

$w = tan(z)$
$w = tan(z)$ with the image in a different starting position
A perfect example of mathematics creating art. They're not as good as fractals but they're still pretty good.

Sunday, 7 April 2013

Thoughts on Free Will and Determinism

The most important problem that comes up when talking about free will is the difficulty in defining the concept. How exactly do we define free will? There are many definitions with different levels of rigorousness. One way to define free will is in terms of the absolute laws of physics. We can define free will as "the ability of a conscious entity to make choices that are not affected in any way by the events that happened to the conscious entity in the past." This is the definition most often used by the group of people who are classified as incompatibilists. Another way to define it is in terms of other living things. We can define free will as "the freedom to chose which action to take in a particular situation without being hindered by other humans or conscious living beings." My opinion on whether free will exists or not is highly dependent on actual definition being used. I think it is extremely unlikely (and even impossible on principle) to have the kind of free will that is independent of influence from physical law. However if the definition on free will does not mention independence from past events and only concerns itself with restrictions on choices we make by other people, then I am willing to accept the possibility of free will existing.

In the second kind of definition, we are merely stating that when faced with a choice such as "Which profession to go into?" or "Which course do I take in college?" we have the freedom to go against the advice of our parents/teachers and do whatever we feel like at the time (not everyone has this freedom ;) ). This kind of freedom in principle exists. Although there are parents that force their children to make certain choices when it comes to college courses, the student can in principle choose not to accept that decision by ignoring or being prepared to accept the - sometimes unpleasant - consequences of their choice. That kind of free will exists and that is the picture of free will that comes to most people's minds when they hear about freedom. In fact, this free will or "social freedom" is the kind of freedom most people expect from modern society. It is what they refer to when they talk about "Freedom of speech" or "Freedom of expression".

However if your definition of free will that tries to say that human decisions are completely independent of the events that took place in your past, I disagree that such a kind of freedom exists. This kind of freedom is impossible to define without generating a contradiction. The human brain is a huge neural network that stores in the neurons different weights that are a result of our past experiences. These are the same neurons that make "conscious" decisions or "choices." I think that it is impossible for a human to make a decision or a choice whose sole originator is the human in question.

Recent results in neuroscience suggest that our conscious "mind" is not really the originator of our actions see: http://www.ncbi.nlm.nih.gov/pubmed/15925808?dopt=Abstract and http://www.ncbi.nlm.nih.gov/pubmed/12191935?dopt=Abstract
The results of these experiments seem to suggest that our "choices" are determined by the brain before our conscious mind becomes aware of the fact that we have made a choice. Results like these reduce the likelihood that the decisions we make are completely independent of past events. It may even be true that the only thing consciousness does is rationalize the involuntary actions of our sub conscious. The very idea that we have "Made a decision" may be an illusion in many situations.

I also disagree with people who simply wave their hands vaguely and say free will exists because Quantum Mechanics. While it is true that quantum mechanics is a probabilistic theory,  it doesn't help to "gift" free will to consciousness. Firstly it is highly dubious whether quantum mechanics is directly involved in human cognition and consciousness. Secondly even if quantum mechanics made our choices probabilistic it still doesn't mean that the decisions are free decisions. Decisions can only be classified as "free" if a people have the same probability of making a particular decision when faced with a particular choice independent of the experiences these people have had in the past. A coin that lands on heads half the time does not have "free will".

I think a lot of the confusion surrounding the debate about free will and determinism is because of the wide variety of ways in which people define "Free will". It's got so many definitions that it is impossible to say what people mean when they say "I believe in Free will". If someone ever says that the very first thing I will do is to ask them how they define free will. The debate should be pretty straightforward from that point on.

Tuesday, 12 March 2013

Playing around with OpenCV and Complex Functions

Last week my college hosted a technical fest. It was pretty cool. There was some really cool tech on display at for the exhibitions, some awesome guest lectures, robotics competitions and a lot of workshops. It was quite a busy and interesting week. I attended this really interesting workshop that introduced us to image processing using Matlab. We managed to get matlab to track a ball in the field of view of my laptop's webcam and use this motion to control windows media player and the movement of wheeled bots. Recently, I've become really interested in the field of Artificial Intelligence so this simple computer vision exercise got me excited. I came back to my room that evening and started exploring my options.

That evening I discovered an excellent Open Source alternative for doing image processing called OpenCV. I decided to abandon Matlab and do image processing in OpenCV instead (Because it's freeeeeeee!). That very evening I got OpenCV compiled and set up on my Ubuntu partition and started learning image processing.

I had a bit of difficulty starting out because I'd never really learnt C++ 'officially'. So I had to use my basic knowledge of C and a lot of googling to understand the basics of setting things up. The biggest hurdle was understanding how classes and objects worked. It took a few hours to smooth those concepts out. As soon as I had a rudimentary grasp of what they meant I could start writing my first image processing program.

So fooled around with flipping and adding noise to images for the last week. Then I got a brilliant idea. I was having a bit of trouble visualizing what I was learning in math class. We were doing conformal maps. So I thought that it might be a good idea to use OpenCV to visualize conformal maps. So I set out trying to apply conformal maps to Lenna,  one of the most famous test images used in image processing.

It took me a couple of days to make the code completely bug free. There were some really annoying bugs. The fact that images were stored in matrices whose indices followed a left handed coordinate system added to the difficulty of implementation. I had to apply multiple transformations in series to get the code to work. But in end everything came together and this was the result!

The result of applying the transformation $w = z^{2}$.
Right now, the only transformation that works perfectly is $w = z^{2}$. Other functions give really weird outputs. I'll figure them out eventually.

And I've decided to open source the code I used for this! It's very messy because it's not the final version of the code and it's full of commented code and random cout statements.  But maybe somebody will find it useful.

The code can be found here: http://pastebin.com/kBBP2ASe

Monday, 11 March 2013

0_0



Anthropocene


When you see all of humanity's achievements (and environmental mistakes) summed up like that it really gives you a sense of wonder. We've come so far in terms of technology.

I suddenly understand what Arthur C Clarke meant when he said: "Any sufficiently advanced technology is indistinguishable from magic." The full force and meaning of that statement is mind blowing and frisson inducing. The kind of things we're doing with technology today really is magical. It's a testament to the power of science. We've managed to understand nature so well that we can bend unimaginably tiny clusters of atoms to our will. It really is amazing.

This is the same Youtuber who gave us the wonderful Symphony of Science series. He makes some really awesome stuff.

Saturday, 9 March 2013

Team Fortress 2 on Ubuntu!

Something happened a few months ago that got me really excited. Valve announced that they were releasing Steam for Linux.  At that point I had already installed Ubuntu on my laptop and the only reason I still used windows was that all my awesome games were in my Windows partition. But steam for Linux changed everything. So one of the first games to be ported to Linux was my favorite War Themed Hat Simulator (aka FPS ) Team Fortress 2. There were some initial problems though. It turned out that to actually get steam running on Linux I needed to install some new Nvidia drivers. But these drivers did not have support for laptops that had the Intel Optimus technology which turned off the graphics card when it was not being used to save power. In Ubuntu, the way to get around this is to use a software called Bumblebee which acts as a substitute for Optimus. The new Nvidia drivers didn't work with Bumblebee initially. So I had to wait.

Now I've finally managed to get everything to work together. TF2 finally works on Linux!!! Only my sleeping roommates prevented my from screaming "IT'S ALIVE!!!!" to the rest of the universe.



The game runs beautifully and I think it runs even smoother than it does on windows! It's amazing. The fps stats showed hardly any stutter at all! 

There are still a few problems that need to be resolved before I can run use Ubuntu as my main TF2 playing OS. The temperature is a lot higher in Ubuntu. It skyrockets to 75 degrees and stays there. Also, my hard drive seems to be heating up unnaturally when I play TF2. I think this might have something to do with that message on partition manager about my sectors being misaligned. Maybe that is causing the hard disk to work too hard to transfer the same amount of data. I'm not really sure how exactly to solve that issue. But I think it should be fine after a few more driver updates from Nvidia. 

And I also got this adorable in game item!!


Friday, 18 January 2013

Does Good Content Pay for Itself?

I've recently begun to see a trend on reddit that in my opinion is weak evidence for the theory that piracy is a result of sub standard content. Good content really seems to pay for itself. On reddit there is a feature called reddit gold. If someone thinks a particular comment is really good they have the option of buying the commenter "reddit gold" which gives the user who receives gold access to a lot of beta features on reddit. The money goes towards maintaining and developing the website. Over the past few months I've seen a definite increase in the amount of reddit gold given away for really good comments. This ranges from excellent in depth explanations of difficult to understand concepts on /r/askscience to hilarious jokes on /r/AskReddit. This little comment I saw on AskReddit today was what inspired this blogpost.
The author of the comment with the gold star beside it was gifted reddit gold by some random dude on the internet.
And the truth is, it really was funny. I think that was the hardest I'd laughed in months! And someone thought it was literally worth money and gave the user reddit gold for content that was really free anyway.

But maybe I'm wrong. Maybe this actually indicates that the rate of piracy will stay the same but that more people will be willing to pay for the content. If more than one person gave that user reddit gold then there would be number beside the comment indicating the number of times he was awarded with gold. Thousands and thousands of people read AskReddit everyday (I think the actual number should be about half a million. /r/AskReddit has over two million subscribers. Half a millions feels like a good estimate of the active users.). So out of all these people only on person gifted this guy reddit gold. Of course, there are a lot of other factors at work including the fact that most people will see it as a waste to buy reddit gold to random dudes in a reddit thread. The whole point of supporting content generators by actually buying their content is so that they get an income and are able to generate more good content. In most reddit threads comments like these are a one off incident, a stroke of luck. The comments are usually not made by professional comedians. So it really doesn't make sense to fund the commenter. But the actual funds are not going to the commenter. The funds end up with reddit. So I guess reddit gold is way for users to help fund a website where they get so much information and entertainment. 

Now that I think about it reddit really has some awesome content ( if you look in the right subreddits). It's a really awesome place to hang out on the internet. And millions of people visit the site every day. And the voting system in place ensures that the best content generated on the site always floats to the top. So it really is providing many of its users with a service. Geniuses in their own fields generate good content by being awesome at what they do. Sites like reddit generate good content by collecting and concentrating all the best stuff generated (very often due to chance) by its users using the collective intelligence voting power of the site's millions of visitors. It's an arena where ideas and thoughts (a lot of them bad, some of them good) fight to the death and the best ideas rise to the top by a process of "natural selection". And the structure of the website enables this to happen. So in a way good content really is paying for itself on this site. The site provides a service which allows the collective intelligence of the website to generate amazing content and people voluntarily pay for it using reddit gold!
I wonder how much of reddit's income is generated by reddit gold ...

Tuesday, 15 January 2013

Sometimes the Graders Don't Notice the Seam.

And sometimes they get annoyed and cross the whole thing off.

From xkcd (Did I mention I was addicted?)
ALT TEXT: Handy exam trick: when you know the answer but not the correct derivation, derive blindly forward from the givens and backward from the answer, and join the chains once the equations start looking similar. Sometimes the graders don't notice the seam.