# A limit wrong using Wolfram Alpha

I want to calculate the following limit:

$$\displaystyle{\lim_{x \to 0} \cfrac{\displaystyle{\int_1^{x^2+1} \cfrac{e^{-t}}{t} \; dt}}{3x^2}}$$

For that, I use L'Hopital and the Fundamental Theorem of Calculus, obtaining the following:

$$\displaystyle{\lim_{x \to 0} \cfrac{\displaystyle{\int_1^{x^2+1} \cfrac{e^{-t}}{t} \; dt}}{3x^2}}=\displaystyle{\lim_{x \to 0} \cfrac{\frac{e^{-(x^2+1)}}{x^2+1} \cdot 2x}{6x}}=\lim_{x \to 0} \cfrac{e^{-(x^2+1)}}{3(x^2+1)}=\cfrac{e^{-1}}{3}$$

But if I calculate the limit in Wolfram Alpha, I get the following.

I calculated the limit also in Mathematica 8.0, and the result is still the same: $\frac 13(\frac 1e-1)$ So, what is my mistake calculating the limit?

-
Pro tip: report the error to Wolfram and you'll get a free t-shirt! (Happened to an office mate of mine last year) –  icurays1 Jan 15 '13 at 17:04
Mathematica's own numerical calculations agree with you: wolframalpha.com/input/?i=Integrate[1%2Ft*E^%28-t%29%2C+{t%2C+1%2C+1%‌​2B10^-10}]%2F%283*10^-10%29 –  user7530 Jan 15 '13 at 17:04
By wrapping the expression in Assuming[x ∊ Reals, ... ] in Mathematica I do indeed get the expected result. –  Frxstrem Jan 15 '13 at 17:06
there not too far from each other. Alternate form of the first is 1/3e and the second is 1/3e -1/3. Though i cant see any reason why the "-1/3" would come in –  exussum Jan 15 '13 at 18:05
Wouldn't this be better on Mathematica.SE? –  robjohn Jan 17 '13 at 2:21

Some more observations on Mathematica's behavior: it yields

$$\frac{d}{dx} \int_1^{x} \frac{e^{-t}}{t} \, dt = \frac{e^{-x} - 1}{x}$$

restricted to $\Im(x) \neq 0$ or $\Re(x) \geq 0$. But changing things slightly gives

$$\frac{d}{dt} \int \frac{e^{-t}}{t} \, dt = \frac{e^{-t}}{t}.$$

I had originally suspected there was something fishy with the branch cut: Mathematica computes

$$\int_1^x \frac{e^{-t}}{t} \, dt = -\mathrm{Ei}(-1) - \log(x) - \Gamma(0,x)$$

again restricted to $\Im(x) \neq 0 \vee \Re(x) \geq 0$. However:

• The point we are interested in is away from the branch discontinuity
• I would have expected it to get the derivative right even if there were weird branch issues

(using $x+1$ in the above instead of $x$ does not make any qualitative difference)

Without limits, it computes

$$\int \frac{e^{-t}}{t} \, dt = \mathrm{Ei}(-t) \color{gray}{+ \mathrm{constant}}$$

If you shift the integrand, you get

$$\frac{d}{dx} \int_0^x \frac{e^{-(u+1)}}{u+1} \, du = \frac{e^{-(u+1)}}{u+1}$$

and correspondingly

$$\lim_{y \to 0} \frac{ \int_0^y \frac{e^{-(u+1)}}{u+1} \, du }{3 y} = \frac{1}{3e}$$

(I substituted $x^2 = y$ so that wolfram would finish the calculation for me. This substitution does not make a qualitative difference in the original)

I think the key difference is that in the first version, the branch point is $t=0$, and Mathematica focuses on the behavior there -- which is inherently weird and strange because it's a branch point (and given that, I'm not sure if using the result leads to computing something correct but strange, or something ill-defined). But in the second version, the branch point is at $u=-1$, but Mathematica still focuses on $u=0$ so it gets sane results.

-

Mathematica is wrong because everything in sight is positive.

Unfortunately I cannot say what Mathematica is doing wrong.

-
+1 I did it in Maple 16, and it gave me $e^{-1}/3$. –  Babak S. Jan 15 '13 at 17:02
That hurts: I hate (teaching) Maple!! –  Jp McCarthy Jan 15 '13 at 17:03
Poor Maple. Without it I will be lost. :D –  Babak S. Jan 15 '13 at 17:04
Maple's what they use at the community college I attend... What's so bad about it? –  apnorton Jan 15 '13 at 17:15
@anorton Actually nothing imo. I like it. –  MyUserIsThis Jan 15 '13 at 17:33

For a simple check of your answer, note that the integrand at $t=1$ is $\frac 1e$ , continuous and slowly varying. The integral is very close to $\frac {x^2}e$, supporting your answer.

-

Limit[Integrate[Exp[-t]/t, {t, 1, 1 + x^2}, Assumptions -> x \[Element] Reals]/(3 x^2), x -> 0] yields the correct $\frac1{3e}$. Putting the assumptions on the Limit instead of the Integrate returns the same erroneous answer: $\frac13\left(-1+\frac1e\right)$

-