f0uriest / quadax

Numerical quadrature with JAX
MIT License
44 stars 1 forks source link

Confusion about what seems to be a typo in midpoint evaluation #16

Open javier-garcia-tilburg opened 3 days ago

javier-garcia-tilburg commented 3 days ago

It appears that quadax wants to do a midpoint evaluation on the lines below https://github.com/f0uriest/quadax/blob/48fe56b55d8eb5278cba0f2382045f04a270f633/quadax/romberg.py#L100 https://github.com/f0uriest/quadax/blob/48fe56b55d8eb5278cba0f2382045f04a270f633/quadax/adaptive.py#L425 Except that there is a typo and functions are evaluated at a + b / 2 instead of (a + b) / 2. For a function defined on the domain [45, 50], existing code would evaluate the function at point 70, which lies outside the domain.

If this is indeed a typo, my guess is that the problem hasn't surfaced yet because eval_shape uses JAX's abstract capabilities instead of applying the function directly.