/usr/share/doc/ruby-gsl/examples/histogram/gauss.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 | #!/usr/bin/env ruby
require("gsl")
N = 10000
MAX = 8
rng = GSL::Rng.alloc(2)
data = GSL::Ran.gaussian(rng, 1.5, N) + 2
h = GSL::Histogram.alloc(100, [-MAX, MAX])
h.increment(data)
sigma, mean, height, = h.fit_gaussian
x = GSL::Vector.linspace(-MAX, MAX, 100)
y = height*GSL::Ran::gaussian_pdf(x-mean, sigma)
GSL::graph(h, [x, y], "-T X -C -g 3")
|