Closed kojix2 closed 6 years ago
Thank you very much!
require 'numo/gsl'
require 'numo/gnuplot'
require 'histogram/array'
g = Numo::GSL::Rng::Mt19937.new
data = g.negative_binomial(0.5,3.5,10000).to_a
bins, freq = data.histogram(20)
bins.map!{|b| b.round(2).to_s}
Numo.gnuplot do
set term: 'png font "IPA Mincho"'
set out: "out.png"
set title:"負の二項分布"
set style:[:fill, :solid, {border:-1}]
set xtics:["rotate by": -45]
plot bins, freq, u:"2:xtic(1)", w: :boxes, lc:{rgb:"orange"}, t:"p=0.3, n=3.5"
end
Hello!
I attempted to use Numo :: GSL :: Ran.negative_binomial. First, I searched for a yard document. But I can not find the method. Next, I searched source code . I think it seems to be implemented here. https://github.com/ruby-numo/numo-gsl/blob/d91e93c0f4e0d224aef490f854cca9c66dc4fadc/ext/numo/gsl/ran/func_2.3.rb#L1404
sample code
output:
negative_binomial is not here. Are there any hints?
system:
gem install numo-gsl -- --with-gsl-lib=usr/local/lib