Re: typing starting values in FindMinimum
- To: mathgroup at smc.vnet.net
- Subject: [mg15446] Re: typing starting values in FindMinimum
- From: Robert Knapp <rknapp>
- Date: Mon, 18 Jan 1999 04:21:48 -0500
- Organization: Wolfram Research, Inc.
- References: <77f0j5$m17@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Albert Maydeu-Olivares wrote: > > Hi everyone, > > Consider the use of FindMinimum when the function to be minimized > depends on several variables > > In[1]:= > j={{l2,l1,0},{l3,0,l1},{0,l3,l2}}; > e={0.56 -l1 l2,0.48 -l1 l3, 0.42 -l2 l3}; > FindMinimum[Apply[Plus,e^2],{l1,.5},{l2,.5},{l3,.5},Method->Newton, > Gradient->j] > > Out[1]= > {8.68919*^-23, {l1->.8, l2->.7, l3->.6}} > > Does anyone know to avoid having to type in all the variables names and > starting values? > I have some problems with 100 variables! > > Of course I can construct > > In[3]:= > theta={l1,l2,l3}; > start ={0.5,0.5,0.5}; > startval=Transpose[{theta,start}] > > Out[3]:= > {{l1,0.5},{l2,0.5},{l3,0.5}} > > but that is not what FindMinimum is expecting. > All you need to do is use FindMinimum[Apply[Plus,e^2],Evaluate[Apply[Sequence, startval]], Method->Newton,Gradient->j] The evaluate is necessary because FindMinimum does not by default evaluate its arguments.