From: Roger Pack Date: 2007-08-24T06:56:06+09:00 Subject: Re: Probability distributions library in Ruby From wikipedia : algorithm for generating pseudo poissons: def poisson(lambda) # init l = Math.exp(-lambda) k = 0 p = 1 while p >= l k += 1 u = rand p = p *u end return k -1 end only returns ints, but hey, they center around lambda gl. -Roger maw wrote: > Libra wrote: >> Libra > R is great! maybe too great for your requirements > rb-gsl is easy > > for example this will print you a nice gauss-shape graph > from rb-gsl-1.8.3/samples/histogram/gauss.rb >> >> sigma, mean, height, = h.fit_gaussian >> >> x = GSL::Vector.linspace(-MAX, MAX, 100) >> y = height*Ran::gaussian_pdf(x-mean, sigma) >> GSL::graph(h, [x, y], "-T X -C -g 3") > > NICE! > > cauchy exponential power poisson etc. also available > ruby - making maths easy -- Posted via http://www.ruby-forum.com/.