Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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! – Dr. belisarius Feb 22 '13 at 1:42
up vote 2 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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