Re: Re: Integrate vs NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg47000] Re: Re: Integrate vs NIntegrate
- From: "Mukhtar Bekkali" <mbekkali at iastate.edu>
- Date: Fri, 19 Mar 2004 01:35:53 -0500 (EST)
- Organization: Iowa State University
- References: <c31ca3$7kk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Actually, it worked for me in 4.2, but I since upgraded to 5.0 and it does not now. I found a workaround though. "Reza Malek-Madani" <research at usna.edu> wrote in message news:c31ca3$7kk$1 at smc.vnet.net... > This worked for me on Mathematica 4.2: > > f = D[1/(1 + (1 + (a - b)^2)), a]; > h[a_] := NIntegrate[f*b*(1 - b)^2, {b, 0, 1}]; > FindRoot[h[a] == 0, {a, 0, 1}] > > Output: > > {a -> 0.397861} > > Reza > > > > > ------------------------------------------------------------------------- > Reza Malek-Madani, Director of Research and Scholarship > Research Office, MS 10m, Nimitz Room 17 > > 589 McNair Road > U.S. Naval Academy > Annapolis MD 21402-5031 > > Phone: 410-293-2504 (FAX -2507), DSN: 281-2504 > Email: research at usna.edu > > -------------------------------------------------------------------------- > >>> "Curt Fischer" <crf3 at po.cwru.edu> 03/12/04 11:39 PM >>> > Mukhtar Bekkali wrote: > > I am confused why NIntegrate misbehaves on such a simple function as > > mine. > > > > Here is what I have: > > > > In: > > > > f=D[1/(1+(1+(a-b)^2)),a]; > > g=Integrate[f*b*(1-b)^2,{b,0,1},Assumptions->0<a<1]; > > FindRoot[g==0,{a,0,1}] > > > > Out: > > > > a->0.397207 > > > > However, since Integrate takes long, I tried to use NIntegrate > > instead and this is what I get > > > > In: > > > > f=D[1/(1+(1+(a-b)^2)),a]; > > g:=NIntegrate[f*b*(1-b)^2,{b,0,1}]; > > FindRoot[g==0,{a,0,1}] > > > > Out: > > > > a->1 > > > > or, FindRoot+NIntegrate give me the upper boundary of a. If I > > abandon the secant method and turn to Newton, i.e. use > > FindRoot[g==0,{a,0.5}] instead then I get the message that Jacobian is > > singular at a=0.5 and get no solution. Perturbing the starting value > > of a does not help. > > > > What is going on here? > > My guess is that NIntegrate does not do problems with symbolic > parameters, > and yet you are trying to make it calculate the integral of an > expression > involving a, with no numerical value for a defined. > > -- > Curt Fischer > > > > > > > > PS. Is there a way to get M5 to tackle the problem where: > > (1) I define some function f[x]:=NIntegrate[g[x,y],{y,0,1}], then > > (2) take the derivative of f[x] with respect to x, say h[x]:=f'[x] > > and then (3) Use FindRoot to find x such that h[x]==0 > >