Sha256: 6c3394fe2b3ffeadf4e5914e9945dd43bd9aa61eab5cb160d0bdbd0f7cb3881b

Contents?: true

Size: 636 Bytes

Versions: 22

Compression:

Stored size: 636 Bytes

Contents

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

w = Integration::Workspace.alloc(1000)
xmin = 0.0

f = Function.alloc{ |x, n|
  pow(x, n-1)/(exp(x) - 1.0)
}

nv = Vector[2..5]
y1 = Sf::gamma(nv)*Sf::zeta(nv)

y2 = Vector[10]
begin
  file1 = File.open("y1.dat", "w")
  file2 = File.open("y2.dat", "w")
  nv.each do |n|
    f.set_params(n)
    y2[n.to_i-2] = f.qagiu(xmin, w)[0]
    file1.printf("%e %e\n", n, y1[n.to_i-2])
    file2.printf("%e %e\n", n, y2[n.to_i-2])
  end
ensure
  file1.close
  file2.close
end

system("graph -T X -C -g 3 -m 1 'y2.dat' -m -2 -S 4 'y1.dat' ")
File.delete("y1.dat")
File.delete("y2.dat")


Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
gsl-2.1.0.3 examples/integration/gamma-zeta.rb
gsl-2.1.0.2 examples/integration/gamma-zeta.rb
gsl-2.1.0.1 examples/integration/gamma-zeta.rb
gsl-2.1.0 examples/integration/gamma-zeta.rb
gsl-1.16.0.6 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0.5 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0.4 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0.3 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0.3.rc1 examples/integration/gamma-zeta.rb
gsl-nmatrix-1.15.3.2 examples/integration/gamma-zeta.rb
gsl-nmatrix-1.15.3.1 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0.2 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0.1 examples/integration/gamma-zeta.rb
rb-gsl-1.16.0 examples/integration/gamma-zeta.rb
rb-gsl-1.15.3.2 examples/integration/gamma-zeta.rb
rb-gsl-1.15.3.1 examples/integration/gamma-zeta.rb
blackwinter-gsl-1.15.3.2 examples/integration/gamma-zeta.rb
gsl-nmatrix-1.15.3.0 examples/integration/gamma-zeta.rb
gsl-1.15.3 examples/integration/gamma-zeta.rb
gsl-1.14.7 examples/integration/gamma-zeta.rb