RE: How can I control FindMinimum's behavior?

*To*: mathgroup at smc.vnet.net*Subject*: [mg19104] RE: [mg19037] How can I control FindMinimum's behavior?*From*: "Ersek, Ted R" <ErsekTR at navair.navy.mil>*Date*: Thu, 5 Aug 1999 01:35:20 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Rajdeep Kalgutkar wrote: --------------------------- I have been using FindMinimum for a multidimensional minimization problem. I find that when Method->Automatic is used, my input parameters values are passed on to my target function immediately, but when I use Method->QuasiNewton, FindMinimum insists on symbolic input during the first minimization cycle. This happens even though I specify 2 input values. My target function does not have symbolic derivatives and therefore it the minimization procedure crashes when using the QuasiNewton method. Is there anyway to prevent FindMinimum from insisting on symbolic input initially? ---------------------------- Apparently the QuasiNewton method needs to have the symbolic derivative. In your example the function does have a symbolic derivative. The only problem is that Mathematica can't figure it out because of the way (func) is defined. What you need to do is use the Gradient option to tell the kernel what the derivative is. It's called Gradient because that's what you need for multi-dimensional problems. Also the Quasi-Newton method only needs one starting point. My solution is below. -------------------------- In[1]:=func[x_]:=Module[{w}, w=Sin[x]^2+0.2*x; Print[w," ",x]; w ] In[2]:= FindMinimum[func[x], {x,0.}, Method->QuasiNewton, Gradient->{2 Sin[x]Cos[x]+0.2} ] 0. 0. -0.000530497 -0.2 -0.0100297 -0.102717 -0.0100337 -0.100623 -0.0100337 -0.100679 Out[2]= {-0.0100337,{x->-0.100679}} ----------------- Regards, Ted Ersek