global-methods.rb
# consumes list of numerics, produces a float
consumes list of numerics, produces a float
consumes list of numerics produces a float
def mean(values)
  mu = values[0].to_f
  return mu if values.count == 1
  (2..values.count).each do |n|
    mu = ((n - 1).to_f / n) * (mu + values[n-1] / (n - 1)  )
  end
  mu
end
def mean ( values ) mu = values [ 0 ] . to_f return mu if values . count == 1 ( 2 .. values . count ) . each do | n | mu = ( ( n - 1 ) . to_f / n ) * ( mu + values [ n - 1 ] / ( n - 1 ) ) end mu end
consumes list of numerics, produces a float
consumes list of numerics produces a float
values
<not_specific>