Thinking Fast and Slow

Found this interesting video on Youtube. Grab a hot cup of coffee and enjoy, but before that, see if you can solve this puzzle?

It is easier to build two chimneys, than to keep one in fuel

Few words collected over August.
It is easier to build two chimneys, than to keep one in fuel

  • If you’re not prepared to change your diet or your workouts, don’t get on the scale. – Seth Godin
  • Don’t be the head of the hospital; be the nurse who doctors ask for and patients trust. – Anon
  • It does not suffice to hone your own intellect (that will join you in your grave), you must teach others how to hone theirs. -E.W. Dijkstra
  • If you treat the work as nothing but an obligation, you will soon be overwhelmed by competition that sees it as a privilege and a calling. –SG
  • Next to love friendship, in my opinion, is the most valuable thing life has to offer -Henry Miller
  • All men’s miseries derive from not being able to sit in a quiet room alone.-Pascal
  • Don’t do anything in life where, if somebody asks you the reason why you are doing it, the answer is “Everybody else is doing it.” I mean, if you cancel that as a rationale for doing an activity in life, you’ll live a better life whether it’s in the stock market or any place else. – Warren Buffett
  • Despite what anyone might tell you, words and ideas can change the world.”
  • The people who are good in the long run fail a lot, especially at the beginning. So, when you fail early, it might be worth realizing that this is part of the deal, the price you pay for being good in the long run. – Seth Godin
  • It is more reliable to judge people by analyzing their abilities than by glancing at the scoreboard. Or as Bernoulli put it, “One should not appraise human action on the basis of its results.”
  • You will “fail” a million times but the “failing” and starting over is succeeding. – Dan Harris
  • Marketing used to be what you say Now, marketing is what you do. What you make. How you act. The choices you make when you are sure no one is looking. –Seth Godin
  • ‘It is easier to build two chimneys, than to keep one in fuel,’ -Anon
  • “He that has once done you a kindness will be more ready to do you another than he whom you yourself have obliged.” – Benjamin Franklin
  • Science is the belief in the ignorance of experts. -Richard Feynman
  • Don’t ever make the mistake [of thinking] that you can design something better than what you get from ruthless massively parallel trial-and-error with a feedback cycle. That’s giving your intelligence much too much credit. -Linus Torvalds
  • Never do anything that bores you. -James D. Watson
  • It’s not that I’m so smart, it’s just that I stay with problems longer -Albert Einstein

Using Algorithms to Evaluate Designs for Jet Engines and Aircraft

Algorithms and Gas turbines
Just a quick update regarding two of my favorite subjects, algorithms and Gas turbines, so check this out.

In this free webinar, Dr. Charles Roche of Pratt & Whitney will outline how algorithms can be used to weigh design decisions. The results have led to design ideas that changed the industry.

Dr Roche will draw on case studies such as how Boeing scrapped thrust reversers in their KC-46 and how Embraer selected their engine for the E-Jet E2.

Register Now

This Never Gets Old

Via this

Brilliant… if you an engineer you will surely love this!!

graphs  for engineers

Map Your Google Location History in 3D

Map Your Google Location History in 3D

Inspired by this post “Map Your Google Location History”, I re-mashed the excellent tutorial and added a new function to view google location history on a 3D globe.

Basemap is cool but VTK visualisation toolkit is cooler. Check the results.

And here’s the python notebook to generate the above result.

Cool isn’t it?

Karhunen Loeve Transform in Python

In the theory of stochastic processes, the Karhunen–Loève theorem (named after Kari Karhunen and Michel Loève), also known as the Kosambi–Karhunen–Loève theorem is a representation of a stochastic process as an infinite linear combination of orthogonal functions, analogous to a Fourier series representation of a function on a bounded interval.

Here’s an exercise I did a week back to understand it better.

Karhunen Loeve Transform in Python

Karhunen Loeve Transform relies on the covariance matrix of a set of observation vectors. The basic algotithm is explained in these excellent lectures

And to see the KL transform in action visit

In [1]:
import numpy as np
In [2]:
def KLT(a):
    Returns Karhunen Loeve Transform of the input and the transformation matrix and eigenval
    import numpy as np
    a  = np.array([[1,2,4],[2,3,10]])
    kk,m = KLT(a)
    print kk
    print m
    # to check, the following should return the original a
    val,vec = np.linalg.eig(np.cov(a))
    klt =,a)
    return klt,vec,val

Example 1

In [3]:
a  = np.array([[1,2,4],[2,3,10]])
print a,a.shape
[[ 1  2  4]
 [ 2  3 10]] (2, 3)

In [4]:
kk,m,val = KLT(a)
In [5]:
print kk
print m
print val
[[-1.59602949 -2.86686851 -7.03449892]
 [-1.56610659 -2.18656465 -8.15572344]]
[[-0.94564854 -0.32519048]
 [ 0.32519048 -0.94564854]]
[[  1.   2.   4.]
 [  2.   3.  10.]]
[  0.09810743  21.23522591]

Example 2

In [6]:
a= np.random.rand(20,5)*100
kk,m,val = KLT(a)
print val
[  6.03748782e+03 +0.00000000e+00j   5.36177007e+03 +0.00000000e+00j
   3.94526413e+03 +0.00000000e+00j   2.80078918e+03 +0.00000000e+00j
  -2.80723774e-13 +2.73566185e-13j  -2.80723774e-13 -2.73566185e-13j
   3.15308859e-13 +2.18787274e-13j   3.15308859e-13 -2.18787274e-13j
  -3.21526974e-13 +3.59336478e-14j  -3.21526974e-13 -3.59336478e-14j
   4.10392909e-13 +0.00000000e+00j   3.28554436e-13 +0.00000000e+00j
   1.93536473e-13 +8.16943559e-14j   1.93536473e-13 -8.16943559e-14j
  -1.00036413e-13 +1.08479990e-13j  -1.00036413e-13 -1.08479990e-13j
   5.89399042e-14 +0.00000000e+00j  -1.01830548e-13 +0.00000000e+00j
  -3.35517071e-14 +5.19296828e-14j  -3.35517071e-14 -5.19296828e-14j]

In [7]:
print kk[:,0]
[ -19.88571370 +5.78613631j  -26.92980925 +1.1405507j
  -71.38367367+16.51826228j   41.42575279 +1.77169163j
   24.74718060 +7.73570152j   79.94127422 -8.9347779j
  -16.92612673-11.09979081j  -21.37461321 +2.7563032j
    7.03333553-10.45710615j   46.62805945+18.89607343j
    4.58608380 -5.40369704j  146.04910424 +0.5710281j
  -22.22228105 -2.42342784j  -16.60076029 -6.5282612j
  -38.29552191 +9.07952442j   -6.48539692 +8.84928717j
  -99.68353378 +9.9974666j   -65.96782860 -7.75414299j
  -10.08531081-25.27053509j -101.15451537 -1.9404897j ]

Example 3

In [8]:
a=np.array([[0, 0, 1], [0, 1, 1]])
kk,m,val = KLT(a)
In [9]:
print kk
[[  0.00000000e+00  -7.07106781e-01  -1.11022302e-16]
 [  0.00000000e+00   7.07106781e-01   1.41421356e+00]]

In [10]:
print m
[[ 0.70710678 -0.70710678]
 [ 0.70710678  0.70710678]]

In [11]:
print val
[ 0.5         0.16666667]

Visit for some great practical results

Continue reading

A Shorter Version….


Looking at Voronoi with python, someone remarked it’s complicated. Well here’s the simplified version without any GUI or pluff.

4 simple lines to get the above voronoi diagram..

from scipy.spatial import voronoi_plot_2d,Voronoi
data = np.random.rand(50,2)
var = Voronoi(data)

Do you know, voronoi has wide applications and can be used to determine optimum locations for cell phone towers.


Get every new post delivered to your Inbox.

Join 1,005 other followers

%d bloggers like this: