1
$\begingroup$

Trying to find maximum of x given that '''0<=x<=3''' and some other stuff. This works fine:

Clear[x, y]
FindMaximum[{x, 0<=x<=3}, x]

But this does not:

Clear[x, y]
FindMaximum[{x, 0<=x<=3 && y==1}, x]

How can I get the maximum x from the second list of constraints?

$\endgroup$
4
$\begingroup$
FindArgMax[{x, 0 <= x <= 3 && y == 1}, {x, y}][[1]]

3.

$\endgroup$
0
$\begingroup$

This works, but finds a local maximum. For example, if the constraints are 0<=x<=1 && x==2,y==1 it finds 1, not 2. I have been using rule = NMaximize[{x,0<=x<=1 && x==2,y==1},{x,y}] and x/.rule to good effect so far.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.