[Date Index]
[Thread Index]
[Author Index]
minimization of a function operating on a vector or reals
*To*: mathgroup at smc.vnet.net
*Subject*: [mg23169] minimization of a function operating on a vector or reals
*From*: Wijnand Schepens <Wijnand.Schepens at rug.ac.be>
*Date*: Thu, 20 Apr 2000 23:48:41 -0400 (EDT)
*Organization*: RUG
*Sender*: owner-wri-mathgroup at wolfram.com
I wish there were a kind of FindMinimum for high dimensions without
having to mention all (dummy) variables...
This is a simplification of my problem:
Suppose I have a function f[lst] which maps a list of real numbers (a
vector) into a number, e.g.
f[lst_]:=Plus @@ Map[#^2 &, lst]
Now I want to minimize f w.r.t. every element in the list, e.g.
FindMinimum[ f[{x1,x2,x3}], {x1,1.}, {x2,2.}, {x3,-1.} ]
This works fine, but I want to do the minimization for large lists (of
any length, say 10). I have the initial values in a list, e.g.
n = 10;
initlst = N[Range[n]];
First I need to create dummy-variables
dummy := Module[{x}, x];
varlst = Table[dummy, {n}];
Then I must feed this to FindMinimum to get something like
FindMinimum[f[{dummies...}, {dummy1,init1}, {dummy2,init2}, ...].
I did it like this:
r = FindMinimum[f[varlst], Evaluate[Sequence @@ MapThread[List, {varlst,
initlst}]]]
The final result then is
varlst /. r[[2]]
This gives the desired result.
But this all seems such a lot of trouble. And is it efficient???
Is there an alternative?
Is there a way to avoid the generation of a list of dummy-arguments?
I would think that the core-code of the FindMinimum routine works with
vectors of real numbers. Is this true? If so, is it usable or do we
always have to go via FindMinimum??
Off the record:
If my function to be minimized is a compiled function working
on a vector (rank 1 tensor)
e.g.
f2=Compile[{{lst,_Real,1}},Plus @@ Map[#^2 &, lst]
then f2[initlst] gives the same answer, but f2[varlst] gives an error
because the argument is symbolical.
Nevertheless, I can feed f2 to FindMinimum just like before, and get the
correct answer in less time. Luckily.
But still, I have the feeling that there could be a more fundamental
minimization routine where one wouldn't have to supply symbols for dummy
variables...
Prev by Date:
**fastest way to do pair-sum / make pair-list**
Next by Date:
**Re: Re: PrintPrecision**
Previous by thread:
**Re: fastest way to do pair-sum / make pair-list**
Next by thread:
**Re: minimization of a function operating on a vector or reals**
| |