josdejong/mathjs — pull request #117 by guillermobox (2013-12-04 19:55:35+00:00)
Title: Working version of standard deviation function

Hi,

I've implemented a working version of the standard deviation for your library. There are two definitions of standard deviation (population and sample), in my case I used what I think is the most common.

I've also created a function to help me called: deepApply. This function takes a matrix, a dimension and a function that works with an array as input and that should return a single number, and returns a new matrix, with a less dimension after having applied the given function to the desired dimension. If the callback function provided doesnt return a scalar, but another multidimensional vector, the function should work right, returning a matrix with more dimensions. This is used to calculate the standard deviation of a matrix. If you use the previous reduce function, you will be using a lot more memory because I think you have to make a full copy of the matrix.

Well, that's it. Review the code and tell me if you don't like something. I'm not able to create test cases with bignumber :( sorry.