# Computing an integral in Mathematica

**URL:** <https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763>\
**Category:** Questions\
**Tags:** mathematica, calculus\
**Created:** [August 30, 2021, 2:31pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763 "2021-08-30T14:31:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mekhfi](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mekhfi](https://community.wolfram.com/u/mekhfi)\
**Post date:** [August 30, 2021, 2:31pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/1 "2021-08-30T14:31:34Z")

</div>

Mathematica is unable to compute the following integral

```
(1/(2*Pi))*Integrate[Exp[-(I[n + \[Lambda]]*t)]*Exp[Exp[It]], {t, -Pi, Pi}]

```

Unless I ask it how to do. First expand the first exponential then make the integration (simple) and finally perform a summation to collect the terms. The result is then

```
-((Sin[Pi*(\[Lambda] + n)]*Gamma[-n - \[Lambda], 0, 1])/Pi)

```

Conclusion: if I am correct where then is the computational power of Mathematica ? I confess that I am not a heavy user of Mathematica.

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [August 30, 2021, 4:39pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/2 "2021-08-30T16:39:30Z")

</div>

What is `I[n + \[Lambda]]`? `I` is not a function.

---

<div class="post-metadata">

**Author:** ![mekhfi](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mekhfi](https://community.wolfram.com/u/mekhfi)\
**Post date:** [August 30, 2021, 4:52pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/3 "2021-08-30T16:52:40Z")

</div>

This is the integral to evaluate

```
(1/(2*Pi))*
 Integrate[Exp[-(I*(n + \[Lambda])*t)]*Exp[Exp[t]], {t, -Pi, Pi}]

```

---

<div class="post-metadata">

**Author:** ![mariuszi28cg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mariuszi28cg/32/308_2.png) [@mariuszi28cg](https://community.wolfram.com/u/mariuszi28cg)\
**Post date:** [August 31, 2021, 2:54pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/4 "2021-08-31T14:54:24Z")

</div>

Looks like :

```
Integrate[(1/(2*Pi))*Exp[-(I*(n + \[Lambda])*t)]*Exp[Exp[t]], {t, -Pi, Pi}] ==
((-1)^(I (n + \[Lambda])) (-Gamma[-I (n + \[Lambda]), -E^\[Pi]] + 
Gamma[-I (n + \[Lambda]), -Cosh[\[Pi]] + Sinh[\[Pi]]]))/(2 \[Pi])

```

We can check:

```
f[n_, \[Lambda]_] := 
 NIntegrate[(1/(2*Pi))*Exp[-(I*(n + \[Lambda])*t)]*
 Exp[Exp[t]], {t, -Pi, Pi}, Method -> "LocalAdaptive", 
 WorkingPrecision -> 25];
 g[n_, \[Lambda]_] := ((-1)^(
 I (n + \[Lambda])) (-Gamma[-I (n + \[Lambda]), -E^\[Pi]] + 
 Gamma[-I (n + \[Lambda]), -Cosh[\[Pi]] + Sinh[\[Pi]]]))/(
 2 \[Pi]); N[g[1, 1] - f[1, 1], 20]

  (*0.*10^-18 + 0.*10^-19 I*) (* Looks good *)

```

Mathematica is not a [magic box](https://www.12000.org/my_notes/CAS_integration_tests/reports/summer_2021/inch1.htm#x2-10001) that’ll spit out a solution to any problem.

All computer algebra systems, including Mathematica, are **limited** in their capabilities.

---

<div class="post-metadata">

**Author:** ![mekhfi](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mekhfi](https://community.wolfram.com/u/mekhfi)\
**Post date:** [September 1, 2021, 9:58pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/5 "2021-09-01T21:58:44Z")

</div>

Thanks for the answer. I would like to know if, in calculating the integral above, you expanded the exponential and summarized the terms as I did (by the way, this is the smartest way to do such an integration) or if there is another way to do it that might be relevant in some circumstances.  
NB( A write error occurs in the integral above now it is corrected : Exp[Exp[It]])

---

<div class="post-metadata">

**Author:** ![mariuszi28cg](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mariuszi28cg/32/308_2.png) [@mariuszi28cg](https://community.wolfram.com/u/mariuszi28cg)\
**Post date:** [September 2, 2021, 6:15pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/6 "2021-09-02T18:15:46Z")

</div>

Yes, I expanded the exponential and summarized the terms as you did.

```
Sum[Integrate[(1/(2*Pi))*Exp[-(I*(n + \[Lambda])*t)]*(Exp[t])^j/
   j!, {t, -Pi, Pi}], {j, 0, Infinity}]

(*-(((-1)^(I n + 
   I \[Lambda]) (Gamma[-I n - I \[Lambda], 0, -E^-\[Pi]] - 
    Gamma[-I (n + \[Lambda]), 0, -E^\[Pi]]))/(2 \[Pi]))*)

```

---

<div class="post-metadata">

**Author:** ![mekhfi](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@mekhfi](https://community.wolfram.com/u/mekhfi)\
**Post date:** [September 2, 2021, 10:22pm UTC](https://community.wolfram.com/t/computing-an-integral-in-mathematica/18763/7 "2021-09-02T22:22:45Z")

</div>

Ok, Bye.
