16
$\begingroup$

Bug introduced in 8 and persisting through 13.0. Fixed in 13.2.0 or earlier.


Mathematica 11.2.0.0 Home edition on MacBook Pro OS X 10.10.5 (Yosemite).

Remove[f, x, xx, a, b]
$Assumptions = {a > 0, b > 0, x > 0};
f[x_, a_, b_] := b Exp[-(Sqrt[x^2]/a)^b]/(2 a Gamma[1/b])
Integrate[f[xx, a, b], {xx, -∞, x}]

If I quit the kernel, and run the above code, I correctly get

1 - Gamma[1/b, (x/a)^b]/(2 Gamma[1/b])

But if I then immediately re-run it, it returns unevaluated. Can anyone reproduce this and/or explain it?

$\endgroup$
8
  • 5
    $\begingroup$ Appears to be a bug. $\endgroup$ Commented Jan 20, 2022 at 17:00
  • $\begingroup$ Confirm it in version 13.0.0 on Windows 10. I think this is a kernel bug rather than an Integrate bug. $\endgroup$
    – user64494
    Commented Jan 20, 2022 at 17:00
  • 4
    $\begingroup$ Confirmed on $Version == "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)". $\endgroup$
    – march
    Commented Jan 20, 2022 at 17:16
  • 1
    $\begingroup$ The bug is introduced in v8: i.sstatic.net/0JZE3.png i.sstatic.net/5NKFJ.png $\endgroup$
    – xzczd
    Commented Jan 21, 2022 at 2:02
  • 2
    $\begingroup$ @AlexeyPopkov It has been filed as a bug. $\endgroup$ Commented Jan 21, 2022 at 15:18

1 Answer 1

8
$\begingroup$

EDIT: The evaluation error pointed out in the OP has been accepted as a bug. This bug is most probably a problem in the kernel, and will be investigated carefully by Wolfram's expert team.

Nevertheless I find it tempting to study the reaction of Mathematica to variations of the input.

This study was motivated by the wish to understand my observation of some hours ago (rephrased in §1).

§1. It might be interesting to notice that the problem does not appear if we assume x<0

$Version[]    
Out[17]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)"[]

Remove[f, x, xx, a, b]
$Assumptions = {a > 0, b > 0, x < 0};
f[x_, a_, b_] := b Exp[-(Sqrt[x^2]/a)^b]/(2 a Gamma[1/b])
Integrate[f[xx, a, b], {xx, -\[Infinity], x}]

(* Out Gamma[1/b, (-(a/x))^-b]/(2 Gamma[1/b]) *)

§2. As suspected, the branch point of the integrand at x=0 causes (at least part of) the problem.

The next two commands shows this.

Here ist the buggy case in which the branch point is crossed

(* branch point x=0 crossed: 1st evaluation ok 2nd time not evaluated *)
Remove[f, x, xx, a, b]
$Assumptions = {a > 0, b > 0, x > 0};
f[x_, a_, b_] := b Exp[-(Sqrt[x^2]/a)^b]/(2 a Gamma[1/b])
Integrate[f[xx, a, b], {xx, -\[Infinity], x}]

(* 1st eval:  1 - Gamma[1/b, (x/a)^b]/(2 Gamma[1/b]) *)
(* 2nd eval:  unevaluated *)

And here is my observation again where the integration path avoids the branch point:

(* branch point x=0 not crossed: repeated evaluation ok *)
Remove[f, x, xx, a, b]
$Assumptions = {a > 0, b > 0, x < 0};
f[x_, a_, b_] := b Exp[-(Sqrt[x^2]/a)^b]/(2 a Gamma[1/b])
Integrate[f[xx, a, b], {xx, -\[Infinity], x}]

(* Gamma[1/b, (-(a/x))^-b]/(2 Gamma[1/b]) *)

Remark 1: we find the similar results with a path {xx,x,+\[Infinity]}.

Remark 2: If we replace the starting point of the integration path at -\[Infinity] by a finite value, say -1, the repetition problem vanishes.

Example:

(* branch point at x=0 crossed: no repetition problem  *)
f[x_, a_, b_] := Exp[-(Sqrt[x^2]/a)^b]
Integrate[f[xx, a, b], {xx, -1, x}]

(* Out[2]= ConditionalExpression[-((
  ExpIntegralE[(-1 + b)/b, a^-b] + 
   x ExpIntegralE[(-1 + b)/b, (-(a/x))^-b])/b), 
 Re[a] >= 0 && Re[a^-b] >= 0 && Max[-1, x] < 0 && 
  Min[-1, x] < Max[-1, x]] *)

§3. Is it really only the branch point?

Let us replace the exponential funtion by a rational function keeping the branch point:

(* rational function of f, branch point crossed: no problems *)
Remove[g, x, xx, a, b]
$Assumptions = {a > 0, b > 0, x > 0};
g[x_, a_, b_] := 1/(1 + (Sqrt[x^2]/a)^b)
Integrate[g[xx, a, b], {xx, -\[Infinity], x}]

(* Out ConditionalExpression[(
 a \[Pi] Csc[\[Pi]/b] + 
  b x Hypergeometric2F1[1, 1/b, 1 + 1/b, -(x/a)^b])/b, b > 1] *)

(* rational function of f, branch point not crossed: no problems *)
Remove[g, x, xx, a, b]
$Assumptions = {a > 0, b > 0, x < 0};
g[x_, a_, b_] := 1/(1 + (Sqrt[x^2]/a)^b)
Integrate[g[xx, a, b], {xx, -\[Infinity], x}]

(* ConditionalExpression[(a \[Pi] Csc[\[Pi]/b])/b + 
  x Hypergeometric2F1[1, 1/b, 1 + 1/b, -(-(x/a))^b], b > 1] *)

Hence, for a rational function of f, we find that the results of the integration are not only repeatable but is symbolically the same independent of whether the integration path crosses the branch point or not.

§4. Conclusion: it is the combination of three issues, a branch point, the exponential function and the infinitely long integration path, which leads to the bug.

Maybe this can be stated more compactly as: the bug is caused by the combination of a branch point and an essential singularity on the integration path.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.