Sha256: 7fe04a5005a39aaede93516a3951c4530c6e0d599eb9dcea2701df825420a371
Contents?: true
Size: 363 Bytes
Versions: 6
Compression:
Stored size: 363 Bytes
Contents
#!/usr/bin/env ruby # Ahmed's Integral # See e.g. http://mathworld.wolfram.com/AhmedsIntegral.html # require("gsl") include GSL include Math f = Function.alloc { |x| sqrtx22 = sqrt(x*x + 2) atan(sqrtx22)/(sqrtx22*(x*x + 1)) } val = f.qng(0, 1)[0] puts("Ahmed's integral") puts("Expect: 5pi^2/96 = #{5.0*M_PI*M_PI/96}") puts("QNG result: #{val}")
Version data entries
6 entries across 6 versions & 2 rubygems