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

Bounds order while using hquadrature

Open rpetit opened this issue 6 years ago • 4 comments

Hi, I noticed some weird behaviour while using hquadrature: hquadrature(t->1, 0, -1)[1] outputs 1, while, mathematically speaking, it should be -1. Is this intended, or does anybody have an idea of why is this happening ?

Thank you in advance for your help !

rpetit avatar Jan 13 '20 16:01 rpetit

Yes, it seems like the calls to abs on this line and this line may be undesirable. (In the latter case we will have to add abs calls to the Δ[i] > Δ[kdivide] check, however.)

A PR with a test would be welcome.

stevengj avatar Jan 13 '20 19:01 stevengj

Thanks, I'll see if I can find some time to come up with a PR !

rpetit avatar Jan 14 '20 16:01 rpetit

*** I spent all night from midnight to 5am trying to figure out the mistake in a complicated but working program

quadgk(x -> (gammacdf(shape, scale, S_R-x) - gammacdf(shape, scale, S_L-x)), E_L, S_L, rtol=ε)[1] gave -2.724235379524588 hquadrature(x -> (gammacdf(shape, scale, S_R-x) - gammacdf(shape, scale, S_L-x)), E_L, S_L, rtol=ε)[1] gave 2.724235379524588

Thank you very much!

aakhmetz avatar Jan 31 '20 20:01 aakhmetz

It looks like I did update my Julia packages, but Jupyter notebook was not updated. I am sorry for disturbing - it looks working perfectly now

aakhmetz avatar Feb 01 '20 08:02 aakhmetz