/usr/share/doc/ruby-gsl/examples/integration/qaws.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 28 29 30 | #!/usr/bin/env ruby
require 'gsl'
include GSL
include Math
f458 = Function.alloc { |x|
if x.zero?
val = 0.0
else
u = log(x)
v = 1.0 + u*u
val = 1.0/(v*v)
end
val
}
exp_result = -1.892751853489401670E-01
exp_abserr = 1.129133712015747658E-08
table = [0.0, 0.0, 1, 0]
result = f458.qaws([0.0, 1.0], table, [0.0, 1e-7])
p result
puts("exp_result: #{exp_result}")
puts("exp_abserr: #{exp_abserr}")
table = Integration::QAWS_Table.alloc(0.0, 0.0, 1, 0)
result = f458.qaws([0.0, 1.0], table, [0.0, 1e-7])
p result
p Integration.qaws(f458, [0.0, 1.0], table)
|