# Why can't Wolfram Alpha calculate $\int_0^{2\pi}\sqrt{(a-\cos\theta)^2+\sin^2\theta}\ d\theta$?

In this answer to How is the average distance between 2 objects orbiting around a third object calculated? I had to integrate

$$\int_0^{2 \pi}\sqrt{(a-\cos \theta)^2 + \sin^2 \theta} \ d\theta.$$

I tried to find the integral analytically with Wolfram Alpha but it returned an error message:

Standard computation time exceeded...

which surprised me; I'd figured that this was known and easily looked-up by the site.

Does this mean that there is no known analytical form for this definite integral? Or for some reason is it particularly challenging? • The result is nasty! Assuming $a$ is real, we have $$\fbox{2 \left(\sqrt{(a-1)^2} E\left(-\frac{4 a}{(a-1)^2}\right)+\sqrt{(a+1)^2} E\left(\frac{4 a}{(a+1)^2}\right)\right)\text{ if }\Re((a-2) a)>-1\land \Re(a (a+2))>-1}$$
– Moo
Jul 18, 2020 at 13:57
• If you need approximation formulae, let me know. Jul 18, 2020 at 13:58
• @Moo "The result is nasty" is essentially the answer, thanks! ;-)
– uhoh
Jul 18, 2020 at 14:12
• @uhoh. The result is not nasty at all. Jul 18, 2020 at 14:34
• wolframalpha.com/input/… gives the result immediately for the antiderivative. Jul 18, 2020 at 15:24

It is not an error message but just "Standard computation time exceeded".

What you should have obtained is $$I=\int_0^{2 \pi}\sqrt{(a-\cos (\theta))^2 + \sin^2 (\theta)} \ d\theta=$$ $$I=2 \left(\sqrt{(a-1)^2} E\left(-\frac{4 a}{(a-1)^2}\right)+\sqrt{(a+1)^2} E\left(\frac{4 a}{(a+1)^2}\right)\right)$$ provided, if $$a$$ is a real, that $$\Re(a (a+2))>-1\land \Re((a-2) a)>-1$$ where appear ellptic integrals of the second kind. In fact, this reduces to $$I=4(a+1)E\left(\frac{4 a}{(a+1)^2}\right)$$

• Wolfram Alpha can certainly handle lengthy expressions, so is the reason that getting to this result is a challenge, requiring a large number of steps, substitutions, or dead-ends from which it must back-track and then try something else? I'm really after the "Why...?" here, thanks!
– uhoh
Jul 18, 2020 at 14:15
• @uhoh. Take the Pro version. It is just because you have limited ressources with the standard version. It is a quite long calculation. Jul 18, 2020 at 14:19
• okay then "It is a quite long calculation" would help round out an answer to my question, ideally supported in some way. That it is long is probably well known to some, but not to others.
– uhoh
Jul 18, 2020 at 14:29
• – uhoh
Jul 19, 2020 at 7:43