Re: Re: FindRoot cannot find obvious solution
- To: mathgroup at smc.vnet.net
- Subject: [mg47868] Re: [mg47821] Re: FindRoot cannot find obvious solution
- From: Gary.Anderson at frb.gov
- Date: Thu, 29 Apr 2004 03:05:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
the following seems to provide the correct solution. but, you will get a warning that NIntegrate is having trouble because the integral is approximately zero. i think that the code in the original posting may have applied the Replacement Rule for the y before applying the D function. exprGen= Simplify[ With[{h1 = 1 + (yVar - xVar)^2, h2 = 1 + (2/3 - xVar^2)^2}, With[{b = h2/(h1 + h2),f = xVar(1 - xVar)^2}, expr=(f*D[b, yVar])]]] g[yArg_?NumberQ]:= NIntegrate[(expr)/.yVar->yArg,{xVar,0,1}] FindRoot[g[y] == 0, {y, 0.35, 0.45}] "Jens-Peer Kuska" <kuska at informatik.uni- To: mathgroup at smc.vnet.net leipzig-de> cc: Subject: [mg47868] [mg47821] Re: FindRoot cannot find obvious solution 04/28/2004 06:56 AM Hi, and what is with h1 = 1 + (y - x)^2; h2 = 1 + (2/3 - x^2)^2; b = h2/(h1 + h2); f = x(1 - x)^2; s = f*D[b, y]; g[yy_?NumericQ] := NIntegrate[Evaluate[s /. y -> yy], {x, 0, 1}] FindRoot[g[y] == 0, {y, 0.35, 0.45}] Regards Jens "Mukhtar Bekkali" <mbekkali at iastate.edu> schrieb im Newsbeitrag news:c6l872$ire$1 at smc.vnet.net... > Here is my code in Mathematica 5: > > h1=1+(y-x)^2; > h2=1+(2/3-x^2)^2; > b=h2/(h1+h2); > f=x(1-x)^2; > s=f*D[b,y]; > g[y_]:=NIntegrate[s,{x,0,1}]; > FindRoot[g[y]==0,{y,0.35,0.45}] > > The output is > > NIntegrate::inum: Integrand H is not numerical at {x} = {0.5`}. > FindRoot::cvmit: Failed to converge to the requested accuracy or precision > within 100 iteration > > and it gives me y->0.45 or the upper boundary. However, when I plot g[y] I > can see that the solution is somewhere around y=0.4. Using Solve instead of > FindRoot does not give me any solutions. > > What am I doing wrong here? Thank you in advance. Mukhtar Bekkali > >