Sha256: d11387bef952d5382e02b575d704f5a9faed1fb1911b9147c625429927d663c0

Contents?: true

Size: 359 Bytes

Versions: 15

Compression:

Stored size: 359 Bytes

Contents

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

class Fixnum
  def mm
    self * 2.83464566929134
  end
end

class Float
  def mm
    self * 2.83464566929134
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mork-0.8.1 lib/mork/extensions.rb
mork-0.8.0 lib/mork/extensions.rb
mork-0.7.0 lib/mork/extensions.rb
mork-0.6.0 lib/mork/extensions.rb
mork-0.5.0 lib/mork/extensions.rb
mork-0.4.0 lib/mork/extensions.rb
mork-0.3.0 lib/mork/extensions.rb
mork-0.2.1 lib/mork/extensions.rb
mork-0.1.3 lib/mork/extensions.rb
mork-0.1.2 lib/mork/extensions.rb
mork-0.1.1 lib/mork/extensions.rb
mork-0.1.0 lib/mork/extensions.rb
mork-0.0.12 lib/mork/extensions.rb
mork-0.0.11 lib/mork/extensions.rb
mork-0.0.10 lib/mork/extensions.rb