I am new to Mathematica and I am struggling finding the solution for the following problem. I am studying this piecewise function:
Piecewise[{{pdf1[x]/pdf[x] (h + (1 - h) 2 cdf1[x])/(
h + (1 - h) 2 cdf[x]),
x < a}, {pdf1[x]/pdf[x] (h + (1 - h) 2 (1 - cdf1[x] + cdf1[a]))/(
h + (1 - h) 2 (1 - cdf[x] + cdf[a])),
a <= x < b}, {pdf1[x]/pdf[x] (
h + (1 - h) 2 (cdf1[x] - cdf1[b] + cdf1[a]))/(
h + (1 - h) 2 (cdf[x] - cdf[b] + cdf[a])),
b <= x < c}, {pdf1[x]/pdf[x] (
h + (1 - h) 2 (1 - cdf1[x] + cdf1[c] - cdf1[b] + cdf1[a]))/(
h + (1 - h) 2 (1 - cdf[x] + cdf[c] - cdf[b] + cdf[a])), x >= c}}]
where
pdf1[x_] = PDF[NormalDistribution[1, 1], x];
pdf[x_] = PDF[NormalDistribution[0, 1], x];
cdf1[x_] = CDF[NormalDistribution[1, 1], x];
cdf[x_] = CDF[NormalDistribution[0, 1], x];
I would like the first and the third piece of the piecewise function to be smaller than a certain value $l$, say $l=0.48$; and the second and fourth piece of the function to be greater than the same $l$.
I managed to represent graphically the piecewise function with the following code:
Manipulate[Plot[{Piecewise[{{pdf1[x]/pdf[x] (h + (1 - h) 2 cdf1[x])/(
h + (1 - h) 2 cdf[x]),
x < a}, {pdf1[x]/pdf[x] (
h + (1 - h) 2 (1 - cdf1[x] + cdf1[a]))/(
h + (1 - h) 2 (1 - cdf[x] + cdf[a])),
a <= x < b}, {pdf1[x]/pdf[x] (
h + (1 - h) 2 (cdf1[x] - cdf1[b] + cdf1[a]))/(
h + (1 - h) 2 (cdf[x] - cdf[b] + cdf[a])),
b <= x < c}, {pdf1[x]/pdf[x] (
h + (1 - h) 2 (1 - cdf1[x] + cdf1[c] - cdf1[b] + cdf1[a]))/(
h + (1 - h) 2 (1 - cdf[x] + cdf[c] - cdf[b] + cdf[a])),
x >= c}}], l}, {x, -5, 5}, PlotRange -> 3], {a, -10, 10,
Appearance -> "Labeled"}, {b, a, 5, Appearance -> "Labeled"}, {c, b,
5, Appearance -> "Labeled"}, {h, 0, 1,
Appearance -> "Labeled"}, {l, 0, 1, Appearance -> "Labeled"}]
The picture is an example of a solution where, for $h=0$, I set $a=0.05$, $b=0.27$ and $c=0.41$ (the yellow line corresponds to $l=0.48$)
What I am interested in is finding for each $h$ the set of combinations of $a$, $b$ and $c$ such that the system of inequalities is satisfied and I need to give a graphical representation of the set of solution somehow. I have tried something also by defining a domain for $a$, $b$ and $c$ such that $-2<a<b<c<2$, but I feel my skills with Mathematica are too poor to handle the task. Any piece of advice would be highly appreciated. Thank you.
{a, b, c}
are not unique. For instance, for the parameters in the question,a
could just as well be0
. Please describe more carefully what you are seeking. By the way,, the last block of code in the question does not execute as written. $\endgroup$ – bbgodfrey Sep 27 '18 at 1:21