Sha256: e37fb6de0a3ea2fb6819ba021aa93ce9037fef13ed6af76bfcdd236c9305dc34

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

Gem Name: Easystats
Gem Author: Matthew Grigajtis (http://www.matthewgrigajtis.com)
Description: Provides easy to use statistical functions to use on an array 

Functions Provided:
sum
Returns: The sum of the numbers in the array

mean
Returns: The mean (average) of the numbers in the array

average
An alias of mean

standard_deviation
Returns: The standard deviation of the numbers in the array

median
Returns: The median of the numbers in the array

range
Returns: The range of the numbers

mode
Returns: The mode.  If there is no mode returns 0.

variance
Returns: The variance

Example usage:

require "rubygems"
require "easystats"

# Create a test array of numbers
myNumbers = Array.new
myNumbers = [4, 8, 15, 16, 23, 42]

puts "Range: " + myNumbers.range.to_s
puts "Sum: " + myNumbers.sum.to_s
puts "Average: " + myNumbers.mean.to_s
puts "Median: " + myNumbers.median.to_s
puts "Variance: " + myNumbers.variance.to_s
puts "Standard Deviation: " + myNumbers.standard_deviation.to_s
puts "Mode: " + myNumbers.mode.to_s

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easystats-0.2.0 README
easystats-0.1.0 README