The following numerical integral within a numerical integral:

NIntegrate[ Exp[
-NIntegrate[ 1/(y - (1 - Exp[-(5/6) + (2 y)/3])), 
{y, z, 1}]] , 
{z, -(3/2) ProductLog[-(2/(3 E^(5/6)))], 1}]

gives "NIntegrate::nlim: y = z is not a valid limit of integration" error messages prior to giving an estimate 0.250255.

How might I revise my code to avoid the errors? If the estimate is not valid, please explain why to me. Thank you!


1 Answer 1


To ensure that the inner integral never attempts to evaluate before z has a numeric value, use

int1[z_?NumericQ] :=
 NIntegrate[1/(y - (1 - Exp[-(5/6) + (2 y)/3])), {y, z, 1}]

int2 = NIntegrate[Exp[-int1[z]], 
 {z, -(3/2) ProductLog[-(2/(3 E^(5/6)))], 1}]

(* 0.250255 *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.