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.

I do thank you Vitaly and Celtschk.

I should have disclosed my ultimate goal earlier so as to receive the best help.While the previous suggestions were very helpful, I think I realize I ill-posed the question earlier

I am trying to find the values of A and B that will maximize function f on the domain {x,0,100},{y,0,100}. I have had trouble using Maximize or NMaximize, etc. So I am trying to find x and y in terms of A and B, which will maximize the function.

this function f has two parameters A and B in it with constraints such that $ 0< A < 100 $ and $A < B \le 100$.

My actual function is: Mathematica Input:


(B^3 - B^2 (x + y) + x (A^2 - y^2 + A (-x + y)) + B (x^2 + x y + y^2 - A (x + y)))/(A - B)^2


$$ (B^3 - B^2 (x + y) + x (A^2 - y^2 + A (-x + y)) + B (x^2 + x y + y^2 - A (x + y)))/(A - B)^2\bigl) $$

share|improve this question
    
Your original question is very valid. I suggest keeping it, so you do not discourage people answering your question and they do not need to re-edit their answers. You can ask about your optimization problem as a separate question. Also can you post your functions using Mathematica syntax too so it is easy to copy? –  Vitaliy Kaurov Jun 14 '12 at 22:15
add comment

3 Answers 3

Use Manipulate function to interactively change the parameters values. The If statement is to auto-remove breaking of controls due to getting out of proper range.

Manipulate[
 If[B < A, B = A];
 Plot3D[A^3 - A^2 (x + y) + x (B^2 - y^2 + B (-x + y)), {x, 0, 
   100}, {y, 0, 100}, PlotStyle -> Opacity[.7], 
  ColorFunction -> "Rainbow"], {{A, 50}, 0, 99.9, 
  Appearance -> "Labeled"}, {{B, 100}, A, 100, 
  Appearance -> "Labeled"}, FrameMargins -> 0]

enter image description here

share|improve this answer
    
@Vitaly: I see your point , you are right. My second day here :) –  emmett Jun 14 '12 at 23:29
add comment

Parameters should have numerical values. Otherwise it is done by a standard command Plot3D:

A = 10; B = 20;
Plot3D[(A^3 - A^2 (x + y) + x (B^2 - y^2 + B (-x + y))), {x, -100, 
  100}, {y, -100, 100}, PlotRange -> All]

If the question is about how to change parameters interactively and see that happens it can be done with Manipulate.

share|improve this answer
    
With[] is a particularly convenient function for this. –  J. M. Jun 14 '12 at 9:26
add comment

Besides interactive manipulation, you might also just want to see a set of surfaces with different parameter settings in a single picture:

Plot3D[Evaluate@Table[Tooltip[A^3-A^2 (x+y)+x(B^2-y^2+B(-x+y)),
                              Style["A = " <> ToString[A]
                                    <> ", B = "<>ToString[B],
                                    Background->White]],
                      {A, 1, 100, 33}, {B, A, 100, 33}],
       {x, 0, 100}, {y, 0, 100},
       PlotStyle -> {Green, Darker[Yellow], Red, Blue, Cyan, Magenta,
                     Brown, Orange, Purple, Pink}]

output of above command

share|improve this answer
1  
To improve visual representation of this vertical AspectRatio should be greater and Opacity could be helpful. –  Vitaliy Kaurov Jun 14 '12 at 15:52
    
@celtschk Thank you, this is helpful and –  emmett Jun 14 '12 at 21:56
add comment

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.