# When does WolframAlpha refuse to give the precise value?

I was computing the length of the curve $y=e^x$ between $x=1$ and $x=2$. When I input "arc length of e^x between 1 and 2" into WolframAlpha, it gives me only an approximation as follows:

However, using calculus, one obtains the precise value of the length:

$$\sqrt{1+e^4}+2^{-1}\log\frac{\sqrt{1+e^4}-1}{\sqrt{1+e^4}+1}-\sqrt{1+e^2}-2^{-1}\log\frac{\sqrt{1+e^2}-1}{\sqrt{1+e^2}+1}.$$

Is this result too complicated for WolframAlpha so that WolframAlpha can only give an approximation? More generally, when does WolframAlpha refuse to give the precise value?

• Wolfram alpha is complicated and it's hard to say. Sometimes when you feel it 'should' know the exact answer, if you go to open code, it will give it to you. In this case, it gives me the exact answer when I just rephrase the question: wolframalpha.com/input/… – spaceisdarkgreen Sep 7 '18 at 2:24
• @spaceisdarkgreen, this is interesting: our questions are exactly equivalent (and WolframAlpha knows it!) but in one case one only gets approximations while in another case one gets a precise answer. – Zuriel Sep 7 '18 at 2:27
• Yeah, it's weird. The open code is more deterministic (it is basically just a restricted version of mathematica). – spaceisdarkgreen Sep 7 '18 at 2:28

The input

arc length of e^x between 1 and 2

invokes an additional step where Wolfram Alpha needs to parse the meaning of "arc length," and it formulates an integral of the function $e^x$ over a suitable interval. When you open the code that Wolfram Alpha generates--in essence, its interpretation of your input--you will find that it invokes NIntegrate[] rather than Integrate[], which explains why your output does not contain the symbolic computation in closed form, only the numeric output.

This also explains why if you use the word "Integrate" in your input, Wolfram Alpha will parse that as you wanting the output of some Integrate[] expression.

Generally speaking, if I were to use Wolfram Alpha, I would attempt to phrase my input in the Wolfram language as much as possible. The natural language processing capabilities are impressive, but as you can see, they do not--indeed, cannot--lend themselves to a precise level of control, nor an unambiguous input.

• Thank you so much! Your answer is very clear and helpful. – Zuriel Sep 8 '18 at 1:18

What is "amazing" is that, typing in Wolfram Alpha

integrate sqrt(1+e^(2x))

we properly obtain $$\sqrt{e^{2 x}+1}-\tanh ^{-1}\left(\sqrt{e^{2 x}+1}\right)$$

and typing

integrate sqrt(1+e^(2x)) from x=1 to x=2

we properly obtain $$-\sqrt{1+e^2}+\sqrt{1+e^4}+\tanh ^{-1}\left(\sqrt{1+e^2}\right)-\tanh ^{-1}\left(\sqrt{1+e^4}\right)\approx 4.7852 +0. \times 10^{-6} \,i$$

• What is the "$0.\times 10^{-6}i$" part? The result is obviously a real number. – Zuriel Sep 8 '18 at 1:18
• @Zuriel. This is what WA returns as an apptoximation of the result ! Type integrate sqrt(1+e^(2x)) from x=1 to x=2 to see it. – Claude Leibovici Sep 8 '18 at 1:57
• Thank you! I do not see the point of approximating a real number by an expression with an imaginary that is zero. – Zuriel Sep 8 '18 at 2:37
• @Zuriel $\tanh^{-1}(\sqrt{1+e^2})$ and $\tanh^{-1}(\sqrt{1+e^4})$ are presumably numerically evaluated independently of one another and then combined. Notice when $x>1$ the $\tanh^{-1}(x)$ has an imaginary part of $\pi/2$. – spaceisdarkgreen Sep 8 '18 at 7:19
• @spaceisdarkgreen, that's true. On the other hand, it should be obvious to WA (at least it is obvious to me) that "integrate sqrt(1+e^(2x)) from x=1 to x=2" yields a real number. – Zuriel Sep 8 '18 at 14:09