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