RuleBasedIntegration / Rubi

Rubi for Mathematica
http://rulebasedintegration.org
MIT License
228 stars 23 forks source link

Incorrect definite integrals due to incorrect handling of branch-cuts #39

Open galanakis opened 3 years ago

galanakis commented 3 years ago

The correct value of this integral is π,

However Rubi gives 2π when the integrand has exponentials and π (correctly) when it is trigonometric.

The antiderivative with exponentials has ExpIntegralEi[z] and ExpIntegralEi[-z], which have branch cuts running in opposite directions (here z = i x). The antiderivative of the trigonometric form is SinIntegral without branch-cuts.

The problem is that the two branch-cuts cover the entire real axis and always cross the contour. I suppose that the branch cuts need to be moved so that the contour does not cross any of them.

In definite integrals, Rubi needs to detect the branch-cuts along the integration contour and "skip" them (or subtract their height). More below.

galanakis commented 3 years ago

Below is the argument (complex number angle) of the antiderivative of the above function over the complex plain.

Antiderivative from exponentials: there is a branch-cut splitting the imaginary axis (the contour of integration) in half). image

Antiderivative from trigonometric: there is no branch cut image

One resolution would be to detect when branch-cuts partition the complex plane such that there is no integration contour that can avoid them, and remove their "height" from the result.

In this particular case, the anti-derivative is a[z] = -(1/2) ExpIntegralEi[-z] + ExpIntegralEi[z]/2 The contour is z=i t and the branch cut is at t=0.

Rubi returns the value a[i ∞] - a[-i ∞]. Instead it should return a[i ∞] - a[0+] + a[0-] - a[-i ∞] where a[0+], a[0-] are the limiting values right above and below the branch-cut respectively.