Thursday, October 15, 2015

Some programming basics

As our programming knowledge grows, we sometimes forget that computers are not human. Although the incremental and consistent growth of AI techniques, mining may make us believe otherwise :) This is not a blog about AI or ML, but about some basics

From my understanding of real numbers, I can easily postulate that

0.1 + 0.1 = 0.2 -- (1)
and
0.1 + 0.1 + 0.1 = 0.3 -- (2)

But for a computer formula (2) can be hard to comprehend and as a computer programmer we forget that from time to time

I asked my python interpreter

>>> 0.1+0.1+0.1 == 0.3
False

and later asked what is 0.1+0.1+0.1

>>> 0.1+0.1+0.1
0.30000000000000004

Try this in your favorite language and see what you get -- the math underneath should be the same

Reference - https://docs.python.org/2/tutorial/floatingpoint.html

Sunday, September 27, 2015

Some more interesting combinatorics

I tried to solve the following problems from the book by Lovasz and got wrong - well atleast the basic thinking was right :)

Problem 1: We have $20$ different presents that we want to distribute to $12$ different children. It is not required that all children get something, it is possible that all presents are given to the same child. In how many ways can we distribute the presents?
Problem 2: We have $20$ kinds of presents with unlimited supply of each kind. We want to give this to $12$ children. It is not required that all children get something, it is possible that all presents are given to the same child. In how many ways can we distribute the presents?

What do you think the answers are?

Monday, January 12, 2015

Happy New Year 2015

A happy/prosperous/safe/healthy new year to one and all. 2014 has been great, but also unexpected. My home Linux box crashed and I was forced to move to my MAC-MINI for my day-to-day work. Hopefully this year, I'll buy a good machine and get back to Linux soon. Desktops are getting harder to find and maintain (in terms of space), but still the best option IMHO. The sound of the spinning hard drive, powering on the desktop after a long vacation is just too much of fun to miss. My last desktop was AMD based, I have to move to Intel, may be I'll wait a bit more. May be I'll get lucky and someone will send me new cool hardware for free to hack on :) Hint, Hint!

I did not mean to make this about my need for new compute. Here are my predictions for 2015/16 (yeah.. a bit more)


  1. Data center compute will get interesting with new processors and workloads
  2. OS Wars will light up again
  3. Children/Kids will get earlier access to computers and buy more hardware
  4. Internet and bandwidth consolidation will across several devices - phone/computer/TV
  5. People will start paying for cloud storage, storage is now a key bottleneck
  6. MAC OS will continue to gain desktop share
I am avoiding any security based predictions, you can guess why? I'll revise these soon, some time in Q2 this year



Ranking and Unranking permutations

I've been a big fan of Skiena's Algorithm Design Manual , I recently found my first edition of the book (although I own the third ed...