Re: Using NIntegrate[] within FindRoot[] ??
- To: mathgroup at smc.vnet.net
- Subject: [mg2328] Re: Using NIntegrate[] within FindRoot[] ??
- From: wagner at goober.cs.colorado.edu (Dave Wagner)
- Date: Tue, 24 Oct 1995 02:15:11 -0400
- Organization: University of Colorado, Boulder
In article <DGvx8w.B2J at wri.com>, Axel Kowald <a_kowald at chemie.fu-berlin.de> wrote: > >Hello everybody > > >I like to use NIntegrate with FindRoot as in the following trivial example: > > FindRoot[NIntegrate[r x,{x,0,3}] == 9, {r,1}] > >That means I want to find the value of "r" for which the integral is equal to 9. >However, I get the error message: > > Integrand 1.5 r is not numerical ... > >What am I doing wrong and how am I doing it right ??? You are using FindRoot on an expression whose symbolic derivative with respect to r cannot be computed. To get around this problem, give FindRoot two initial points, rather than one, so that it uses the secant method of root-finding. In[6]:= FindRoot[NIntegrate[r x,{x,0,3}] == 9, {r,1,1.1}] Out[6]= {r -> 2.} Dave Wagner Principia Consulting (303) 786-8371 dbwagner at princon.com http://www.princon.com/princon