Sha256: 1c3c9b1fe1bfb5de5f0fd11ee6d886794b3b47446fbb9ab4d4702007caa121ce

Contents?: true

Size: 392 Bytes

Versions: 5

Compression:

Stored size: 392 Bytes

Contents

# @private
class Array
  def mean
    @the_sample_mean ||= inject(:+)/length.to_f
  end

  def sample_variance
    sum = inject(0){|accum, i| accum + (i-mean)**2 }
    sum/(length - 1).to_f
  end

  def stdev
    Math.sqrt sample_variance
  end
end

# @private
class Fixnum
  def mm
    self * 2.83464566929134
  end
end

# @private
class Float
  def mm
    self * 2.83464566929134
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mork-0.10.0 lib/mork/extensions.rb
mork-0.9.3 lib/mork/extensions.rb
mork-0.9.2 lib/mork/extensions.rb
mork-0.9.1 lib/mork/extensions.rb
mork-0.9.0 lib/mork/extensions.rb