Re: why does FindMinimum have the attribute HoldAll?
- To: mathgroup at smc.vnet.net
- Subject: [mg69895] Re: why does FindMinimum have the attribute HoldAll?
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Wed, 27 Sep 2006 06:03:48 -0400 (EDT)
- References: <acbec1a40609260710p5fdd6302u15c87af79eae3d2b@mail.gmail.com>
Actually, with FindMinimum it's a little more complicated than what I said because I think it has some kind of heuristic to realize when the first argument isn't a numeric function in held form - then FindMinimum evaluates the argument to make the optimization work. I guess that is for compatibility with old code. However, the heuristic doesn't work if there is an option present. For example: In[1]:= fun=x^2+y^2; In[2]:= opt=Method->"Gradient"; In[3]:= guesses={{x,1},{y,2}}; In[4]:= FindMinimum[fun,guesses] Out[4]= {0.,{x\[Rule]0.,y\[Rule]0.}} In[5]:= FindMinimum[fun,guesses,opt] From In[5]:= FindMinimum::"fdssnv" : Search specification guesses without variables should be a list with a 1-4 elements. Out[5]= FindMinimum[fun,guesses,opt] Maybe I should just have started with Plot, but I hope I got the original question across. On 9/26/06, Chris Chiasson <chris at chiasson.name> wrote: > instead of the attribute HoldFirst? > > HolAll makes it a pain to dynamically populate the variables and their > initial values. I usually end up Blocking FindMinimum so that I can > get the call right. > > I have a similar question about Plot, but I figured I'd ask one at a time. > > > > -- > http://chris.chiasson.name/ > -- http://chris.chiasson.name/