Re: How to call Nminimize inside another Nminimize
- To: mathgroup at smc.vnet.net
- Subject: [mg67895] Re: How to call Nminimize inside another Nminimize
- From: dh <dh at metrohm.ch>
- Date: Wed, 12 Jul 2006 05:05:25 -0400 (EDT)
- References: <e8vtoh$squ$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Ali,
the output of NMinimize is a list, not a number as requested. To get a
number use e.g.: NMinimize[...][[2, 1, 2]]
Further, make sure you feed f1 only numeric arguments:
f1[x_?NumericQ, y_?NumericQ]:=...
Further, your conditions are not consistent:
t > x, t < y implies that x<y. Therefore, f1 must only be called if this
is true.
Daniel
Ali wrote:
> I am trying to use NMinimize command to find the minimum value of a
> function which contains another NMinimize call in itself with
> constraints depending on the function input and I am getting
> "NMinimize::bcons Constraints should be equalities, inequalities,
> or domain specifications involving the variables" error message. A
> simple example will be:
> f1[x_, y_] := NMinimize[{t^2, t > x, t < y}, t]
> f2[z_]:= NMinimize[{f1[x,y],x>-z,x<z,y>-z,y<z},{x,y}]
> I was wondering what would be the best way to solve this problem.
>
> Thanks in advance,
> Best,
> Ali
>
>