Mathpack
This gem includes a collection of mathematical methods
Installation
Add this line to your application's Gemfile:
gem 'mathpack'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mathpack
Information
Gem mathpack allows to count statistical functions throught Statistics class
Statistics
Statistics class have following methods
- number - returns a number of elements in series
- mean - returns a mean of series
- variance - returns a variance of series
- skewness - returns a skewness of series
- kurtosis - returns a kurtosis
- min - returns the minimal element of series
- max - returns the maxinal element of series
- raw_moment - returns the nth raw moment of series
- central_moment - returns the nth central moment of series
- empirical_cdf - returns empirical distribution function value in some point
- empirical_pdf - returns empirical probability density function value in some point
- print_empirical_cdf_to_csv - allows to print empirical_cdf grafic values to
.csvfile with name filename - print_empirical_cdf_to_csv - allows to print empirical_cdf grafic values to
.csvfile with name filename
Usage
stat = Mathpack::Statistics.new([1, 2, 5, 6])
stat.number() #=> 4
stat.mean() #=> 3.5
stat.variance() #=> 4.25
stat.kurtosis() #=> 1.221453287197232
stat.skewness() #=> 0.0
stat.min() #=> 1
stat.max() #=> 6
stat.raw_moment(3) #=> 87.5
stat.central_moment(4) #=> 22.0625
stat.empirical_cdf(5.5) #=> 0.75
stat.empirical_pdf(3) #=> 0.07639393483317147
stat.print_empirical_cdf_to_csv('cdf.csv') #=> nil
stat.print_empirical_pdf_to_csv('pdf.csv') #=> nil
Contributing
- Fork it ( https://github.com/[my-github-username]/mathpack/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request