module RThelper
Public Instance Methods
RandomFloat(a,b)
click to toggle source
# File lib/ms/rt/rt_helper.rb, line 22 def RandomFloat(a,b) a = a.to_f b = b.to_f random = rand(2147483647.0) / 2147483647.0 diff = b - a r = random * diff return a + r end
gaussian(x,mu,sd,h)
click to toggle source
# File lib/ms/rt/rt_helper.rb, line 13 def gaussian(x,mu,sd,h) x = x.to_f mu = mu.to_f sd = sd.to_f h = h.to_f return h*Math.exp(-(x-mu)**2/(sd**2)) end
normalized_gaussian(x,mu,sd)
click to toggle source
# File lib/ms/rt/rt_helper.rb, line 5 def normalized_gaussian(x,mu,sd) x = x.to_f mu = mu.to_f sd = sd.to_f return ((1/(Math.sqrt(2*(Math::PI)*(sd**2))))*(Math.exp(-(((x-mu)**2)/((2*sd)**2))))) end