JuliaMath / HCubature.jl

pure-Julia multidimensional h-adaptive integration
Other
153 stars 25 forks source link

Check for NaN? #18

Closed MasonProtter closed 5 years ago

MasonProtter commented 5 years ago

Currently if you try to naïvely integrate an equation that produces a NaN in the integration region, hcubature will just run forever, presumably because the rtol calculation doesn't check for NaN. Obviously, users should be thinking about their code and not integrating functions which produce NaN, but it'd be nice if there was and error thrown on encountering NaN instead of just silently running forever (unless one sets MaxEvals)

Here's a MWE:

f((x, y)) = y ≈ 0 ? NaN : x*y

hcubature(f, [-1, -1], [1, 1])