flintlib / arb

Arb has been merged into FLINT -- use https://github.com/flintlib/flint/ instead
http://arblib.org/
GNU Lesser General Public License v2.1
455 stars 137 forks source link

acb_calc_integrate gives wrong results when integrating over a line with complex endpoints #293

Closed SerendipityAbound closed 4 years ago

SerendipityAbound commented 4 years ago

I'm using SageMath 8.8 via its Jupyter notebook and when I used its interface to Arb and tried the following integral:

print CBF.integral(lambda x, _: x.gamma(), 1 - CBF(i), 1 + CBF(i))

it gives [+/- 4.33e-15] + [1.5723926694981 +/- 4.57e-14]*I which is incorrect. Writing the following code instead returns the correct result:

print CBF.integral(lambda x, _: (1+x*im).gamma(), -1, 1)

outputs [1.5723926694981 +/- 4.57e-14] + [+/- 4.33e-15]*I. The bug persists when using Arb that I built from the latest commit so the bug isn't in SageMath interface to Arb.

fredrik-johansson commented 4 years ago

Both results are correct. Integrals are oriented; if you rotate the path of integration by i, you also pick up a factor i in the value of the integral.

SerendipityAbound commented 4 years ago

Right, that's what I get for self-studying things and skipping from topic to topic - forgetting that parametrization matters. Nonetheless, thanks.