Here’s a text from the book intution pumps by Daniel Dennett

You can shingle a roof, paint a house, or fix a chimney with the help of just a ladder, moving it and climbing, moving it and climbing, getting access to only a small part of the job at a time, but it’s often a lot easier in the end to take the time at the beginning to erect some sturdy staging that will allow you to move swiftly and safely around the whole project

from: “Intuition Pumps And Other Tools for Thinking” by Daniel C. Dennett

An apt word for the building blocks work I am currently involved with. 

Living With The Black Swan


From about 2000 years, in many European languages, a black swan was a metaphor for something that was clearly impossible. And then black swans were found in Australia. So a black swan became a metaphor for a completely unexpected event actually occurs, one we had not imagined was impossible. Black swans appear regularly – Skype, iPhone, the Cloud…. If a black swan landed in your marketplace, would you recognize it? Most companies don’t. It’s no coincidence that the average age of companies – big companies – is falling fast, at the same time that black swan events are increasing.

You never see black swans coming – you have to be ready to respond when they arrive. 

This talk is about the kind of thinking and organizational structure that can help you live successfully with the black swans. It is about how to build an innovative, responsive, enduring organization

Goes well with this post on antifragile.

Pdf With Matplotlib

I thought everyone knew about but i was surprised this this little feature of matplotlib is not that known as widely as I assumed.

We all know we can save a plot from matplotlib to pdf but there other little feature hiding in the backends where we can write out a multiple page pdf

Here’s a simple code to write out multiple page pdf using matplotlib.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages





So easy. Instantiate pdfpages, Open the pdf file, save figures. Works from version 0.99 of matplotlib.
With little use of plt.text, plt.annotate, can be used to produce quick pdf reports. In fact,I have pandas and matplotlib workflow to pump out full blown management report on continuous improvement initiative.
Here’s a simple full example of creating a simple pdf report using the above feature

Continue reading

Reading list and Lollapalooza effect

Never thought giving up motorbike ride will be so fruitful. Recent location change has put plenty of alone walking time to my office and this had an unexpected effect on my book reading.Here’s the list of the books that I have read since my last post on books. 

  1. Purple cow by Seth Godin
  2. Being Mortal Atul Gwande
  3. Seeking wisdom from Darwin to Charlie Munger by Peter
  4. The Warren Buffet Portfolio by Robert G
  5. The Myth of innovation by Scott Berken 
  6. Permission marketing by Seth Godin
  7. The little book of big dividend investing by 
  8. The road less travel by
  9. The Wright Brothers By David McCullough
  10. How to drive a tank and other everyday tips for the modern gentleman – Frank Coles
  11. The Wandering Mind by Michael C Cornallis
  12. Rise of robots: technology and the threat of a jobless future by Martin Ford
  13. All marketers are liars by Seth Godin
  14. Irrationally yours: on missing stocks, pickup lines and other existential puzzles by Dan Ariely
  15. The road to character by David Brooks
  16. Surely you are joking Mr. Feynman by Ralph Leighton
  17. The selfish gene by Richard Dawkins 
  18. Misbehaving: the making of behavioral economics by Richard H Thaler

Am surprised at the length of the list. I guess this is what Charlie Munger calls a lollapalooza effect. Combination of factors leading to an outstanding results. No bike, long walks to office and plenty of alone time.  

My top three books of the lot are

  1. Seeking wisdom
  2. Rise of robots
  3. Surely you are joking Mr. Feynman

Which one have you read?

Exploring MFEM

mfem c++ fem library

With little time I have after office and playing with kids , I am devoting some to this MFEM library.

Really good piece of software. Exploration continues.

So What is MFEM?

No, it’s not Ministry of Finance and Economics Management, it’s …….

MFEM is a lightweight, general, scalable C++ library for finite element methods and available at

The goal of MFEM is to enable research and development of scalable
finite element discretization and solver algorithms through general
finite element abstractions, accurate and flexible visualization, and
tight integration with the hypre linear solvers library. Its features
– 2D and 3D, arbitrary high-order H1, H(curl), H(div), L2 and NURBS
– Parallel version scalable to hundreds of thousands of MPI cores.
– Conforming or nonconforming adaptive mesh refinement (AMR),
including anisotropic refinement.
– Galerkin, mixed, isogeometric, DG and DPG discretizations.
– Support for triangular, quadrilateral, tetrahedral and hexahedral
elements with curved boundaries.
– Lightweight interactive OpenGL visualization with GLVis,

An interactive documentation of MFEM’s serial and parallel example
codes can be found here
MFEM is freely available under LGPL 2.1.


How a driverless car sees the road- See Machine Learning in Action

Haven’t seen anything so exciting for a long time. Exceptional progress in technology. Reminded me of the following quote by Eric Schmidt

Google’s self-driving cars and robots get a lot of press, but the company’s real future is in machine learning, the technology that enables computers to get smarter and more personal. – Eric Schmidt (Google Chairman)

Grab a cup of coffee and see the future!!!

Biplot with Python

biplot in python

I have plotted Biplot in Matlab and have created it using fortran in the past. Last month, while playing with PCA, needed to plot biplots in python. Unlike MATLAB, there is no straight forward implementation of biplot in python, so wrote a simple python function to plot it given score and coefficients from a principal component analysis.

Here’s the function.

def biplot(score,coeff,pcax,pcay,labels=None):
    xs = score[:,pca1]
    ys = score[:,pca2]
    scalex = 1.0/(xs.max()- xs.min())
    scaley = 1.0/(ys.max()- ys.min())
    for i in range(n):
        plt.arrow(0, 0, coeff[i,pca1], coeff[i,pca2],color='r',alpha=0.5) 
        if labels is None:
            plt.text(coeff[i,pca1]* 1.15, coeff[i,pca2] * 1.15, "Var"+str(i+1), color='g', ha='center', va='center')
            plt.text(coeff[i,pca1]* 1.15, coeff[i,pca2] * 1.15, labels[i], color='g', ha='center', va='center')


Plotted using


What is Biplot?

Biplot is one of the most useful and versatile methods of multivariate data visualisation. The bipolar extends the idea of a simple scatter plot of two variables to the case of many variables, with the objective of visualising the maximum possible information in the data.

From wikipedia

A biplot allows information on both samples and variables of a data matrix to be displayed graphically. Samples are displayed as points while variables are displayed either as vectors, linear axes or nonlinear trajectories.

If you would like to dig deeper, here’s a link on comprehensive introduction to Biplots [PDF].


Get every new post delivered to your Inbox.

Join 1,135 other followers

%d bloggers like this: