MathGroup Archive 2003

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

Search the Archive

Re: FindRoot in 5.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42835] Re: FindRoot in 5.0
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 30 Jul 2003 19:30:26 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <bg7vqq$hj5$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

func[x_?NumericQ]:=(y=x;NIntegrate[BesselY[1/2,s],{s,1/2,y}])

will fix the problem in version 5.0, and you many
use the StepMonitor option to show the progress

FindRoot[func[x]),{x,2,4}],StepMonitor:>Print[x]]

Regards
  Jens

Eric Mockensturm wrote:
> 
> I realize that FindRoot has changed but there seems to be a
> fundamental difference in it between pre-5.0 versions and 5.0 that
> breaks most of my notebooks.  Maybe I've been following bad
> 'programming' practices all these years, but....
> 
> Anyway, a simple illustration follows.
> 
> In 4.2:
> 
> In[7]:=func[x_]:=(y=x;NIntegrate[BesselY[1/2,s],{s,1/2,y}])
> In[8]:=FindRoot[(Print[x];func[x]),{x,2,4}]
> Out[8]={x\[Rule]3.04729}
> 
> In 5.0:
> 
> In[1]:=func[x_]:=(y=x;NIntegrate[BesselY[1/2,s],{s,1/2,y}])
> In[2]:=FindRoot[(Print[x];
> Out[2]={x\[Rule]4.}
> 
> with errors...
> 
> NIntegrate::nlim: s = x is not a valid limit of integration
> 
> It seems that 5.0 is trying to evaluate func[x] symbolically before
> start to search for a root.  How do I make a global change to this
> behavior.  Does it have something to do with the HoldAll attribute?
> FindRoot was been HoldAll in 4.2, too.


  • Prev by Date: Re: Page preview in Mathematica ?
  • Next by Date: Re: Setting up fixed point problem
  • Previous by thread: FindRoot in 5.0
  • Next by thread: Re: FindRoot in 5.0