FindRoot in 5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg42819] FindRoot in 5.0
- From: emm10 at psu.edu (Eric Mockensturm)
- Date: Wed, 30 Jul 2003 04:07:53 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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];func[x]),{x,2,4}] 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.