I am trying to do a spherical integral in Mathematica:
f[θ_, ϕ_] = (k^4 Cos[θ]^2 Cot[β] Csc[β] Sin[θ]^3 Sin[ϕ]^2)/(
4 (1 + k Cos[θ]) (1 + k Cos[β] Cos[θ] + k Cos[ϕ] Sin[β] Sin[θ])) +
(k^4 Cos[θ] Cos[ϕ] Csc[β] Sin[θ]^4 Sin[ϕ]^2)/(
4 (1 + k Cos[θ]) (1 + k Cos[β] Cos[θ] + k Cos[ϕ] Sin[β] Sin[θ]))
If I try the following:
Integrate[f[θ, ϕ], {ϕ, 0, 2 π}]
Mathematica does not produce an answer. However, if I try to do an analytical integral like this:
g[θ_] = Integrate[f[θ, ϕ], ϕ]
I get an answer very quickly, and that answer differentiates to the integrand I started with. Now I can evaluate the value of the integral I am trying to find by doing:
g[2 π] - g[0]
My question is twofold:
- Why is this happening in Mathematica? I assume it is because the algorithms for finding a definite and indefinite integrals are different.
- Is this a valid way of doing the integral in this case (and others)? I am asking because the end result does not agree with a purely numerical integral over the sphere, and this might be the source of error.
Assuming[]
. $\endgroup$0 < k <1
, then you don't need to put ink ∈ Reals
, since your use of the inequality already imposes that condition. $\endgroup$