Integrals.jl icon indicating copy to clipboard operation
Integrals.jl copied to clipboard

Inf Integrand handling

Open agerlach opened this issue 3 years ago • 2 comments

Many of the quadrature algorithms do not handle Inf in the integrand well.

QuadGK throws a DomainError, 2D or higher HCubature returns NaN. Cubature has similar issues but at different dimensions (see https://github.com/JuliaMath/HCubature.jl/issues/29). Some Cuba methods seem to work, i.e. return Inf, while others segfault after a significant amount of computation time.

I'm not quite sure how to approach this issue. Seems like it should be handled upstream by the various algorithms, but this may be a big task to get cleaned up across the board.

agerlach avatar Aug 31 '20 19:08 agerlach

I guess the surprising thing is that there are integrable singularities, but in practice if an algorithm encounters an infinity, it will either throw an error, give a NaN or Inf, or silently return an underconverged result depending on how proactive it is about numerical errors. I think the best we can do is provide informative return codes, which are currently available from SciMLBase but unused. @agerlach do you think that would address the issue?

lxvm avatar Nov 04 '23 18:11 lxvm

I think that is probably the best solution.

agerlach avatar Nov 08 '23 15:11 agerlach