If you need to do some calculation (like statistics, math, ….) check out the GSL library.
It has lots of method already written like standard derivation, correlation, mean, monte carlo analysis etc…
I have connected this library (which is written in C) to ruby.
- download and install GSL (configure -> make -> make clean -> make install => see readme)
- for ruby: gem install gsl (check ruby-gsl project for examples)