Re: FindMinimum to minimize e . w . e
- To: mathgroup at smc.vnet.net
- Subject: [mg19636] Re: FindMinimum to minimize e . w . e
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Mon, 6 Sep 1999 04:20:48 -0400
- Organization: University of Western Australia
- References: <7qsg76$17u@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Albert Maydeu-Olivares wrote: > I have a couple of questions regarding the GLS fitting function > > grad=-2e . w. j; > f1=FindMinimum[e . w . e,Evaluate[Sequence@@startval],Gradient->grad] > > where e is symbolic vector and w is a matrix of constants. Have you had a look at the Calculus`VariationalMethods` package? NVariationalBound effectively does this computation and uses FindMinimum internally. > 1) when I try to update w at each iteration as > > w:=Inverse[symbolic matrix]; > f2=FindMinimum[e . w . e,Evaluate[Sequence@@startval],Gradient->grad]; > > it takes forever. I suspect that the reason is that at each iteration > Mathematica uses > > (e. w . e)/. rule which takes about 34 sec on my machine, instead of > > (e/.rule) . Inverse[symbolic matrix/.rule] . (e/.rule) .11 sec I'm sure that there is a way of re-writing your example to work in this way but it is not easy to explain how to do this in general because it could depend on the problem specifics. > 2) Minimizing f1 is equivalent to minimizing > > f3=FindMinimum[Tr[MatrixPower[mat1 . (mat2 -mat3) ,2]],Gradient->gradient, > Evaluate[Sequence@@startval]] > > where mat1 and mat2 are numerical matrices, and mat3 is symbolic. I'm > interested in f3 because it's supposed to be faster. However, Mathematica 3 > gives me an error > > FindMinimum::"fdss": Gradient->... > "Search specification should be a list with 2-4 elements." > > yet Tr[MatrixPower[mat1 . (mat2 -mat3) ,2]]/.rule and gradient/.rule work > fine. What may be happening? You have defined Tr? Perhaps a Notebook with a specific (simple) example would make this all clear? ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________