Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FindRoot cannot find obvious solution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47828] Re: [mg47806] FindRoot cannot find obvious solution
  • From: Anton Antonov <antonov at wolfram.com>
  • Date: Wed, 28 Apr 2004 06:56:21 -0400 (EDT)
  • References: <200404270847.EAA18892@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Mukhtar Bekkali wrote:

>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
>
>  
>
You can try this:


In[158]:=
Clear[f, g, s, y, x]
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[s_, (y_)?NumericQ] := NIntegrate[s, {x, 0, 1}];
FindRoot[g[s, y] == 0, {y, 0.35, 0.45}]


Out[165]=
{y -> 0.3993706824894056}


The reason why  NIntegrate gives  "inum"messages is explained at
http://support.wolfram.com/mathematica/mathematics/numerics/nsumerror.html

Anton Antonov
Wolfram Research, Inc.


  • Prev by Date: Re: FindRoot cannot find obvious solution
  • Next by Date: Re: The unstable LinearSolve
  • Previous by thread: FindRoot cannot find obvious solution
  • Next by thread: Re: FindRoot cannot find obvious solution