module StatisticalMethods::Core::Array
Extending class
Public Instance Methods
addition()
click to toggle source
# File lib/statistical_methods/core/array.rb, line 5 def addition reduce(:+) end
group_by_count()
click to toggle source
# File lib/statistical_methods/core/array.rb, line 21 def group_by_count reduce(Hash.new(0)) do |hash, item| hash[item] += 1 hash end end
harmonic()
click to toggle source
# File lib/statistical_methods/core/array.rb, line 17 def harmonic map { |value| 1.0 / value } end
multiplication()
click to toggle source
# File lib/statistical_methods/core/array.rb, line 9 def multiplication reduce(:*) end
power(exponent)
click to toggle source
# File lib/statistical_methods/core/array.rb, line 13 def power(exponent) map { |value| value**exponent } end