Evaluation of numeric Functions in NMinimize
- To: mathgroup at smc.vnet.net
- Subject: [mg45478] Evaluation of numeric Functions in NMinimize
- From: "Johannes Ludsteck" <johannes.ludsteck at wiwi.uni-regensburg.de>
- Date: Fri, 9 Jan 2004 05:20:49 -0500 (EST)
- Organization: Universitaet Regensburg
- Sender: owner-wri-mathgroup at wolfram.com
Dear MathGroup members, I try to find the fixed point of a complicated vector-valued function involving large SparseArray expressions with NMinimize by minimizing a constant and including the fixed point problem as a set of constraints. (The trivial example below is created only in order to mimic the structure of the problem.) dim = 2; i = SparseArray[{i_, i_} -> 1., {dim, dim}]; z = Table[Unique[], {dim}]; start = Table[1., {dim}]; f[x_ /; VectorQ[x, NumericQ], i_] := x.i.x; NMinimize[{1, Sequence @@ Thread[z == f[z, i]]}, Thread[{z, 0.5 start, 1.5 start}]] Mathematica responds to this with the error message NMinimize::bcons : The following constraints are not valid: {f[{$1,$2},SparseArray[<2>,{2,2}]==$1,f[{$1,$2},SparseArray[<2>, {2,2}]==$2,f[{$1,$2},SparseArray[<2>,{2,2}]==$3}. Apparently, Mathematica does not evaluate f because of the condition x_/: VectorQ[x,NumericQ] in the definition of f. This condition is, however necessary (not in the example here, but in my real world application). Is there any way to urge Mathematica to evaluate f in NMinimize? I am quite shure that everything else in my code is OK, because it works with FindRoot. Best regards, Johannes Ludsteck <><><><><><><><><><><><> Johannes Ludsteck Economics Department University of Regensburg Universitaetsstrasse 31 93053 Regensburg Phone +49/0941/943-2741