function definition of statmath is move th ystatmath.h and etc.

* Function definitions are short and simple.
  So, they would be better being in header as inline function.
* Some comments are enriched.
* Test for empty sample is newly added.