How can I evaluate an integration with another defined integration inside it? [duplicate]

How can I evaluate an integration with another defined integration inside it? The problem is Sin[θ] has different variable and can not be solved directly.

• Please post your code as text formatted in a code bock. Also please describe in further detail what you are doing and the circumstance of this problem. Commented Jul 31, 2016 at 15:12
• maybe so it be : NIntegrate[Sin[theta]*NIntegrate[Exp[-5/(2*Sin[theta]*Cos[phi])]/( 1 - Exp[-5/(2*Sin[theta]*Cos[phi])]), {phi, 0, Pi}], {theta, 0, Pi}] Commented Jul 31, 2016 at 15:51
• @MariuszIwaniuk you ought to go ahead and edit that into the question Commented Jul 31, 2016 at 15:57
• Do you mean to have the same integration variable in both levels ? Commented Jul 31, 2016 at 17:05

From comment's this User.

f[theta_?NumericQ] := NIntegrate[Exp[-5/(2*Sin[theta]*Cos[phi])]/(1 - Exp[-5/(2*Sin[theta]*Cos[phi])]), {phi, 0, Pi},
WorkingPrecision -> 50]

NIntegrate[Sin[theta]*f[theta], {theta, 0, Pi}, WorkingPrecision -> 50]

(* -3.1415926535897932384626433832795028841971693993751 *)


We can identify the number as:

$-\pi$

Edited:

If You want to solve the orginal Question, then:

f[theta_?NumericQ] := NIntegrate[Exp[-5/(2*Sin[theta]*Cos[phi])]/(
1 - Exp[-5/(2*Sin[theta]*Cos[phi])]), {phi, 0, Pi}]

g[theta_?NumericQ] := NIntegrate[Sin[theta]*f[theta], {phi, 0, Pi}]

func = FunctionInterpolation[g[theta], {theta, -1, 1},
MaxRecursion -> 20] // Quiet;
Plot[func[theta], {theta, -1, 1}]


I can find the equation of the curve, which is on Plot:

data = Table[{theta, func[theta]}, {theta, -1, 1, 0.1}];
fit = FindFormula[data, theta, 4, All]


A constant -4.9348 I can find by integral:

f[theta_?NumericQ] := NIntegrate[
Exp[-5/(2*Sin[theta]*Cos[phi])]/(1 - Exp[-5/(2*Sin[theta]*Cos[phi])]),   {phi, 0, Pi}, WorkingPrecision -> 50]

NIntegrate[f[theta], {theta, 0, Pi}, WorkingPrecision -> 50] // Quiet
(* -4.9348022005446793094172454999380755676568497036204 *)


We can identify the number as:

$-\frac{\pi ^2}{2}$

and Yours integral is:

$-\frac{1}{2} \pi ^2 \sin (\theta )$