2
$\begingroup$

The following outputs answers for a variety of cases for the parameters, a and b:

ArgMax[{a*Sqrt[x] + b*Sqrt[y], x + y <= 10}, {x, y}]

How can I tell Mathematica to only compute the case where a > 0 and b > 0? The following basically works but still yields an additional case I don't want simply called true, for which the answer is indeterminate:

ArgMax[{a*Sqrt[x] + b*Sqrt[y], x + y <= 10, a > 0, b > 0}, {x, y}]

What is that? And how do I get rid of it?

$\endgroup$
2
$\begingroup$
FullSimplify[
 ArgMax[{a*Sqrt[x] + b*Sqrt[y], x + y <= 10 && a > 0 && b > 0}, {x, y}], a > 0 && b > 0]

(* {(10 a^2)/(a^2 + b^2), (10 b^2)/(a^2 + b^2)} *)
$\endgroup$
  • $\begingroup$ This is very useful. I do think it still calculates all of the extraneous cases and then discards them in the FullSimplify call, right? I will be using this in a few cases with many parameters, so there could be some cost to this, but it's probably not enough to worry about in using this attractively simple option. $\endgroup$ – Shane Mar 22 '16 at 0:29
  • 1
    $\begingroup$ @Shane as you surely know, Solve doesn't work the same way with the assumptions. Compare: ArgMax[{a*Sqrt[x] + b*Sqrt[y], x + y <= 10 && a > 0 && b > 0}, {x, y}] with ArgMax[{a*Sqrt[x] + b*Sqrt[y], x + y <= 10}, {x, y}] $\endgroup$ – Dr. belisarius Mar 22 '16 at 0:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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