Warning: is_readable() [function.is-readable]: open_basedir restriction in effect. File(D:\InetPub\vhosts\iasync-5360.package\karthiknadig.com\wwwroot/wp-content/plugins/http://karthiknadig.com/wp-content/plugins/lightbox-plus/languages/lightboxplus-en_US.mo) is not within the allowed path(s): (D:/InetPub/vhosts/iasync-5360.package\;C:\Windows\Temp\) in D:\InetPub\vhosts\iasync-5360.package\karthiknadig.com\wwwroot\wp-includes\l10n.php on line 556
Normal | Normal is not Normal - Part 2
Feb 7 2010

Human Mind and Logical Fallacies

Karthik Nadig

1. Hyperbolic Discounting:

We are evolutionarily designed not to think of the future, hence our brain sucks at making evaluations when similar rewards are presented with a time difference. We tend to choose the one that arrives sooner than later. For instance, when offered the choice between $50 now and $100 a year from now, many people will choose the immediate $50. However, given the choice between $50 in five years or $100 in six years almost everyone will choose $100 in six years, even though that is the same choice seen at five years’ greater distance.
Ref: Hyperbolic Discounting

2. Understanding Sunk Cost:

Again another evolutionary feature that makes us believe that we need to make our invested resources count even after we know that it was a clear waste. For instance, let’s say you’re in the market for a replacement computer, and the best thing for what you want is a $500 PC. However, you’ve always been a Mac user and recently bought $600 on a wireless Apple keyboard. Now, even though you like everything better about the Dell (it comes with its own wireless keyboard), and it’s twice as cheap as the nearest Mac equivalent, your brain will tell you not to waste the money you spent on the keyboard. So, in the name of not letting the keyboard go to waste, you buy the Mac.
Ref: Sunk Cost
Example: source Cracked.com

3. The Disposition Effect:

In simple terms, instead of acknowledging losses in an investment, such as stocks which will never go up in value in reality, we instead wait for the value to go up. Although, the proper plan would be to sell and salvage, whatever possible, before the value drops further. This also includes storing stuff that you don’t need thinking that you’ll need it after you dispose it.
Ref: Disposition Effect

4. Irrational Escalation of Commitment:

This one stems from our ability to convince ourselves that we are right in our wrong decisions. This is seen in competitive scenarios, such as bidding, where one might end up paying more than the actual worth of an object quite simply to justify the competitive instinct.
Ref: Irrational Escalation of Commitment, Dollar Auction

5. Post-Purchase Rationalization:

Here we try to convince ourselves that the resource we just spent on nothing was actually worth it. This is not just money, can be anything, like time. This behavior of ours makes us believe that the procrastinated time was worth it. In terms of investment, you will keep investing in something just because you already invested in it. For instance, when faced with the prospect of a $3,000 repair on your car, or purchasing a slightly cheaper model car for $2,500, your brain will tell you to go with the repairs because you already sunk $10,000 on it. Your brain will have convinced itself that the last decision was a great idea. And since you’ve now sunk $13,000 into the car, it’s going to seem like an even better idea to keep piling up the bad decisions. On a similar note, be sure to read about the IPhone syndrome.
Ref: Post-Purchase Rationalization
Example: source Cracked.com

6. Money Illusion:

According to our brain $10 bill not equal in worth as ten $1 bills. Also, you are more likely to squander the money if you have ten $1 bills as compared to one $10 bill.
Ref: Money Illusion

7. Gambler’s Fallacy:

Our brain is terrible at probability, and the entire lottery business is based on this fact. For instance, if you flip a coin repeatedly and you get heads more than usual, then you are likely to think that you are going to get tails more often in the future or if you are not among the common then you may bet on heads. But, in reality, the odds of getting a head or tail is always same, for a fair coin.
Ref: Gambler’s Fallacy, Why Poor People Win The Lottery


Oct 18 2009

Silverlight Local Messaging

Karthik Nadig

I was trying to work with passing data between multiple Silverlight components and Windows.Messaging provides the support just to do this. It is as simple as creating instances of LocalMessagingSender and LocalMessagingReceiver and calling a function to send.

In the example below, the mouse position upon MouseMove is sent as a message. Note: I have used fixed global naming for the receiver so if you open multiple copies of this blog ( in other browsers or in the same browser ) you may get an exception, but you can open any number of sender pages.

This is the sender ( click here to open sender in a new page ):


This is the receiver :

Project files: LocalMessaging.zip


Oct 15 2009

NY Times Business Clock Chart in Silverlight

Karthik Nadig

New York Times create awesome visualizations. I was looking through some of their charts and this Business Cycle Clock ( see the 9th one ) caught my eye. I decided to try it using Silverlight. I have not incorporated all of the features, but this version shows some of the basic features of the chart. I’ll post the code after I recreate it wholly.



Oct 12 2009

Silverlight UI responsiveness

Karthik Nadig

This is a simple application demonstrating threading to manage application responsiveness. Here the background thread calculates prime numbers between 2 and a million and reports each new find to the UI thread. Click on start and the thread begins, click again to stop it.

The code is simple, go through it. Check the last line in this post for the link to the project files.

Visual Studio Project files : ThreadedApplication


Oct 12 2009

Silverlight XAML Animation

Karthik Nadig

I had written a simple wait indicator for a WPF application and was curious to see if it works on Silverlight. This sample is written purely in XAML, no additional code except of that which is created by default for a SL application by Visual Studio.


You can download the VS project here: WaitIndicator


Aug 17 2009

GPU Overdrive

Karthik Nadig

GPUs are designed for high performance graphics computing, but what if we could harness that for general purpose. CUDA is a supercomputing architecture developed by NVIDIA which enables that. Developers can write programs in C like format, OpenCL or DirectX Compute and the code will be compiled to work with GPUs which support CUDA. There is an entire website dedicated to this, GPGPU.org.

Lets see how it affects the way code is written. Consider Matrix Multiplication, on a normal CPU the complexity is O(N3). If you use Strassen Algorithm you can reduce it to O(Nlog27), but for now lets see the basic algorithm. On a GPU the process can be reduced to one loop. Here is how it’s done.

on a CPU
   1: // A(N:P), B(P:M) and C(N:M)

   2: for(int i=0;i<N;i++)

   3: for(int j=0;j<M;j++)

   4: for(int k=0;k<P;k++)

   5: C[i][j] += A[i][k] * B[k][j];

Of the three loops, the loop required in GPU version is the one on line 4.

on a GPU ( using C for CUDA )
   1: // A(N:P), B(P:M) and C(N:M)

   2: fnMultiply(A,B,C)

   3: {

   4: // index i,j is obtained from threadId

   5: for(int k=0;k<P;k++)

   6: C[i][j] += A[i][k] * B[k][j];

   7: }

   8: main()

   9: {

  10: // call by creating N*M threads

  11: fnMultiply<<<1,dim3(N,M)>>>(A,B,C);

  12: }

In the case of GPU there are NxM threads computing in parallel, assuming that the GPU hardware supports NxM threads. By using thread blocks and shared memory the overall performance can be further improved. In the example above one thread block of size NxM is assumed. See the samples in the CUDA SDK for a optimized version.


Jul 20 2009

Nano-scale Dyson Sphere

Karthik Nadig

I was watching Season 2 of The Big Bang Theory: The Hofstadter Isotope episode; Howard Wolowitz mentioned about the Drake Equation and it’s plausible application to predicting the possibility of getting laid, and then there was something about hitting it and quitting it.  So, I looked up Drake Equation on Wikipedia, and as usual one thing led to the other and finally reached the Dyson Sphere.

I am not going to explain what Dyson Sphere is, you probably would have already clicked the link, and now no longer coherent about where you were on this page. Most depictions of Dyson Sphere are of shell kind. This is the least plausible type, cause to construct a 3m thick sphere with inner radius of 1AU (or 149.60×109m) requires about 8.4×1023m3 of material. Our entire planet has just 1.09×1021m3 of material, so we’ll need 772 more earth sized planets to build such a structure. I have mentioned the parameters in volumes cause it’ll probably be difficult to find any matter in such enormous quantities within our solar system, unless we decide to use all the planets, asteroids or anything that moves around the sun as a source of material.

The original design was to encompass a star swarms of solar power satellites to capture most or all of its energy. Although fictional world says it’s possible to build a solid sphere, it’s highly unlikely. But it is possible to extract portion of the sun energy if we could build nano-scale satellites to absorb and store the sun’s energy in portable form. This is some what analogous to insect colonies amassing food in huge quantities.

Again this would be possible if the technology advances enough to protect any electronic instrument, in space,  from an astounding number of solar phenomenon which can put and end to the project even before it begins. At least the plausibility of this idea is higher than that of building a solid sphere.

If you actually learnt something from this; it was purely accidental. If you were really looking for schematics of such a project and google led you to this page; sorry, I had to write this blog other wise my head would explode.


Jul 17 2009

String to string AES

Karthik Nadig

I was bored so I made a string to string AES encryption program. Please don’t ask why?… http://www.karthiknadig.com/Content/Crypt/publish.htm.

In case some one wants to use it:

Step 1: before you can do anything you need a key.

To Encrypt:

Step 2: Select “Encode” option.

Step 3: Type in the “Decoded/ Normal Text” block.

 

To Decrypt:

Step 2: Select “Decode” option.

Step 3: Paste/ type the encoded content in the “Encoded Text” block.

Note: Remove any leading or trailing spaces. If the encoded content or key are wrong then you’ll see “Data is invalid” in the “Decoded/ Normal Text” block.


Jun 7 2009

Home

Karthik Nadig

Home is a documentary on Earth by Yann Arthus-Bertrand, a French photographer, journalist and environmentalist. The film is entirely composed of aerial view of the earth which portrays diversity of life and present state of the earth. The theme of the film is about the delicate balance which nature maintains and how our actions disrupted it.

The documentary shows harsh facts and awful truths about the impact of disruption of natural balance. The movie concludes with a positive tone, showing what is being done and can be done to reverse it.

Here, are some facts (not from the documentary):

  1. About 4000 chemicals are released into the atmosphere by smoking cigarette, 400 of which are toxic. To make 300 cigarettes, on an average, a tree gets wasted. In Britain about 34 million days worth of working hours were lost in 2007 due to leave; because of smoking related sickness. Primly smoking increases the risk of erectile dysfunction by about 50%. Those numbers will make sense when you’ll know that you breathe in about 15,000 liters of air in a day.
  2. Ever heard of Great pacific garbage patch, humanity has to be congratulated for this amazing feat. The estimated size of the affected area is about 700,000 km² to more than 15 million km², may contain over 100 million tons of debris.
  3. 80% of the urban waste in India ends up in the rivers, about 3 billion liters of waste per day. Only 55% of the 15 million Delhi residents are connected to the city’s sewage system, this is supposedly a good figure compared to the other cities.
  4. In some areas of India, the groundwater tables have dropped as much as 70 centimeters (about 25 inches). Up to 25% of India’s agriculture may be threatened by the depletion of groundwater resources. In the Czech Republic 70% of surface and ground waters are polluted, mostly with agricultural and industrial wastes.
  5. About 1/3 of the water each person uses on a daily basis is wasted. Each person in the UK uses 150 liters of water a day. Fixing a leaking tap can save as much as 5000 liters a year. During an average monsoon season in India, about 10000 liters of rain water can be harvested from a roof of 25 sq ft.
  6. Out of the top 10 most polluted cities in the world 4 of them belong to India (Delhi, Kolkata, Kanpur, Lucknow), Delhi being the second most polluted city in the world. 400,000 Chinese die prematurely each year from respiratory illnesses and other diseases related to air pollution.
  7. In US, 1.5 million barrels of crude oil (enough fuel to run 100,000 cars for a year) is used to produce 60 million bottles, all of which will end up in the landfill in a day.

Those numbers are staggering, so is the world population (about 7 billion). A few minor changes and using the resources frugally, or even trying to do that will significantly contribute to reduce the adverse effects of pollution and wastage.


May 7 2009

A sketch

Karthik Nadig

I sketched this portrait of a baby for a relative of mine.

baby1