Sha256: a6c2e79d884985002f98e1fb98ab99f8fe735f6b350b47bb897f8a6667301b5a

Contents?: true

Size: 332 Bytes

Versions: 6

Compression:

Stored size: 332 Bytes

Contents

#!/usr/bin/env ruby
require("gsl")

N = 10000
rng = GSL::Rng.alloc
data = rng.exponential(2, N)
h = GSL::Histogram.alloc(100, [0, 15])
h.fill(data)

#result = h.fit_exponential
result = h.fit("exponential")
a = result[0]
b = result[1]

x = GSL::Vector.linspace(0, 15, 100)
y = a*GSL::Sf::exp(x*b)
GSL::graph(h, [x, y], "-C -g 3")


Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
gsl-2.1.0.3 examples/histogram/exponential.rb
gsl-2.1.0.2 examples/histogram/exponential.rb
gsl-2.1.0.1 examples/histogram/exponential.rb
gsl-2.1.0 examples/histogram/exponential.rb
gsl-1.16.0.6 examples/histogram/exponential.rb
rb-gsl-1.16.0.5 examples/histogram/exponential.rb