Re: Integrate vs NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg46877] Re: Integrate vs NIntegrate
- From: "Curt Fischer" <crf3 at po.cwru.edu>
- Date: Fri, 12 Mar 2004 23:39:23 -0500 (EST)
- References: <c2ro7b$p7a$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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