0
$\begingroup$

Im plotting a region in RegionPlot and it gives me an output but it does not look like it is plotting correctly. This may be an issue with my syntax but I'm not seeing where the error could be. For example, when I evaluate the inequality for x when a = 0.5,b=0 and y = 8, it should be $x\leq 3.07 $. But in the plot when y = 8, no x values are plotted (it should be the orange region btw). I can't seem to find the issue.

ClearAll[G1, g1];
g1[p_] := PDF[NormalDistribution[5, 1], p];
(* you can also get same thing with CDF/PDF without p. For example: *)

G1 = CDF[NormalDistribution[5, 1]];

g1[x] // TraditionalForm
G1[x] == CDF[NormalDistribution[5, 1], x]

ClearAll[h];
h[alpha_, beta_, s2_, guess_ : 0] := FindRoot[
  s2 - p + beta (p - 5 alpha) == G1[p - 5 alpha]/g1[p - 5 alpha], {p, 
   guess}]

h[0.3, 0.3, 0.2]
h[0.3, 2, 0.2]
h[0, 0, 5]

ClearAll[f];
f[alpha_, beta_, s2_, guess_ : 0] := 
  p /. First[h[alpha, beta, s2, guess]];
f[0.3, 0.3, 0.2]
f[0.3, 2, 0.2]
f[0, 0, 5]

s2 = (10 + Sqrt[2 \[Pi]])/2;

Manipulate[
 RegionPlot[{
   y >= x (1 - b)/(1 - a),
   x <= If[y >= s2,
     f[a, b, y] - a (f[a, b, y] - b (f[a, b, y] - 5 a) +
         (G1[f[a, b, y] - 5 a])/(g1[f[a, b, y] - 5 a])),
     f[a, b, y] - a (5 - (g1[s2]/G1[s2]))]},
  {x, 0, 10}, {y, 0, 10}, PlotPoints -> 10],
 {a, -2, 2}, {b, -2, 2}]

```
$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.