Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

So I define a 3-variable function $h$ and I want to find the maximum of $h$ in a region $\mathcal{R}$:

h[x_, y_, z_] := y (a - z) - z (a - t) + (y + x) (Max[0, b - (y - z)] - x + 1)
Maximize[{h[x, y, z], 0 <= z <= t, z <= y <= a, 0 <= x <= Max[0, b - (y - z)]}, {x, y, z}]

Here I'm treating $a,b,t$ as constants. Shouldn't Mathematica return the maximum of $h$ as a function of $a,b,t$?

share|improve this question
    
At first I thought Mathematica was being defeated by the presence of Max. So I took them out and tried h[x_, y_, z_] := y (a - z) - z (a - t) + (y + x) (b - (y - z) - x + 1); Maximize[{h[x, y, z], 0 <= z <= t && z <= y <= a && 0 <= x <= b - (y - z)}, {x, y, z}], just to see if it would work. Now it's been chugging away for an hour with no result. –  Rahul Narain Jun 9 at 20:12
    
if you specify numerical values for a,b,t you readily get a solution. Not sure how hard you want to work at getting an analytic expression which will inevitably be very complicated. –  george2079 Jun 9 at 21:21

1 Answer 1

h[x_, y_, z_] := y (a - z) - z (a - t) + (y + x) (Max[0, b - (y - z)] - x + 1)
Maximize[{h[x, y, z], 0 <= z <= t, z <= y <= a,0 <= x <= Max[0, b - (y - z)]}, h]

Finds a lot of solutions.

Sounds too simple to be your problem, but can't add comments.

share|improve this answer
    
The solutions that Mathematica finds depend on the variables $x,y,z$ because the program returns the maximum depending on the different faces/edges of the boundary. I want the answer in terms of $a,b,t$ only. In other words I need Mathematica to reiterate the procedure and maximize the solutions it has found on the corresponding boundaries. –  the_fox Apr 10 at 20:30
    
Inputting values seems to give. x->0.5 (b - a + 1)) - Max[(a - t)/2, 0] y->a z->a||t for your boundary conditions. It gives indeterminate for certain values, but the code is obviously correct, how irritating, something must stall. –  Feyre Apr 11 at 22:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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