Open agerlach opened 3 years ago
I'm not sure off the top of my head what might give a NaN, but probably only a small patch is required to return Inf
.
Sign changes in coefficients g.w
leads to I=NaN
due to Inf-Inf
https://github.com/JuliaMath/HCubature.jl/blob/66074a8b75f71066624517ea9a89b4f28e963b0f/src/genz-malik.jl#L150
I am happy to put together a PR to address this corner case, but it is unclear to me what the appropriate behavior should be. My initial thought is to short-circuit the algorithm and return Inf if f
ever returns Inf.
On second thought short-circuiting would not be a good approach b/c integrand could be vector-valued mixing Inf and finite values.
I am looking at some SciML problems where, depending on the stability of the ODE, the integrand used w/ HCubature.jl may return Inf. I am noticing inconsistent behavior across
hquadrature
andhcubature
for single and multi-dim domains.I see similar behavior in Cubature.jl as well, but
Cubature.hcubature
returns Inf up to dim = 4 and then NaN, whileCubature.pcubature
returns Inf up dim = 17 (haven't test passed that).Is this the expected behavior? I assume this is due to some Inf*0 that is propagating down.
Thanks.