/usr/share/doc/ruby-gsl/examples/histogram/xexp.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 | #!/usr/bin/env ruby
require("gsl")
N = 10000
rng = GSL::Rng.alloc
data = rng.gamma(2, 1.5, N)
h = GSL::Histogram.alloc(100, [0, 15])
h.fill(data)
p h.bin
#result = h.fit_exponential
result = h.fit("xexp")
b = result[0]
amp = result[1]
p amp
p 1.0/b
x = GSL::Vector.linspace(0, 15, 100)
y = amp*x*GSL::Sf::exp(-x*b)
GSL::graph(h, [x, y], "-C -g 3")
|