# Computing integrals in Mathematica

I am trying to actually compute $\int \sqrt{\cosh{y}-\cos{x}}e^{inx} dx$ in mathematica. As an example i tried computing $\int \sqrt{1-\cos{x}}e^{inx} dx$ and got a result. But when i try $\int \sqrt{2-\cos{x}}e^{inx} dx$ i do not get any result. Note that $n\in \mathbb{Z}$. Any fixes please.

The code i used was:

Integrate $\bigg[\sqrt{2-Cos[x]} Exp[i*n*x],x\bigg]$

Integrate[Sqrt[2-Cos[x]]Exp[I n x],x]
• What is the code you used to do those integrals? (no screenshot please; just plaintext code) Jun 23, 2016 at 15:41
• Integrate [\sqrt{(2-Cos[x]} Exp[inx], x]..i actually used square root symbol that is ctrl+2 in mathematica Jun 23, 2016 at 15:43
• @user69312 Would you add the code (properly formatted) in your original post? You can edit your post using the "edit" link right under it on the left. Here are some guidelines for posting fancy-formatted code so that it remains readable in this site: meta.mathematica.stackexchange.com/q/1584/27951 Jun 23, 2016 at 15:44
• i have updated the post with the code..thanks Jun 23, 2016 at 15:53
• Do you have reason to believe that this integral can be computed analytically? If not, then use NIntegrate. What are the conditions on n? Jun 23, 2016 at 16:16

The function cannot be integrated with unknown n, because its form changes with different values for n:

Table[Integrate[Sqrt[2 - Cos[x]] Exp[I n x], x], {n, 0, 3}]

1:

2 EllipticE[x/2, -2], 1/3 (-4 EllipticE[x/2, -2] + 6 EllipticF[x/2, -2] - I Sqrt[2 - Cos[x]] (-5 + 2 Cos[x/2]^2 + Cos[x] + 2 I Sin[x]))

2:

2/15 (I + Cot[x]) (13 Sqrt[3] Sqrt[-1 + Cos[x]] Sqrt[1 + Cos[x]] EllipticE[ArcSin[Sqrt[2 - Cos[x]]], 1/3] (Cos[x] - I Sin[x]) - 5 Sqrt[3] Sqrt[-1 + Cos[x]] Sqrt[1 + Cos[x]] EllipticF[ArcSin[Sqrt[2 - Cos[x]]], 1/3] (Cos[x] - I Sin[x]) + Sqrt[2 - Cos[x]] (8 - 8 Cos[2 x] + 4 I Sin[x] + 5 I Sin[2 x]))

3:

1/35 Csc[x] (Cos[(3 x)/2] + I Sin[(3 x)/2]) (132 Sqrt[3] Sqrt[-1 + Cos[x]] Sqrt[1 + Cos[x]] EllipticE[ArcSin[Sqrt[2 - Cos[x]]], 1/ 3] (Cos[(3 x)/2] - I Sin[(3 x)/2]) - 50 Sqrt[3] Sqrt[-1 + Cos[x]] Sqrt[1 + Cos[x]] EllipticF[ArcSin[Sqrt[2 - Cos[x]]], 1/ 3] (Cos[(3 x)/2] - I Sin[(3 x)/2]) + Sqrt[2 - Cos[x]] (85 Cos[x/2] - 14 Cos[(3 x)/2] - 71 Cos[(5 x)/2] - 39 I Sin[x/2] + 22 I Sin[(3 x)/2] + 61 I Sin[(5 x)/2]))

• Nevertheless I suspect that one can derive a recurrence relation for these elliptic integrals... (assuming integer $n$) Jun 23, 2016 at 17:53
• @J.M. Sure, there are definitely patterns in the solutions, but then he should at least define $n\in\mathbb{Z}$, and even then, is that something you could easily get from Mathematica in this case? Jun 23, 2016 at 18:00
• @J.M. , Assumptions -> n \[Element] Integers does nothing. Jun 23, 2016 at 18:02
• Not really; my experience with elliptic integrals in Mathematica is not very rosy. The expressions returned tend to be more complicated than they have to be, so I fall back on semi-manual derivation (using Mathematica only for tedious algebra), with the guidance of Byrd/Friedman. Jun 23, 2016 at 18:13
• Thank u all for your insights and yes n ∈ Z..I agree it gets tedious with elliptic functions. Jun 23, 2016 at 18:47