0
$\begingroup$

I tried to plot maximized value over a range a\in [0,1] for different initial conditions b=0.2,0.3,0.4,0.5, but it does not work. Could anyone please help to work it out?

pi:=2 b + (x + y -b)(3-x)/3- a(y -b)

opt:=Maximize[{pi, a <= x <= 1 && a - 1 < y}, {x, y}]

Plot[Evaluate[Table[opt, {b, 0.2, 0.5, 0.1}]], {a, 0, 1}]

$\endgroup$

1 Answer 1

1
$\begingroup$

You are nearly there. With a few changes:

pi[x_, y_  , a_, b_ ] = 2 b + (x + y - b) (3 - x)/3 - a (y - b);
opt[a_, b_] := 
 Maximize[{pi[x, y, a, b], a <= x <= 1 && a - 1 < y}, {x, y}];

Plot[Evaluate[Table[opt[a, b], {b, 0.2, 0.5, 0.1}]], {a, 0, 1}]

enter image description here

It looks that p[a,b] is unbounded for a<0.75

$\endgroup$
3
  • $\begingroup$ Hi Daniel, Thank you very much for your correction. But when I run the same code on my computer, it did not work. Could you please help to look at it? Is it related to the version of Mathematica? I attached a picture in the following. Thank you. $\endgroup$
    – Ling Shi
    Nov 4, 2021 at 18:09
  • $\begingroup$ when I run the same code on my computer, it did not work. Could you please help to look at it? Is it related to the version of Mathematica? I attached a picture in the following. Thank you. i.sstatic.net/4JJD7.png $\endgroup$
    – Ling Shi
    Nov 4, 2021 at 18:13
  • $\begingroup$ Hi Ling, I tried the code again and it works on my machine. I have MMA 12.3 on Windows 10 $\endgroup$ Nov 5, 2021 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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