Calculate powerset of a set

This post is an attempt to understand how the execution for the calculation of a PowerSet is done for a given list of input. Note that I said calculation, since this is a set calculation technically. The idea comes from this link. The Haskell code tries to mirror the algorithm given in the Wiki.

The basic idea of the algorithm is this – take one element from the set and concatenate (perform union in Mathematical terms) this element with the powerset of the remaining elements. And to calculate the powerset of the remaining elements, continue the same process recursively. And the powerset of an empty list [] is a list with an empty element [[]], which is the terminating condition for the recursion. The Haskell code on the site is simple looking, but packs a good punch. map in Haskell is like map in any other language – it applies the function given to every element in the list. In the code below the (x:) means concatenate x in the beginning. And the ++ operator is to add an element to the end of a list

powerset :: [a] -> [[a]]
powerset [] = [[]]
powerset (x:xs) = powerset xs ++ map (x:) (powerset xs)

Let us walk through the execution of the recursive algorithm. For the sake of brevity, I am going to name the function ps

ps [1,2,3] = ps [2,3] ++ map (1:) (ps [2,3])
                     ^
                     |--- (1)
ps [2,3] = ps [3] ++ map (2:) (ps [3])
             ^
             |-- (2)
ps [3] = ps [] ++ map (3:) (ps [])
           ^
           |-- (3)
= [[]] ++ map (3:) (ps [])
                     ^
                     |--(4)
= [[]] ++ map (3:) ([[]])
            ^
            |--- (5)
= [[]] ++ [[3]]
= [[],[3]]
  --- so, the result of (2) is ps [3] = [[],[3]] -- (Result1)

Now we come back to the ps[2,3]. So,
ps [2,3] = [[],[3]] ++ map (2:) (ps [3])
=> ps [2,3] = [[],[3]] ++ map (2:) ([],[3]) -- from Result1
=> ps [2,3] = [[],[3]] ++ [[2],[2,3]]
=> ps [2,3] = [[],[3],[2],[2,3]] -- (Result2)

Now we come back to ps [1,2,3]
As noted above,
ps [1,2,3] = ps [2,3] ++ map (1:) (ps [2,3])
=> ps [1,2,3] = [[],[3],[2],[2,3]] ++ map (1:) (ps [2,3])
     -- from (Result2) we know ps[2,3]
=> ps[1,2,3]=[[],[3],[2],[2,3]] ++ map (1:) ([],[3],[2],[2,3])
=> ps[1,2,3]=[[],[3],[2],[2,3]] ++ [[1],[1,3],[1,2],[1,2,3]
=> ps[1,2,3]=[[],[3],[2],[2,3],[1],[1,3],[1,2],[1,2,3]]

I have reused the results mentioned in Result1 and Result2, but during execution, those results are re-computed ( I am not 100% sure on this, since there is a possibility of partial evaluation and storing the results of the partial evaluation in Haskell)

Posted in Programming - general | Comments Off

How to lie with Statistics – a good cheat-sheet to cheat with numbers

The moment someone mentions Statistics, the most often seen reaction is a big yawn or a sigh of disbelief. This is because mostly people would have heard this statistic in some ad / marketing journal or may be from a not so trusty source. And that reaction is justified 86% of the time ;) . This sense of disbelief / wonder (and it works both ways) mostly comes because the reader can’t vouch for the veracity of the numbers. The assumption always is that the person talking about the numbers (or the statistic, technically speaking) knows what (s)he is talking about. And even if that is not the case, it is very easy to be lost amongst the numbers – when there are averages, percentages, YoY (year-on-year) growth, percentage points, APRs and myriad other measures that are used to make the person talking about these (who more often than not is selling something) seem either very good or very bad. And looks like all these people seem to have the same field manual – How to lie with statistics. And this doesn’t seem to have changed from 1954, when the book was first published !

OK, before the book gets any more negative connotations – that is not the purpose of the book. The book is to help the reader see through these marketing ploys. To be able to ask the right questions and when to dismiss a statistic as faulty. It is a field manual to beat the cheaters in their own game. And this delightful book comes in a small package – just 150 pages, and is an easy read. The book has 10 chapters each with a specific theme

  1. The sample with a built-in bias : the origin of the statistics problems – the sample. Any statistic is based on some sample (because the whole population can’t be tested) and every sample has some sort of bias, even if the person wanting the statistic tries hard to not create any. The built-in bias comes from the respondents not replying honestly, the market researcher picking a sample that gives better numbers, personal biases based on the respondent’s perception of the market researcher, data not being available at a certain past time are a few of the biases that creep in when building a statistic. One of the example (from the 1950s) that the author mentions is a readership survey of two magazines. Respondents were asked which magazine they read the most – Harpers or True love story. Most respondents came back that they read the True Love Story, but that publisher’s figures came back that the True Love Story had a much higher circulation than Harpers – refuting the results from the sampling. The reason for this discrepancy – people were not willing to respond due to their own bias. As Dr.House says – Everybody Lies ! Summary of the chapter – given any statistic, question the sample that was taken. Assume that there is always a bias in the sample
  2. The well-chosen average: how not qualifying an average can change the meaning of the data. Before I delve into this, quickly, when I say, average – what comes to your mind? Sum(x1….xn) / N – right? The arithmetic mean. But I said average, not arithmetic average did I? Not many people know that there are 3 averages
    • Arithmetic average / mean – sum of quantities / number of quantities
    • Median – the middle point of the data which separates the data, the midpoint when data is sorted
    • Mode – the data point that occurs the most in a given set of data

    And when someone says average, leaving it unqualified, there is a lot of room for juggling. The author mentions a very simple example. If an organization publishes a statistic that the average pay of the employees is $1000, what does this mean? This makes most of us think that almost everyone makes around $2000 – the reader thinks it is the median. But, the corporation can be talking about an arithmetic mean, where the boss might be earning say $10,500 and the rest of the 19 employees earn $500 each – the arithmetic average. Just by not qualifying the average the published fact can be completely twisted out of form from the real facts.The way out – always ask what is the kind of the average that someone is talking about.

  3. The little figures that are not there: This chapter is about how the sample data is picked up in a way to prove the results – something we are all too aware in marketing campaigns. And picking the sample data right can mean picking a sample size that gives the kind of results we are looking for or a smaller number of trials. The author demonstrates this with a very important issue for parents – is my normal or not. The author talks about the ‘Gesell Norms’, where Dr.Arnold Gesell stated that most kids sit erect by the age of two. This immediately translates to a parent trying to think about his/her kid and deciding whether the kid is normal or not. What is missing in this case is, that, from the source of the information (the research) to the Sunday paper where a parent read this, the average has been changed from a range to an exact figure. If the writer of the Sunday magazine article mentioned to the reader that there is a range of age in which a child sits erect, the reader is assuaged and that is where the little figures disappear. The way out – ask if the information presented is a discrete quantity or if there is a range involved.
  4. Much ado about practically nothing: This little chapter is about errors in measurement. There are two measures for measuring error – Probable Error and Standard Error. The probable error measures the error in the measurement based on how much off is your measurement device. For example, if you were using a measuring scale that is 3 inches off a foot, then your measurement across trials is +/- 3. This kind of difference becomes important when there are business decisions taken based on a positive or negative result.
  5. The Gee-Whiz graph: This one is something that we see quite often. How to manipulate a graph so that it shows an inflated / deflated picture (based on what you are plotting on the graph). Some tricks include – miss out the measure of the axis, don’t label the axis leaving only numbers and hence letting the reader make his/her own assumptions.
  6. The one-dimensional picture: This one is an interesting trick. The trick here is use some sort of symbol – a money bag, a factory symbol things like that on the graph. So, when measuring the growth of, say the factory, increase the size of the factory image – and increase it across all the dimensions. An example – you try to display the difference in pay-scale. If it were a bar-chart, you’d have one bar with a measure of (say) 10 and another one of (say) 30. So the 1:3 ratio is clear when you see the bar chart. Now picture a money bag of similar proportions – one with a money bag of size 1 and the other one, a much larger one and immediately, the user perceives an increase of 1:9. Why? The money bag is grown 3 times across all the dimensions. Given that the reader is seeing this on a graph, the other dimensions are forgotten and the large money bag gives the impression that there is a much larger difference than 1:3 !
  7. The semi-attached figure: This one is a Sir Humphrey Appleby classic (the one used in A real partnership). And what is the idea – very simple. If you can’t prove what you want to prove, prove something else and demonstrate that they both are the same! Things like you can’t prove that your drug can cure cold, but you can prove that it kills 32,132 cold germs, more than any other drug. And then wait and watch for the consumer to make that assumption that there is a connection. The author talks about percentages in this chapter, where growth can be measured in percentages or percentage points. And when it comes to percentages – you have the classic trap. A growth of 10% means what? Measuring against the last year’s production or some arbitrary year that you decide to pickup? And if it was some other year in the past, how is the reader to make that mental leap to know if the 10% growth is actually in real terms – very difficult indeed. And then there is the percentage point – a drop of 3 percentage points gives a much softer blow than saying a loss of 23% (say a drop from 13% to 10% in real terms).
  8. The post hoc rides again: I guess this is my favorite chapter of the book. Post-hoc analysis. The cause and effect problem. You have the effect and then you go around shopping for a cause that you want to portray. And what is to stop someone to make that connection? The author brings up an example of smoking being related to bad grades. Now in this case, is it that smoking was the cause of the bad grades or was it that the individuals who were getting bad grades decided to take up smoking? How is one to contest such an assumption? The way out – mostly is to ask for when the data was collected and if enough data was available during the entire course of the experiment (there is also the possibility of deducing based on the time when there was no data available – how do you contest something when there is no data available at all !).
  9. How to statisticulate: In a term that the author coins, statisticulate is to manipulate readers by using statistics. This chapter is a cheat sheet to what to watch out for. The author lists various tricks – things like measuring profit on cost price, showing a graph with a finer Y-axis scale just to show how steep growth is, how income calculations mislead by involving children in the family as individuals for the average amongst a few.
  10. How to talk back to a statistic: This one is a cheat-sheet for the reader. What should one ask to find out if the statistic being presented is genuine or not. There are a few questions one can ask
  • Who says so – who is the one who is publishing the result? Do they have anything to gain from the result
  • How does he know – how did they measure this result? Was there any sampling bias?
  • Did someone change the subject – Are the cause and effect getting muddled?
  • Does it make sense – ’nuff said :)

And that summarizes the book. This book is a must-read if you are interested in numbers and their interpretations. And, the tricks mentioned in this old book are in use even now. So, the date of publishing and the relevance have a negative correlation ;) . Definitely recommended read. An 8/10 – looses out because some of the topics were not given a thorough treatment.

Posted in Books | Comments Off

The Silent World – an ok read

This book – The Silent World by Capt. Jacque Cousteau sort of reached me out of chance. And when I checked the title, I saw that this was a National Geographic Adventure classic – not the sort of a book I would have picked up myself (or would have known about). And this is probably one of the few books I didn’t check any reviews before I started reading it – and I am not disappointed at all. For someone who didn’t know anything about scuba diving (other than seeing it on TV), this book has been sort of a revelation. This book is not about the science behind scuba diving, though one does pick a few facts here and there. What this book is about the journey of Captain Jacques Yves Cousteau as he discovered scuba diving. Well, not really scuba diving but the aqua-lung. Another thing which I learnt after I finished reading the book was that it was published first in 1953; which makes sense when I think about it now – the final chapter sort of felt a bit abrupt.

So, what is this book about? The book describes the captain’s experiences as he discovers the undersea world – the world that we now conveniently get to see on TV. He describes the underwater life and the richness of the experience one feels during scuba diving. There are also details about some of his expeditions for treasure hunts and shark trips. The treasure hunts, contrary to my expectations were not very interesting reads. The shark close-ups chapter was much better. The best part of the book for me was the description of the details that the captain goes to for undersea cave diving. I couldn’t always visualize some of the problems regarding the challenges faced by scuba divers that the captain describes and that is why this book falls short of my expectations. As a pioneer in the field, I expected the captain’s narrative to be a lot more exciting and vivid. May be the adrenaline rush that I was looking for was lost in translation.

The best part of the book as I mentioned was the description of the undersea life during the captain’s cave diving expeditions off the Mediterranean. That did make me realize the joy one would have experienced seeing underwater life with such clarity for the first time. At-least to be part of the experience one should pick up this book. A 6/10.

Posted in Books | Comments Off

Linked – an average read

With a title like linked one is definitely intrigued about the content. This book is interesting and uninteresting in equal proportions. What is interesting is that the author manages to make the reader look at various phenomenon under the network theory glass. What is uninteresting is that the treatment of various areas is shallow. First of all what is this book about – the book is about trying to understand how many facets of the world around us are linked to each other. Now, this doesn’t seem to be a great revelation; everyone knows that. What the author gets into details about is how scale free networks are able to describe everything from the structure of a cell to the structure of the social networks. According to the author, any phenomenon which is linked to anything else in nature eventually follows some sort of a power law.

Before I go further, there are two things one needs to understand

  • Power laws
  • Scale free networks

Power law:Before understanding power laws, one needs to know what random networks are. A random network is one in which there is an equal probability for any two nodes to be connected (probability speak: equally likely events). So, there is no preference for connecting any two nodes. So, if random networks were around us, then the probability of me knowing the author of the book is the same as me knowing someone I studied with. When this network is plotted on a graph, then it follows the very familiar bell curve. The main characteristic of the bell curve is that the tail of the bell curve decays very fast i.e. the number of data points in that tail will be very less and they keep reducing. And that is what is different between a random network and a network following a power law. The main characteristic of a network following a power law is that

  1. There is no peak for the plotted graph
  2. The decay of the tail of the network is much more pronounced i.e. there is a very long tail
  3. If the network were to be scaled (say increasing the number of connections by some constant factor), then the new network will grow only by the constant factor (a linear increase in computational complexity terms). This is unlike, say an exponential growth – growth of the network where the growth is a function of an exponent of the constant factor (think of the old tale of the man asking the king to fill a chess board with grains which grow as a power of 2).

The power law is also called the long tail, 80-20 rule,small world network or the pareto distribution. Essentially, there is a large number of phenomenon which are common and there are a few phenomenon which are rare and occur amongst these.

Scale free network: A scale free network is one whose nodes follow a power law i.e. the the number of nodes that are connected in the network are proportional to the power of the number of nodes itself. More here (pdf link) and here
Here is a simple example to understand random and scale-free networks (from the book)

  • Random network: The network of the inter-state highways in the US. Every major city in the US is connected by almost the same number of highways. So, all the cities fall within the central part of the bell curve. And there are few cities which have a lot of highways connecting them or very few – the tails of the bell curve.
  • Scale free network: The network of the flights and airports in the US. In the case of flights though, not all the airports are equal. There are some hubs in the air network which have large number of flights in and out and there are small satellite airports all across the country. For example, Atlanta is a big hub in the south and there are smaller airports around Atlanta which have much lesser flight traffic

That is it – the above is the central idea of the book. Once you get that, the rest of the book gets into the uninteresting bit ! Well, not that uninteresting though. The author goes on to describe how power-laws and scale free networks are all around us. From our social network (more on this further) to the structure of the cell; from the network economy to the links on the WWW. And what the author also explains is how these large ‘hubs’ also are the failure points of the network. Bring down the hubs and the whole network collapses. He explains this with the examples of the blackouts that happened in 1996 in the US. The same hubs occur everywhere – from the hubs connecting the Internet to the hubs in our social network – there always is that one person who stays in touch with everyone in the class. Remove that person from the network and the class-mates lose touch with each other (am not sure how much this is true in the new world of social networking sites). The author goes on to explain the various properties of this scale free network in simple language, but doesn’t go in depth into any of the topic. For example, when explaining of the resilience to failure of a scale free network, the author just mentions – so this network is going to be stable even if majority of the nodes go down, the network goes on because that essentially is the feature of a scale-free network. But he doesn’t touch upon the fact that the remaining nodes now will get overloaded and will collapse under their own weight. A bit more explanation, even if that were mathematical would have been welcome in the book and that is the downside of the book.

When I mentioned the social network above, it was interesting to me because when the book came out in 2003, there might not have been many ways to map the human network. So, the author whimsically wishes, if we were to know the human network, it can pop up a lot of interesting features. And that is almost possible now. With the influx of the social networking sites, it is possible to find out if indeed there are six degrees of separation between people. And that has implications in the online world. Know the hubs in every small network and you have the ability to market / interest a large set of the nodes connected in your idea. Get the nodes to write something nice about you and the ‘word-of-mouth’ marketing will remove the need for a large marketing budget.

As mentioned on some of the low reviews on Amazon the book falls short of taking any idea further than a shallow treatment. But that doesn’t make it a bad read, just an average read. I think the author stretched the ideas a bit too thin. I’d rate it a 6/10 – just because the author does give good examples for one to get the ideas behind his premise.

Posted in Books | Comments Off

Caesar cipher in one line

Can we create an encrypt and decrypt using Caesar cipher in one line? I’m sure you can. Here is one way to do it in Python. This assumes the text is typed in English (or where the lower() function on a string can work).
Encrypt
import sys;print ''.join([chr(x) for x in [x if x else x+ord('a') for x in [ (ord(x.lower())+1)%(ord('z')+1) for x in sys.argv[1]]]])
Decrypt
'import sys;print '.join([chr(x) for x in [x if (x%(ord('a')-1)) else ord('z') for x in [ (ord(x)-1) for x in sys.argv[1]]]])
So, now you can send your next missive in shift+1 cipher ! Of course, you are not going to send trade secrets that way, would you? :)

Posted in Fun, Programming - general, Python | Comments Off

Install Python-MySql on Windows 7 64-bit

I’ve been wanting to try my hand at SQLAlchemy for a while now. No particular reason other than checking how the APIs for the ORM are. To decide on the database to use, I thought MySQL might be a good idea because most of the OSS libraries support MySQL. But the catch was that I wanted to do all this on Windows 7 and that too a 64-bit Windows 7. So, this was a bit tricky. I couldn’t do something like easy_install MySQL-Python on Windows. So, here is a step-by step guide to install MySQL 64-bit, Python-MySQL on Windows 7. The steps might work with Windows Vista too.

Pre-requisites

  1. Python 2.7 – might not work with Python 3
  2. Visual Studio 2008. The Visual Studio express edition will also work. Essentially, a C++ compiler is required
  3. Access to modify the registry
  4. MySQL DB 5.5 on Windows

Installing Python-MySQL

  1. Download the combined installer of the MySQLDB on Windows from MySQL. The current version is 5.5
  2. Download the Python-MySQLDB library here – Python-MySQLDB. The current version is – MySQL-python-1.2.3
  3. You need to have the Microsoft Visual Studio installed on your machine. I had Visual Studio 2008 installed, but this can work with the Microsoft Visual Studio Express edition too
  4. Install the MySQLDB – select the ‘developer’ configuration during install. This will install the required libraries and the header files for the C connector- these are important. Note the directory that you are installing the MySQL
  5. This will install MySQL 64-bit on the machine. I am running Windows 7 64-bit and hence I installed the 64-bit version of MySQL
  6. Extract the MySQL-python-1.2.3 into a directory
  7. Open the site.cfg and make the following modification
    -registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0
    +registry_key = SOFTWARE\Wow6432Node\MySQL AB\MySQL Server 5.5

    Based on the version of the MySQL server, change the 5.5 to whatever is the version you installed. On Windows 7 (and I think on Vista too) 64-bit, the registry key is changed to this location during installation. This took me a long time to find. This has been documented here too – MySQL-Python forum (check for the comment no. 13)
  8. Then modify the setup_windows.py by adding the lib_dirs and include_dirs. Here we add the directories for the C connector that was installed as part of the installation of MySQL. I could not locate the registry key for the connector, so I added the directories for the headers and the libraries to the compiler parameters. Note that I added the opt-imized library directory. If you are debugging the MySQL connector, you will want to include the debug version of the libraries
    library_dirs = [ os.path.join(mysql_root, r'lib\opt'), "C:\Program Files\MySQL\Connector C 6.0.2\lib\opt" ]
    include_dirs = [ os.path.join(mysql_root, r'include'), "C:\Program Files\MySQL\Connector C 6.0.2\include" ]
  9. One final step and you are ready to go. As documented – here, you need to modify the msvc9compiler.py. Look for the line containing
    ld_args.append('/MANIFESTFILE:' + temp_manifest) and add a new line – ld_args.append('/MANIFEST')
  10. Now install the python library using – python setup.py install in the MySQL-python-1.2.3
  11. This will use the Visual Studio compiler and the file mentioned in the include_dirs, library_dirs to build the .egg file for the MySQL-Python libraries
  12. Some more help here
  13. Also can check this on SO though for the 64-bit windows, I found that this solution did not work
Posted in Open Source, Programming - general, Python | 1 Comment

Social Entrepreneurship – a good (but not great) book to read

My introduction to David Bornstein’s writing was How to change the world. And I think that it is an excellent book and I will recommend reading it. So, when I found out (well Amazon told me !) that he was collaborating with Susan Davis (of Grameen foundation) to write a book on Social Entrepreneurship, I said, sign me up for it. What caught my eye was not the title of the book but the subtitle of it – What everyone needs to know (about social entrepreneurship). The table of contents was also impressive

  1. Defining social entrepreneurship
  2. Challenges of causing change
  3. Envisioning an innovating society

The table of contents didn’t talk about anything specific and I thought may be the contents would be a bit more specific. But, I was a tad disappointed that the book is not as specific as I would have liked it to be.

Let’s look at each section. The first section is the definition of social entrepreneurship. This section gives enough background about social entrepreneurship. For those who don’t have an active interest in this field, I think this section does an excellent job about giving enough background regarding the field. This section is sort of a primer for soc-entrepreneurs, defining the typical characteristics of a social entrepreneur, when the field as a separate entity got recognized and which are the important organizations currently in operation. This section is definitely recommended for anyone who wants to know how social entrepreneurship differs from (say) activism. And there is a section which deals with that too. The definition clearly gives a perspective on social entrepreneurship. Quoting the book

Activism can be thought of as a subset of social entrepreneurship, one of the many tactics employed to advance change. The simplest distinction is that, activists generally seek to elicit change by influencing decision making of large institutions or by changing public attitudes, while social entrepreneurs pursue a wider range of options, including building institutions that directly implement solutions themselves.

This provides the clear distinction between an activist protesting about something and a social entrepreneur tackling the same problem (say for example, the childline in India) by starting an organization. Another important sub-section in this section is the What does a social entrepreneur do?. This section defines the role of a social entrepreneur. From the book -

The system changer must therefore overcome apathy, habit, incomprehension, and disbelief while facing heated resistance from those with vested interests. Social entpreneurs have to figure out how to make it happen.

I think, that sort of defines the role of a social entrepreneur.

The second section is about the challenges of causing change. Very few people like change, even though change might be constant. It is the struggle to get acceptance for the change which is the first hurdle for any social entrepreneur. And the next challenge is the finance. Or may be it is the other way round ! Finance of the operation is a major struggle for any entrepreneur, even more so for a social entrepreneur. Unlike an entrepreneur, there might not be financial returns for a social entrepreneur; and even if there were; they might be either meagre or insufficient, happening in a sporadic fashion. Given the uncertainty of the returns, the first concern for any social entrepreneur is to raise the finances for the cause for his/her own sustenance and eventually the organization’s growth. In this section, the authors explain the various ways social organizations have raised capital. Organizations like The Skoll foundation, Ashoka, Civic ventures, New profit inc, micro-entrepreneur connectors like Kiva, RangDe (the authors don’t write about RangDe), KYC4 are the typical sources of funding.One important thing to note though – all of these organizations are willing to fund entrepreneurs who are willing to execute on a plan. It is very important to understand that a social entrepreneur should have some sort of an operation going before (s)he can garner more founds from these organizations. Merely having an idea and looking for funds generally doesn’t help. Another challenge for any social entrepreneur is attracting talent and scaling the organization. This is going to be always a challenge. That is why you will never see a very large social organization. Even if they are, they typically would be backed by some public body ensuring a constant fund-stream. So, it is important for social entrepreneurs to understand these challenges. In this section, the authors explain some of the challenges, though, they do admit that attracting good talent is going to be a challenge. It is about the person appealing to a different aspect of the prospective employee to interest him/her to join the organization. Of course, the cause alone won’t be able to attract talent and enough financial incentive should be available for anyone to join an organization.

An interesting sub-section in this one is – What is the difference between scale and impact. In this section, the authors write about how a larger impact can be made by organizations which already have the scale. It is like how Thomas Friedman explains in this interview about changing leaders instead of bulbs. Unless there is no scale, all we will have is a hobby. Though, that seems a bit far too hard on people dealing with micro-changes, it is something that should be at the back of everyone’s mind. However much impact is important, scale is equally important too. So, it is not about starting an idea alone, it is also about scaling that idea that a social entrepreneur (a successful one i.e.) thinks about.

The final section is very generic. It talks about how to inculcate the qualities of innovation in a society. Most of it is applicable for for-profit enterprises too. So, I won’t delve too much into it. There is though, one part of this where the authors talk about how philanthropy can be more effective. This is an important aspect of any social organization and for the funding organizations. In this, the authors suggest a few things to philanthropists about how to engage with social entrepreneurs. Things like

  • Help social entrepreneurs engage more with businesses and governments
  • Fund structural supports for social entrepreneurs
  • Stick with things that work and communicate early (I think this is contrary to the next one)
  • let organizations die (an implication of this is that people should be willing to try things that might not work too)
  • Help social entrepreneurs work together

The final section is very interesting, wherein the authors talk about how individuals can prepare themselves to be part of a the field of social entrepreneurship. This is sort of a high level design document about what one can do before becoming a social entrepreneur full time. The authors don’t get very specific, they talk very generally about what are things that one can do. It would have been nicer if they could have gotten a bit specific and illustrate with some examples of existing social organizations.

So, what do I think about this book. I think this book is a good one. I expected specific examples like the previous work of one of the authors. But this book is not about specifics. And the flow is not always kept going. The narrative can drift away sometimes. I read this book twice to get the gist of it (it is not a very large book). Maybe because I was aware of most of the things that the authors were talking about, I didn’t find it very interesting. Maybe for someone who is a beginner in the field, it might be very helpful. I will still suggest this book – whether you are a pro or a beginner in the field. A 6 out of 10.

Posted in Books | Comments Off

Democratization of book reading

Democratzation of the Internet. How many times have we heard of this expression. Quite a few times I would think. For example, Google helps small business get the visibility that they would not have otherwise got. And that is a very powerful idea. In a swoop, the Internet (OK, technically not the Inter-webs but the various sites like Google, Lulu, eBay, Amazon, Yahoo and the rest) has created a level playing field. And these are large businesses that don’t even have a brick and mortar presence. Wait, you are reading this, wondering what it is that I am talking about. This is what the 90s was about. This was what computer magazines and business magazines were hailing when I was in college (yes, that was long ago !). But one area where there was no level playing field was books. And when I said level playing field, I don’t mean for the publishers or the authors or for the enablers like Amazon, but for people like me – the readers. And how is it the case you wonder ! And I shall explain.

The lack of level playing field is the access to books. In India, there was a very limited selection of books that I could get my hands on. In Bangalore, the sources of books were

  • Blossoms
  • Gangarams
  • Bookworm
  • Crossword

And the last one was more mirrors and mainstream books than anything else. I have nothing against Crossword, but somehow, I feel that their idea of having a coffee shop and a book store beside each other, like one can do in Borders in the US didn’t take off. And after a while, they did not, (for a good reason) allow readers to take books to the coffee shop. And in Madras, Landmark and the Moore market were my favorite joints (like any other book-lover from Madras can vouch for). And to digress a bit, the Landmark in Bangalore feels like a supermarket instead of a book-store. Atleast the one in Madras feels more like a book-store. And in Hyderabad, well, it was the Sunday street-side vendors in Abids. I have been told that the bookstores in Kothi alongside the women’s college have made way to development activities. Of course, I always felt that Hyderabad was the laggard when it comes to books; and no, Walden really is not a redeeming feature.

Given the above, one would think that there would be a large selection of books that would have been available. And that, my dear reader is where the story takes a turn. Even though the above had a selection of books, the buyer of the books did not have a choice. You had to look for a book and be happy with whatever you find (and sometimes you do find great books too, like hardbound versions from the 60s !). If you were looking for a rare book or for a esoteric new book, most likely you would be out of luck. One would have no choice but to look for the book on some site like Amazon / B&N / sometimes on eBay. The cost of the book (taking into consideration the exchange rate and the foreign transaction fees) would most often be shadowed by the cost of the shipping of the book. And when you are buying a book which converts to close to INR 1500, every penny for the shipping does make a difference. With me so far?

So what is the democratization? It is the e-book reader ! It might be the Kindle (which by the way is definitely worth the buy – more on that later), the nook, the Sony reader or any other reader. These e-readers, with an upfront cost, have removed the shipping costs out of the equation. And, that creates a market for the vendor (like Amazon), for the publisher (NoStarch for e.g.,) and savings for the reader. And this makes books available within the reach of most of the book lovers. Of course, as someone who loves paper books, I know that the e-book readers will never replace the joy of having a paper book and the memories that the book holds (like what Partridge says). But, what the e-book reader creates is the ability for readers to read books that they would not treasure the way they would treasure paper books. And an e-book reader is useful in another case – technical books. Off late I have not seen a technical book which can’t be used on a weighing scale. In such a situation, the e-readers help lighten the load – both monetarily and the weight-wise.
Given the above, what about the price point of the existing e-book readers? Do you think that the costs of those are manageable? For example, the nook sold for $99 recently and the basic kindle sells for $139. Is that too much of a price to pay for reading books? Can an reader with support for e-ink be created within a price point of <$100 ? If such a reader were possible, the list of features I would like to see on it

  • Support for e-ink. B&W is good enough. Don’t need a colour one
  • Support for epub, with mobi as an extended support
  • Better rendering of PDF documents – generally PDFs are not displayed as well as the native formats. Though this is not a strict requirement
  • Connects via USB
  • wi-fi would be a good to have and a basic browser would be enough
  • I am not sure about DRM for the books though. DRM is important for the vendor. I don’t know enough of the existing formats to know how their support for DRM is. At some point, DRM will become important for any e-book reader. So, I toss in DRM too.

Are there any other features that you think are a requirement for an e-reader?

Posted in Business, Thoughts | Comments Off

Superfreakonomics – soooper ?

OK, so the title is cheesy and that is intentional. At-least caught your eye didn’t it. So, what is it about? The rogue economists with a penchant for the uncanny, for making connections that will make afternoon soap opera fan’s head swirl, come up with conclusions which will make policy papers look like class doodles and give enough food for thought to feed a room full of intellectual types for a while, are back!

And if you still did not understand what I am talking about, it is the next version of Freakonomics, Superfreakonomics. And with a subtext which says why suicide bombers should buy life insurance, I am sure this book is going to pique anyone’s interest. So, does this book live up to the sequel hype?

I think the book is a very interesting read, but, it is not as good as the original. There are flashes of amazing insight in some chapters, but overall, the book didn’t feel like it is better than the version 1. There are 5 chapters

  1. How is a street prostitute like a department store Santa
  2. Why should suicide bombers buy life insurance
  3. Unbelievable stories about apathy and altruism
  4. The fix is in – and it is cheap and simple
  5. What do Al Gore and Mount Pinatubo have in common

I thought the chapters 3 and 5 did not have as much to offer as the rest (no pun intended). The first chapter, manages to deal with an important issue rather candidly, in the true freakonomist style. It is definitely worth reading the economic analysis of the operations of street prostitutes and their strategies. So, the start of the book is in true freaky style.

Chapter 2 is about suicide bombers and insurance, and this is more of the narrative of an investigation rather than the conclusions. They do mention the conclusion, but this chapter feels more like an episode of Numb3rs. It does manage to hold your interest. I did not understand the raison d’être of the third chapter. It seems like a failed attempt to deal with behavioral economics and trying to come up with conclusions. Chapter 4 is interesting again, where the authors try to make the case for simple solutions for profound problems. Chapter 5, I thought was pointless. It seemed more like a canvassing article for geo-engineering more than the economic analysis for it. May be the authors’ intent was not that, but I felt the chapter felt like it at the end

So, would I suggest this book. Hmm, yes and no. It is interesting in places but not as much as the first version. A 6 out of 10.

Posted in Books | Comments Off

Prime Obsession – definite read

OK first the review – go read the book – Prime Obsessionby John Derbyshire. ’nuff said. That is all, there is nothing else to say about this book – if you want to know more about the Riemann Hypothesis, this is the book to read. And if you want to know what is the Riemann Hypotheis too, this is the book to read. And knowing both is equally important, if you are fascinated by prime numbers (and numbers in general too). There might be others (and I haven’t read them yet !) but this book, is a definite read. If there is any complaint I have about this book, it is that sometimes the author does the wave of hands to say trust me this is the case, which I guess you need to, because one can’t explain all the proofs in mathematics. And trying to explain the zeta function, well, that is a different challenge altogether.

You need to read this book for three reasons

  1. To know the background for one of the Millenium problems (and one of the problems in Hilbert’s 23 problems [it is the number 8])
  2. To know what are the approaches mathematicians are taking to tackle the problem (quantum physics anyone?)
  3. And more importantly, to try and understand Riemann’s hypothesis itself, and how does knowing whether the non-trivial zeroes of the zeta function having a real part of 1/2 help in determining the distribution of the prime numbers

The book is divided into two sections. Section 1 deals with The Prime Number Theorem (PNT) and the second section deals with Riemann Hypothesis. Apart from these two sections, the author categorizes the even numbered chapters on the history of the development leading to the hypotheis (and to the future too) and the odd chapters are mathematical expositions.

The Prime Number Theorem

A relatively less known fact is that there is already an equation which tells us the number of primes that are available less than a given N. The equation says, very simply π (x) ~ N / log N (the π is the prime counting function, which is used to define the number of primes less than a given N. And this was determined in the 18th century by Gauss (and others). An implication of the PNT is that the probability of a number N to be prime is ~ 1/log(N) and that the Nth prime number is NlogN (all logarithms to the base e). So, if this was known so long ago, then what is the big fuss about the hypothesis ? Hmm, well the problem is the little squiggly and that is what (in a round about way) is what Riemann was hypothesizing about.
I won’t go into the details of how the PNT and the Riemann Hypothesis are related, but in this section, I saw the most beautiful mathematical equation that I encountered till now. Euler’s identity might be considered the most beautiful mathematical proof by most of the people, but for me this equation and its proof gave enough evidence to what beauty in Mathematics is all about. This proof, what the author calls The Golden Key is the Euler product formula. The proof in the book is around 2 pages and when I reached the final sentence, I was, for the lack of a better word, overwhelmed ! And look at that equation, it is so simple Σ n -s = Π(1-p-s)-1. This basically says, the sum of the numbers till n is equal to the product of primes. Sum of numbers equals the product of primes (yes I am paraphrasing it for effect!). But think about it, it is just awesome ! And this is also important because, the LHS is actually the Zeta function and the RHS is the product of primes.
The author goes further to explain how the PNT is improved further (enter calculus, err you thought this was about numbers, and so did I) where, π(x) ~ Li(x) where Li is the log integral function. There are lots of these proofs that the author describes, all leading up to the crescendo, which he calls the Turning the Golden Key, which is the chapter 19.

Riemann Hypothesis

In the second section, the author tries to explain the hypothesis and the higher math behind it. I must there were parts in this section which were OHT for me :( . For example, in the chapter 13, the author tries to explain the complex plane and how the function’s graph looks (knowing how a function’s graph looks definitely provides a lot of insight into how the function behaves), but I couldn’t really grasp it very well. And further in the chapter 20, he talks about Reimann operators and other approaches, which was too complex for my rather limited mathematical knowledge (no pun intended). For me, the section 2 is something that I will have to re-read till I get my head around it. For people who have a better grounding in mathematics than I do, I guess it will be easier

For me the section 1 is the favorite. The mathematics in that section is very accessible, understandable and the author does a splendid job in explaining the required mathematics. I might have read a section once or twice to understand the implications, but for most part – it was easy to follow.

And the other part of the book – the history of the developments. This is, lets just say, fabulous ! I could just read the historical chapters alone (yeah, yeah, because I don’t understand the Math so much, ok, go away !) to realize the amount of hard work involved in solving this equation. Every mathematician I knew of (and most that I didn’t know of) figured in the search for the proof of this problem. And yes, this is a problem though so simple sounding, is so complex. So, what was the problem statement anyway, you ask. Oh well, let’s see, do the prime numbers have a pattern ? Can you find out what is the next prime ? While you try to figure that out, pick up this book and read it, you will not regret it. A perfect 10 for this book. I am going to treasure this book and read it more than once. And looks like there are other books available on the Zeta function.

Posted in Books | Comments Off