# Is there a workaround for this integral?

The command

Integrate[Exp[a*Exp[I*x]], {x, -Pi, Pi}]


produces

ConditionalExpression[0, a == 0]

which is not correct in view of

Integrate[1, {x, -Pi, Pi}]


2 π

The result should be equal to $2\pi$ for each complex number $a$. The question arises: is there a workaround for this integral?

• Can we consider this a bug? – Αλέξανδρος Ζεγγ Sep 17 '18 at 8:27
• Integrate[Exp[a*Exp[I*x]], {x, -Pi, Pi}, Assumptions -> a == 0] ? – Mariusz Iwaniuk Sep 17 '18 at 9:07
• @Mariusz Iwaniuk: Thank you. Unfortunately, this works only for $a=0$. Tha command Integrate[Exp[aExp[Ix]], {x, -Pi, Pi}, Assumptions -> Re[a] != 0] outputs $0$. – user64494 Sep 17 '18 at 11:24
• @Mariusz Iwaniuk:: The parameter $a$ is assumed to be complex, so $a \neq 0$ is not equivaltnt to $a>0 \vee a < 0$. – user64494 Sep 17 '18 at 15:14
• Rubi returns zero as well. – b.gates.you.know.what Sep 18 '18 at 7:12

One workaround is to shift the main computation from integration to summation. Start from Taylor series for a and get a general SeriesCoefficient, which is much simpler and integrates nicely:

Integrate[SeriesCoefficient[Exp[a Exp[I x]], {a, 0, n}], {x, -Pi, Pi}]


We switched the order of summation and integration. Now what is left is to sum back:

Sum[(2 Sin[n π])/(n n!) a^n,{n,0,∞}]

Out[]= 2 π


This is also quite clear from the fact that for all n>=0 all terms are zero. And the only contributing n=0 term is equal to:

Limit[(2 Sin[n π])/(n n!) a^n,n->0]


Out[]= 2 π

• Please notice that your sum has only one contribution, the term corresponding to n=0. – b.gates.you.know.what Sep 17 '18 at 10:18
• @b.gatessucks yep, I added it for clarity. I think OP wants Mathematica to figure it out automatically in the least number of steps :-) – Vitaliy Kaurov Sep 17 '18 at 11:08
• The only place I dislike is Limit[(2 Sin[n π])/(n n!) a^n,n->0] =2*Pi. – user64494 Sep 17 '18 at 11:29
• I find SeriesCoefficient[Exp[a Exp[I x]], {a, 0, 0}] to be a better way. – user64494 Sep 17 '18 at 11:35
• It should be noticed that the workaround suggested by you does not fix the bug. – user64494 Sep 17 '18 at 11:40

One can use the fact that:

D[Exp[a Exp[I x]], x ] === I a D[Exp[a Exp[I x]], a ]
(* True *)


to integrate by parts and get zero: $$int(a) \equiv \int_{-\pi}^{\pi} dx\ e^{a\ e^{i\ x}}$$ \begin{eqnarray*} \frac{d}{d a} int(a) & = & \int_{-\pi}^{\pi} dx\ e^{i\ x}\ e^{a\ e^{i\ x}} \\ & = & \frac{1}{i a} \int_{-\pi}^{\pi} dx\ \frac{d}{dx} e^{a\ e^{i\ x}} \\ & = & \frac{1}{i a}\ \left[e^{a\ e^{i\ x}} \right]_{-\pi}^{\pi} \\ & = & 0 \end{eqnarray*}

Therefore, at least to first order in a, the integral is independent of a and equal to the value at a=0, i.e. 2 Pi.

• Can you elaborate " the integral is independent of a" in details? – user64494 Sep 17 '18 at 11:32
• @user64494 The precedure above proves that the first derivative of the integral with respect to a vanishes. I think it could be proven along the same lines that also higher order derivatives vanish, therefore the integral is a constant function (as you expected). – b.gates.you.know.what Sep 17 '18 at 11:50
• @b.gatessucks : Integration by parts gives \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$-\[Pi]$$, $$\[Pi]$$]$$Exp[ a\ Exp[I\ x]] \[DifferentialD]x$$\) = \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$-\[Pi]$$, $$\[Pi]$$]$$\*FractionBox[\(1$$, $$I\ a$$] $$(Exp[ a\ Exp[I\ x]])$$' \[DifferentialD]x\)\) = 1/(I a) (Exp[a Exp[I \[Pi]]] - Exp[a Exp[-I \[Pi]]]) \!$$\*OverscriptBox[\(=$$, $$?$$]\) 0 seems to confirm the MMA result? Where is my mistake? – Ulrich Neumann Sep 17 '18 at 13:24
• @UlrichNeumann Please see edit. I think that the integral equals 2 \Pi and that Mathematica has a bug. – b.gates.you.know.what Sep 17 '18 at 14:06
• @b.gatessucks Thanks for the edit, very tricky, now I got it! But still I cannot find the error in the conclusion of my comment (sorry, I don't know how to bring it in a nicer shape). – Ulrich Neumann Sep 17 '18 at 14:14

The issue here can be identified by evaluating the indefinite integral,

s = Integrate[Exp[a*Exp[I*x]], x]
(* -I ExpIntegralEi[a E^(I x)] *)


Now,

(s /. x -> Pi) - (s /. x -> -Pi)
(* 0 *)


The catch is that ExpIntegralEi[z] has a branch cut, extending along the negative real axis from zero to negative infinity. So, the correct way to apply the limits, at least for a > 0, is

Limit[s, x -> Pi, Direction -> "FromBelow", Assumptions -> a > 0] -
Limit[s, x -> -Pi, Direction -> "FromAbove", Assumptions -> a > 0]
(* 2 π *)


as desired. I presume, but have not tried to prove, that employing the proper Limit options will yield the desired result for all a. Certainly,

Integrate[Exp[(-141/10 + 397/100 I) Exp[I*x]], {x, -Pi, Pi}]


and every other specific value of a I have tried yields 2 π.

Strange behavior.

$Assumptions = a \[Element] Reals Integrate[Exp[a*Exp[I*x]], {x, -Pi, Pi}] (*ConditionalExpression[0, a >= 0]*) Integrate[Exp[a*Exp[I*x]] // ExpToTrig, {x, -Pi, Pi}] ConditionalExpression[2*Pi, a >= 0]  I would think both should be the same, but no. Also $Assumptions = a > 0

Integrate[Exp[a*Exp[I*x]], {x, -Pi, Pi}]
(*2*Pi*)


A workaround could be the numerical evaluation

int[a_?NumericQ] := NIntegrate[Exp[a*Exp[I*x]], {x, -Pi, Pi}]
{int[0], int[1], int[I]} // Chop
{6.28319, 6.28319, 6.28319}

• Thank you. However, a symbolic result is requiered. – user64494 Sep 17 '18 at 8:38