There is something known as a MahalanobisDistance. I can write a Mathematica function to calculate it for two vectors u and v with respect to some data. Here's a function that implements it.
Frequently, one is trying to find the distance from some vector u to the mean of data, so one can also write a two argument form:
So far, so good, I think. But it is also correctly reported that the MahalanobisdDistance is the same as the EuclideanDistance when the points are subjected to a special linear transformation. After some poking about, it appears that one can find the transformation through the following process:
And, this seems to work. But ... SchurDecomposition insists that its argument be numeric. Thus, the N in the code above. But surely, I say, at least where the matrix in question has the properties of an inverse covariance matrix (symmetry and who knows what else) there is some way of computing an exact or symbolic answer. I;ve seem some stuff on the internet suggesting that there are eigenvalues involved, but, I can't seem to get any of it to work. Any suggestions for either a special case of SchurDecomposition that works on integer or symbolic matrices or an alternative way of generating the MahalanobisTransform. I have the sense there is a way to do this.
This is all relevant to inference of causation from observational data and computational efficiency, if anyone wants to know why anyone might care. I'd like to be able to write a MahlanobisDistanceFunction that is something like this. It would be nice if T could be symbolic.
Ultimately, I'd like an elegant ResourceFunction to come of this work.