FindMinimum to minimize e . w . e
- To: mathgroup at smc.vnet.net
- Subject: [mg19610] FindMinimum to minimize e . w . e
- From: "Albert Maydeu-Olivares" <amaydeu at nil.fut.es>
- Date: Sat, 4 Sep 1999 21:09:16 -0400
- Organization: Telefonica Transmision de Datos
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
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.
This works fine. However,
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
and probably does the same thing with the gradient, where the rule evaluates
the expressions at the starting values.
How can I fix this on Mathematica version 3.
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?
Thanks in advance
Albert