# 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