# An integral problem with Sin and Cos

I have a difficulty in calculating the following integral with Mathematica:

$$\int^{\pi}_{0}\rm d\theta_1\frac{ \sin^2\theta_1[2(2-\cos\theta_1\cos\theta)^2+(\sin\theta\sin\theta_1)^2]}{[(2-\cos\theta_1\cos\theta)^2-(\sin\theta\sin\theta_1)^2]^{5/2}},$$ where $$\pi>\theta>0$$.

Here is the code:

Integrate[Sin[th1]^2*(2*(2 - Cos[th]*Cos[th1])^2 + (Sin[th]*Sin[th1])^2)/((2 - Cos[th]*Cos[th1])^2 - (Sin[th]*Sin[th1])^2)^(5/2), {th1, 0, Pi}]

• RubiInt can evaluate analytically the indefinite integral with respect to $\theta_1$, involved with EllipticE. – Αλέξανδρος Ζεγγ Dec 22 '18 at 11:20

If numerical solution is sufficient:

int[th_?NumericQ] :=NIntegrate[Sin[th1]^2*(2*(2 - Cos[th]*Cos[th1])^2 +(Sin[th]*Sin[th1])^2)/((2 - Cos[th]*Cos[th1])^2 - (Sin[th]*Sin[th1])^2)^(5/2)
, {th1, 0, Pi}]

Plot[int[th], {th, 0, Pi}, PlotRange -> {0, 1}]


• Thanks for your answer. Yes, numerical solution can be obtained. However, I think there is analytical solution, because when I use "nlm = NonlinearModelFit[data, a1 + a2*Sin[x] + a3*Sin[x]^2 + a8/(1 + a9^2*Sin[x]), {a1, a2, a3, a8, a9}, x]" to fit the numerical solution, the fitted curve is almost 100% same as the numerical curve as you plotted. So I better try to find this analytical solution. – Qin-Tao Song Oct 24 '18 at 2:15
• @Qin-TaoSong Usually the Weierstrass substitution th1->2 ArcTan[u1] helps for solving this kind of integral – Ulrich Neumann Oct 24 '18 at 7:21
• Thanks, I will try it – Qin-Tao Song Oct 25 '18 at 12:17

Making use of

f[x_?NumericQ] =  NIntegrate[ Sin[th1]^2*(2*(2 - Cos[x]*Cos[th1])^2 + (Sin[x]*
Sin[th1])^2)/((2 - Cos[x]*Cos[th1])^2 - (Sin[x]*Sin[th1])^2)^(5/2), {th1, 0, Pi}]


,one obtains

f[Pi/4]


0.676581

and

Plot[f[x], {x, 0, Pi}]


• Shouldn't the assignment be delayed? as in, := instead of =? – AccidentalFourierTransform Oct 23 '18 at 15:58
• Thanks a lot, numerical solution can be obtained. – Qin-Tao Song Oct 24 '18 at 2:16

The simplest answer I could come up with is

((Sqrt[2]*
Sqrt[5 + Cos[2*\[Theta]] + 4*I*Sqrt[3]*Sin[\[Theta]]])/(9*(7 -
Cos[2*\[Theta]])))*(2*(3 - 2*I*Sqrt[3]*Sin[\[Theta]])*
EllipticK[-((I*8*Sqrt[3]*Sin[\[Theta]])/(5 + Cos[2*\[Theta]] -
I*4*Sqrt[3]*Sin[\[Theta]]))] -
I*(7 - Cos[2*\[Theta]])*
EllipticE[
1 - (I*8*Sqrt[3]*Sin[\[Theta]])/(5 + Cos[2*\[Theta]] +
I*4*Sqrt[3]*Sin[\[Theta]])]) - ((Sqrt[2]*
Sqrt[5 + Cos[2*\[Theta]] - 4*Sqrt[3]*I*Sin[\[Theta]]])/(9*(7 -
Cos[2*\[Theta]])))*
(8*Sqrt[3]*Sin[\[Theta]]*
EllipticK[
1 - (I*8*Sqrt[3]*Sin[\[Theta]])/(5 + Cos[2*\[Theta]] +
I*4*Sqrt[3]*Sin[\[Theta]])] -
I*(7 - Cos[2*\[Theta]])*
EllipticE[
1 + (I*8*Sqrt[3]*Sin[\[Theta]])/(5 + Cos[2*\[Theta]] -
I*4*Sqrt[3]*Sin[\[Theta]])])
`

I have no idea how to treat the complex moduli further...

• You did this by hand, or by Mathematica? – Michael E2 Jan 3 at 22:34
• @MichaelE2 using Mathematica and giving some help with simplification – Andreas Jan 3 at 22:37
• Can you show what you did? – Michael E2 Jan 3 at 22:38
• @MichaelE2 It was quite involved: used Ulrich Neumann's substitution to calculate the antiderivative, then (the hard part) find the upper limit at u1->Infinity using Series[antiderivative,{u1,Infinity,0}] and then helped Mathematica simplifying a v_e_r_y large expression – Andreas Jan 3 at 22:53
• I guess what I'm trying hint in my second comment is that the answer seems incomplete as is. Unless all one is interested is the result. But the output does not help me learn how to use Mathematica. – Michael E2 Jan 3 at 23:03