JuliaMath / Cubature.jl

One- and multi-dimensional adaptive integration routines for the Julia language
Other
126 stars 21 forks source link

hquadrature and pquadrature do not match for a simple 1d example #53

Closed rsantet closed 2 years ago

rsantet commented 2 years ago

MWE:

using Cubature

function V(x)
       return cos(4*π*x)
end
function μ(x)
       return exp(-V(x))
end

pquadrature(μ,0,1)
#(0.3678794411714423, 5.551115123125783e-17)

hquadrature(μ,0,1)
#(1.2660658777520202, 1.6177162823726988e-9)

I tried to change the absolute/relative error in the function calls, but it did not matter. I was expecting the two outputs to be approximately the same. Cubature version: 1.5.1 Julia version: 1.6.3

mzaffalon commented 2 years ago

It is probably the same as https://github.com/JuliaMath/Cubature.jl/issues/24. Can you try to integrate on the interval [0,0.99]?

stevengj commented 2 years ago

Yes, it's a duplicate of #24.

julia> pquadrature(μ,0,0.99)
(1.262377385849127, 4.4584338443343086e-9)

julia> hquadrature(μ,0,0.99)
(1.2623773858491294, 4.341954891329778e-9)