/usr/share/doc/ruby-gsl/examples/histogram/poisson.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #!/usr/bin/env ruby
require("gsl")
GSL::Rng.env_setup()
N = 10000
rng = GSL::Rng.alloc
h = GSL::Histogram.alloc(20, [0, 20])
=begin
for i in 0...N do
r = rng.poisson(5)
# r = GSL::Ran::poisson(rng, 5)
h.increment(r)
end
=end
v = rng.poisson(5, N)
h.fill(v)
h.normalize!
x = GSL::Vector.linspace(0, 20, 100)
y = GSL::Ran::poisson_pdf(x, 5)
GSL::graph(h, [x, y], "-C -g 3 -L 'Poisson distribution, mu = 5'")
|