/usr/share/doc/ruby-gsl/examples/histogram/integral.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 25 26 27 | #!/usr/bin/env ruby
require("gsl")
N = 10000
BINS = 100
rng1 = GSL::Rng.alloc(2)
h = GSL::Histogram.alloc(BINS, [-5, 5])
for i in 0...N do
r1 = rng1.gaussian
h.increment(r1)
end
# Integrate: cumulative distribution
hi = h.integrate
a = hi.diff
# Scale the histograms to ~ 1 at the maximum (to display together)
h.scale!(1.0/h[BINS/2])
a.scale!(1.0/a[BINS/2])
hi.normalize! # this is equivalent to hi.scale(1.0/hi[BINS-1])
GSL::graph(h, hi,a, "-T X -C -g 3")
|