>>> from numpy import *
>>> import numpy
>>> x = numpy.array([[3,4],[5,6],[2,2],[8,4]])
>>> xT=x.T
>>> xT
array([[3, 5, 2, 8],
[4, 6, 2, 4]])
>>> D=numpy.cov(xT)
>>> invD=numpy.linalg.inv(D)
>>> invD
array([[ 0.18181818, -0.13636364],
[-0.13636364, 0.47727273]])
>>> tp=x[0]-x[1]
>>> print numpy.sqrt(dot(dot(tp,invD),tp.T))
1.24316312102