2
$\begingroup$

Why Wolfram gives inconsistent result for :

$$I=\int_0^\infty \frac{e^{x-x^2}-e^{-x-x^2}}{x}~dx$$

As shown in the picture below, the analytical integration gives $-i\pi$, but numerical integration gives $1.93193$. The result must be a real number, but why Wolfram gives a complex result for the analytical integration?

What I suspect is Wolfram might treat this integral as Frullani integral, where $f(x)=e^{x-x^2}$, and $f(-x)=e^{-x-x^2}$. We get

$$\int_0^\infty \frac{e^{x-x^2}-e^{-x-x^2}}{x}~dx=\int_0^\infty \frac{f(x)-f(-x)}{x}~dx=(f(\infty)-f(0))\ln\left(\frac1{-1}\right)=-i\pi$$ But this is WRONG!

Update: I use Mathematica 10.0 and Wolfram Alpha online, and both of them give the complex result.

enter image description here enter image description here

$\endgroup$
5
  • 3
    $\begingroup$ With version "13.3.0 for Mac OS X ARM (64-bit) (June 3, 2023)" Mathematica returns \[Pi] Erfi[1/2], i.e., 1.93193 Please edit your question to indicate version/OS that you are using. $\endgroup$
    – Bob Hanlon
    Commented Jun 30, 2023 at 14:35
  • $\begingroup$ Yes, I have updated my post. I tried Mathematica 10.0 and Wolfram alpha online wolframalpha.com/… $\endgroup$
    – MathFail
    Commented Jun 30, 2023 at 15:23
  • 4
    $\begingroup$ I’m voting to close this question because I only see screenshots, no actual code $\endgroup$
    – Jason B.
    Commented Jun 30, 2023 at 15:46
  • 1
    $\begingroup$ @MathFail Wolfram Alpha site uses old Mathematica 12. $\endgroup$ Commented Jun 30, 2023 at 16:05
  • 1
    $\begingroup$ Mathematica v12.2 needs a little bit assistance: Integrate[Exp[ -x^2] /x 2 Sinh[x], {x, 0, Infinity} ] to get the right solution ` ([Pi] Erfi[1/2])` $\endgroup$ Commented Jun 30, 2023 at 17:09

1 Answer 1

1
$\begingroup$

enter image description here

Not sure why the answer is different but using V13.3 the results are consistent.

$\endgroup$
2
  • $\begingroup$ Thank you! The Wolfram alpha online gives the complex result too. wolframalpha.com/… $\endgroup$
    – MathFail
    Commented Jun 30, 2023 at 15:22
  • 3
    $\begingroup$ Please don't post screenshots of code, especially screenshots taken at the lowest possible resolution. $\endgroup$
    – Jason B.
    Commented Jun 30, 2023 at 15:47

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