[Date Index]
[Thread Index]
[Author Index]
Re: Constraint definition is not valid: WHY?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg131380] Re: Constraint definition is not valid: WHY?
*From*: Bob Hanlon <hanlonr357 at gmail.com>
*Date*: Tue, 2 Jul 2013 00:47:22 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-outx@smc.vnet.net
*Delivered-to*: mathgroup-newsendx@smc.vnet.net
*References*: <20130701094838.8194B6A23@smc.vnet.net>
You wrote ReplaceAll incorrectly.
v1 = express ./ Par should be written v1 = express /. Par
Perhaps this is just a typo in your e-mail and not how you wrote your code
since this would give an error.
Functions use square brackets; for example,
V1 = f(e1, x) should be written V1 = f[e1, x]
In the statement
NMaximize[{objopt > 0, constr == 0}, {e1, e2, x}, Method -> NelderMead]
there is no expression to be maximized, just two constraints: an inequality
and an equation.
The error message indicates a problem with the constraint "expression" but
you have not
defined expression in the code snippets shown.
Bob Hanlon
On Mon, Jul 1, 2013 at 5:48 AM, <aless.bolli at gmail.com> wrote:
> I am tring to use Nmaximize in Mathematica This is How I proceeded:
>
> 1) define a list of parameters: Par = {a->1, b->3, etc};
>
> 2) define two functions: f1: v1=express./Par f2: v2=express./Par
>
> After this the expression are numerical except for the variables:
>
> V1=f(e1,x) and V2=f(e2,x)
> The objective function to be maximized is V1/(e1+e2) I defined the
> constraint as constr=V1-V2;
>
> then I used the Nmaximize:
>
> NMaximize[{objopt > 0, constr == 0}, {e1, e2, x}, Method -> NelderMead]
> I obtained the following error:
>
> NMaximize::bcons: "The following constraints are not valid: "expression".
> Constraints should be equalities, inequalities, or domain specifications
> involving the variables"
>
> I checked that only those variables are present in the constraint and
> objective function (other are numerical parameters) I do not understand why
> this error appears can someone help me?
>
> Thank you
>
> Alex
>
>
Prev by Date:
**files**
Next by Date:
**Re: Complex path integral wrong**
Previous by thread:
**Constraint definition is not valid: WHY?**
Next by thread:
**Re: Constraint definition is not valid: WHY?**
| |