1
$\begingroup$

I tried to find solution in a few discussions but I couldn't solve my problem because my knowledge is basic.

I have the following functions and parameters:

Mstar[d_, u_, p_] := ProductLog[-d p + p u];

PIstar[d_, u_, p_] := u - E^-Mstar[d, u, p] (u - d);

CMstar[d_, u_, p_] := 1/2 Mstar[d, u, p]^2;

EUY1star[d_, u_, p_] := PIstar[d, u, p] p - CMstar[d, u, p];

EUB1star[d_, u_, p_, r_, s_] := r (1 - PIstar[d, u, p]) - 2 PIstar[d, u, p] s r;

EUB2star[d_, u_, p_, r_, s_] := r (1 - d) - 3 d s r - EUY1star[d, u, p];

d = 0.2;
u = 0.8;
r = 1;

and I want to draw the Parametric Region Plot of

[{EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] > 0 && EUB2star[d, u, p, r, s] > 0}, {p, 0, 1000}]

where in the horizontal axis I need PIstar[d, u, p] and in the vertical axis {s, 0, 2}.

I have no idea how to do it yet in my V.8. Pls help. Maurizio.

$\endgroup$
4
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Sep 13, 2015 at 12:10
  • $\begingroup$ For the given value of {d,u,r}, the condition {EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] > 0 && EUB2star[d, u, p, r, s] > 0} is not True for any (p,s) in the range you have given. Also PIstar[d, u, p] is complex. $\endgroup$
    – Hubble07
    Commented Sep 13, 2015 at 12:20
  • $\begingroup$ Hi Hubble07. I am a bit puzzled about your answer. I tell you why. Originally I plotted the following non-overlapping regions: RegionPlot[{EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] > 0 && EUB2star[d, u, p, r, s] > 0, EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] < 0 && EUB1star[d, u, p, r, s] > 0, EUB1star[d, u, p, r, s] < 0 && EUB2star[d, u, p, r, s] < 0}, {p, 0, 10}, {s, 0, 2}, PlotStyle -> {Red, Blue, Green}, MaxRecursion -> 10] $\endgroup$ Commented Sep 13, 2015 at 13:00
  • $\begingroup$ @M.Lisciandra Sorry, I made a silly mistake by checking only integer values using Table. Anyway checkout the answer i posted. $\endgroup$
    – Hubble07
    Commented Sep 13, 2015 at 14:55

2 Answers 2

2
$\begingroup$
RegionPlot[{EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] > 0 && 
           EUB2star[d, u, p, r, s] > 0}, 
           {p, 0, 2}, {s, 0, 2}]

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ The OP said they need PIstar[d, u, p] along the X-axis not simply p. $\endgroup$
    – Hubble07
    Commented Sep 13, 2015 at 14:59
  • $\begingroup$ Yes. Indeed. Thank you Belisarius by the way. $\endgroup$ Commented Sep 13, 2015 at 15:08
2
$\begingroup$

Version 2

How about writing all your function in terms of $\pi^*$ and then plotting them from 0.2 to 0.8 like this

 region = RegionPlot[{r (1 - d) - 
  3 d s r - (pstar*(Log[(u - d)/(u - pstar)]/(u - 
         pstar)) - (Log[(u - d)/(u - pstar)])) - (r (1 - pstar) - 
    2 pstar*s r) > 0 && 
  r (1 - d) - 
  3 d s r - (pstar (Log[(u - d)/(u - pstar)]/(u - 
         pstar)) - (Log[(u - d)/(u - pstar)])) > 0}, {pstar, 0.2, 
  0.8}, {s, 0, 2}, MaxRecursion -> 10, 
 FrameLabel -> {"\!\(\*SuperscriptBox[\(\[Pi]\), \(*\)]\)", "s"}, 
  RotateLabel -> False, LabelStyle -> (FontSize -> 20)]

For the transformation I used the inverse function for ProductLog

If $b = ProductLog(a)$ then $a = b*e^{b}$

Using above we can write

$$p(u-d)=M^* e^{M^*}$$

This allows to write $p$ in terms of $\pi^*$

$$M^* = Log\left(\frac{u-d}{u-\pi^*}\right)$$

$$p= \frac{1}{u-\pi^*}Log\left(\frac{u-d}{u-\pi^*}\right)$$

With the above transformation you can express all your inequality in terms of $\pi^*$. Since $\pi^*$ ranges from $u$ to $d$ for $p$ going from $0$ to $\infty$, you can then RegionPlot $\pi^*$ from u to d. This is what I have shown.

enter image description here


Can't you just find the range of $\pi^*$ for the range of $p$ and then plot over that range.

  regPlot[pmax_, smax_] := 
  Module[{pmin = 0, smin = 0, PIstarMin, PIstarMax},

  PIstarMin = PIstar[d, u, pmin];
  PIstarMax = PIstar[d, u, pmax];

  RegionPlot[{EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] > 0 &&
  EUB2star[d, u, p, r, s] > 0}, {p, PIstarMin, PIstarMax}, {s, 0, 
  smax}, MaxRecursion -> 10, 
  FrameLabel -> {"\!\(\*SuperscriptBox[\(\[Pi]\), \(*\)]\)", "s"}, 
   RotateLabel -> False, LabelStyle -> (FontSize -> 20)]]

So for $p_{max}=1000$ and $s_{max}=2$ we get

   regPlot[1000, 2]

enter image description here

$\endgroup$
13
  • $\begingroup$ Dear Hubble07, you're just great! I have a question though. The variable 'p' goes from 0 to infinity (because this is my definition of the variable). I put p=[0,1000] just for simplicity. 'PIstar' is a probability and it is simply a function of 'p', given 'd' and 'u', which are the lower and upper bounds of 'PIstar' respectively. Thus 'PIstar' is fully described by the whole range of 'p=[0,+infinity or 1000]'. Hence, the plot you gave me describes 'PIstar' values for 'p' that goes from 0 to 1000. Is it correct? Thank you again!! $\endgroup$ Commented Sep 13, 2015 at 16:02
  • 1
    $\begingroup$ Thanks. Actually in the plot $\pi^*$ goes upto 0.8 which is infact the limiting value for $p \rightarrow \infty$. I mean $lim_{p \rightarrow \infty}\pi^*(a,b,p)=b$. You can check this in mma Limit[PIstar[a, b, p], p -> Infinity]. Here its 0.8 since you have set that limit by u=0.8. So you can sat that, "The plot describes $\pi^*$ values for $p$ going from 0 to $\infty$" $\endgroup$
    – Hubble07
    Commented Sep 13, 2015 at 16:25
  • $\begingroup$ I'm afraid there is a problem with the solution you gave me! I did a double check. First, consider simply EUB1star>0, I plotted parametrically the boundary ParametricPlot[{PIstar[d, u, p], (1 - PIstar[d, u, p])/(2 PIstar[d, u, p])}, {p, 0, 1000}, AspectRatio -> 1/1, PlotRange -> {{d, u}, {0, 2}}, MaxRecursion -> 15, AxesOrigin -> {d, 0}] ... the region plot is actually the area beneath the curve. Then, I used the regionplot you suggested just for EUB1star[d, u, p, r, s] > 0 but the areas are different! Any suggestions? Sorry if I take some of your time.... Thank you. $\endgroup$ Commented Sep 13, 2015 at 21:32
  • $\begingroup$ I've just realized that with your script you've just plotted simply this: RegionPlot [{EUB2star[d, u, p, r, s] - EUB1star[d, u, p, r, s] > 0 && EUB2star[d, u, p, r, s] > 0}, {p, 0.2, 0.8}, {s, 0, 2}, MaxRecursion -> 10], as @belisarius did before. $\endgroup$ Commented Sep 13, 2015 at 21:44
  • $\begingroup$ I don't see any problem in Regionplot for EUB1star[d, u, p, r, s] >0 given by my function. What do you expect?. It agrees with Plot[EUB1star[d, u, 0.2, r, s], {s, 0, 2}]. I mean the maximum s value allowed is around 1.4. In your ParametricPlot whats the expected value of Y-coordinate at p=0.2. It should be the value of (1 - PIstar[d, u, 0.2])/(2 PIstar[d, u, 0.2]) right which is around 1.4 so it matches with the cutoff in the RegionPlot. $\endgroup$
    – Hubble07
    Commented Sep 13, 2015 at 23:29

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.