MathGroup Archive 2006

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

Search the Archive

Behaviour of FindRoot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65096] Behaviour of FindRoot
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 14 Mar 2006 06:00:20 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
in a previous thread: "optimization nested in root-finding" the 
following as yet unanswered problem poped up (simplified):

Remove[f1];
f1[x1_] := (Print["x1=",x1];
       x1^2
       );
FindRoot[f1[x] == 2., {x, 1}]

This will print "x1=x" showing that f1 was called with an unevaluated x, 
despite FindRoot having the Attribute "HoldAll". There is no other 
output from the Print statement

However, if we replace f1[x1_]  by f1[x1_Real]
we get the expected:

x1=1.
...

I think this has to do with compilation. Can anybody explain this?

Daniel


  • Prev by Date: Mathlink with VC++ 8
  • Next by Date: Re: optimization nested in root-finding
  • Previous by thread: Re: Mathlink with VC++ 8
  • Next by thread: RE: Behaviour of FindRoot