This is, so to say, the next part of the question: Nested NIntegrate - NIntegrate::inum: - error

Now I define three functions:

r[x_] := q[x] /. NDSolve[{q'[t] == 0.0001 + (-1 + I*1 + q[t])*q[t], q[0] == 0}, q, 
   {t, 0, 50}][[1]]

beta = 1;

fn[k_, t_?NumericQ] := Exp[8*NIntegrate[r[s]*Exp[2*beta*1] + 8*r[s], {s, t, k}]]

f00[x_, t_, p_] := 
   p*Exp[-8*NIntegrate[r[s]*Exp[2*beta*1] - 8*r[s], {s, t, x}]] + 
   8*Exp[-8*NIntegrate[r[s]*Exp[2*beta*1] - 8*r[s], {s, t, x}]]*
      NIntegrate[Exp[2*beta*1]*fn[y, t], {y, t, x}]

When I evaluate

f00[20, 2, 0.5]

I obtain the error:

NIntegrate::nlim: s = y is not a valid limit of integration.

The difference between the first question is now both limits of the integral in the definition of fn are variables, and I have to evaluate the integral

NIntegrate[Exp[2*beta*1]*fn[y, t], {y, t, x}] 

What I can do?

  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Feb 22, 2013 at 1:42

1 Answer 1


The only change I needed was

fn[k_?NumericQ,t_?NumericQ] := Exp[8*NIntegrate[r[s]*Exp[2*beta*1] + 8*r[s], {s, t, k}]]

After this change, Mathematica returned no error.

Please note, that your original version already returned the same results although the error message was printed.


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.