Context
On a possible non trivial toric topology for the Universe (nothing less!).
Problem
I would like to carry out the following integral for $\ell=2,4\cdots 20$.
$$\int _0^{\pi }\int _0^{2 \pi } \sin(\theta ) P_{\ell }\left(\frac{1}{2} \sin(\theta ) (\cos(\phi )-\sin(\phi ))\right) P_{\ell }\left(\frac{1}{2} \sin(\theta ) (\cos(\phi )+\sin (\phi ))\right) \times $$ $$P_{\ell }\left(\frac{\sin (\theta ) ((K+1) \cos (\phi )+(1-K) \sin (\phi ))}{2 \sqrt{K^2+2 \mu K+1}}\right)d\phi d\theta$$ where $P_\ell$ are Legendre Polynomials.
For $\ell$ larger than say 8, Mathematica takes forever and runs out of memory. I have found out a method to circumvent the memory problem (see attempt below) but it still takes very long time to carry out the integration for $\ell>10$.
Question
Is there a way to be smart about this class of integral? Another approach to the one below?
Attempt
I have defined the integrant as
integ[ℓ_] :=
LegendreP[ℓ, (Cos[p] - Sin[p]) Sin[t]/
2] LegendreP[ℓ, (Cos[p] + Sin[p]) Sin[t]/
2] LegendreP[ℓ, ((1 + K) Cos[p] + (1 - K) Sin[p]) Sin[
t]/2/Sqrt[1 + 2 K μ + K^2]] Sin[t]
And the following integration rule:
r1 = {Exp[ Complex[0, b_] t + p Complex[0, c_] ] ->
Integrate[Exp[ I b t + I c p], {t, 0, Pi}, {a, 0, 2 Pi}],
Exp[ Complex[0, b_] t ] ->
Integrate[Exp[ I b t], {t, 0, Pi}, {a, 0, 2 Pi}],
Exp[ p Complex[0, c_] ] ->
Integrate[Exp[ I c p], {t, 0, Pi}, {a, 0, 2 Pi}]}
so that I expand my integrant into sines and cosines into complex exponentials, and carry out the integration via substitution:
integ[2] // TrigToExp // Expand //
Collect[#, Exp[_]] & // (# /. r1) & // Apart // Simplify
(*-((Pi*(43*K^2 + 84*K*μ + 43))/
(560*(K^2 + 2*K*μ + 1))) *)
A simple timing
Table[{i, integ[i] // TrigToExp // Expand //
Collect[#, Exp[_]] & // (# /. r1) & // Apart //
Simplify;//Timing}, {i, 2, 6,2}]
suggest a $n^{4.5}$ scaling.
LegendreP
? $\endgroup$NIntegrate
? $\endgroup$