FindRoot[ NIntegrate[...] ...] works but generates "NIntegrate::nlim" limit error message!?
- To: mathgroup at smc.vnet.net
- Subject: [mg72493] FindRoot[ NIntegrate[...] ...] works but generates "NIntegrate::nlim" limit error message!?
- From: "William McHargue" <William at McHargue.Org>
- Date: Wed, 3 Jan 2007 00:46:58 -0500 (EST)
Hello, I wish to solve for an integration result to equal a given value while varying the upper limit of the integration. It seems a straightforward thing to do, and in fact it finds the numerical answer, but it generates an error message at the beginning of the root solving operation. I create a function to perform a numerical integration with a passed upper limit of integration: In[1]:= integralFunction[upperLimit_] := NIntegrate[x, {x, 0, upperLimit}] Then I create a function to find a result of this integration that equals a supplied value with the upper limit of integration as the independent variable: In[2]:= rootOfIntegralFunction[solveForValue_] := FindRoot[integralFunction[u] == solveForValue, {u, 1}, EvaluationMonitor :> Print[u]] (I use the EvaluationMonitor to print the value of "u" as it searches for the solution.) When I execute the following I get an error message, yet it finds the correct result: In[3]:= rootOfIntegralFunction[12.5] NIntegrate::nlim : x = u is not a valid limit of integration. More... 1. 13. 2.2 6.78182 4.3982 5.04117 5.00017 5. 5. Out[3]= {u->5.} If anyone has any insight into this behavior please let me know. Thank you! Bill.