I'm scratching my head over the the following result in Mathematica (v11.3)

I'm considering the function

B = Erfc[x] Exp[-x^2/2] + Sqrt[2] Erfc[x/Sqrt[2]] Exp[-x^2]

Wich is smooth near $x=0$

For instance Plot[B, {x, -1, 1}] gives


They function is also holomporphic and thus analytically continuable into the complex plane such that Plot3D[Abs[B /. x -> (xp + I y)], {xp, -1, 1}, {y, -1, 1}] gives

enter image description here

But if i integrate it using

 BI = Integrate[B, {x, a, \[Infinity]}]

I get the function

 Sqrt[2 \[Pi]] + Sqrt[\[Pi]/2] Erf[a] (-1 + Erf[a/Sqrt[2]]) +  1/2 a ExpIntegralE[1/2, a^2/2]

which has a discontinuity at $a=0$?! See e.g. Plot[BI, {a, -1, 1}]

enter image description here

This should not be able to happen with the integral of a smooth function, right?


1 Answer 1


(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)


B = Erfc[x] Exp[-x^2/2] + Sqrt[2] Erfc[x/Sqrt[2]] Exp[-x^2];

If you explicitly state that a is a real value, Mathematica will tell you that the result is conditional on a > 0

BI = Assuming[Element[a, Reals], Integrate[B, {x, a, ∞}]]

(* ConditionalExpression[
 1/2 (Sqrt[2 π] Erf[a] (-1 + Erf[a/Sqrt[2]]) + 
    a ExpIntegralE[1/2, a^2/2]), a > 0] *)

With the assumption a > 0 the integral simplifies

Assuming[a > 0, FullSimplify[BI]]

(* Sqrt[π/2] Erfc[a] Erfc[a/Sqrt[2]] *)

Or more directly,

BI2 = Assuming[a > 0, Integrate[B, {x, a, ∞}]]

(* Sqrt[π/2] Erfc[a] Erfc[a/Sqrt[2]] *)

The same result is returned for a <= 0

Assuming[a <= 0, Integrate[B, {x, a, ∞}]] == BI2

(* True *)

Consequently, BI2 is the integral for all real a

Plot[BI2, {a, -1, 1}]

enter image description here

  • 1
    $\begingroup$ So as always, it falls back on always telling mathematics everything. $\endgroup$ May 14, 2021 at 17:05
  • 4
    $\begingroup$ Mathematica generally assumes that all variables are complex. If that is not the case, you need to tell Mathematica what your assumptions are. $\endgroup$
    – Bob Hanlon
    May 14, 2021 at 17:11
  • 3
    $\begingroup$ I consider this behavior to be a bug. Even assuming $a$ is complex, the result for real $a$ should be continuous. What you have found is just a workaround. $\endgroup$
    – yarchik
    May 14, 2021 at 17:23
  • 1
    $\begingroup$ @BobHanlon But the function is holomorphic, with no branch curt near $x=0$, I don't se why a step function should show up here.... $\endgroup$ May 15, 2021 at 5:22
  • 2
    $\begingroup$ @MikaelFremling No one has mentioned it, so perhaps it's not obvious, that the branch-cut problem is not with the integrand but with the formula for the integral, specifically with the exponential integral: Series[a ExpIntegralE[1/2, a^2/2], {a, 0, 0}]. This arises in the antiderivative Integrate[E^(-(x^2/2)) Erfc[x], x], even though is it expressible in terms of the holomorph Erf[]: Try Simplify[% // FunctionExpand, x > 0] on the result, which seems to produce a valid antiderivative. It might also perform the transformation $x\mapsto ax$, which makes $a=0$ singular. $\endgroup$
    – Michael E2
    May 15, 2021 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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