Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following CDF:

 F[x_] = Piecewise[{
     {0, x < 0},
     {0.1 x^2, 0 <= x <= 2},
     {0.4, 2 < x <= 5/2},
     {0.5, 5/2 < x <= 4},
     {-0.5 E^-(x - 4)^2 + 1, 4 < x}

enter image description here

Now I define the a probability distribution as follows:

 dist = ProbabilityDistribution[{"CDF", F[x]}, {x, 0, Infinity}];
 G[x_] = CDF[dist, x];

But the plot of G now looks different:

enter image description here

It seems I lose the discontinuity point and on top of that the CDF G doesn't even go up to 1 anymore.

Question: Why do I lose the discontinuity of my CDF, and is there a way to avoid this issue?

share|improve this question
up vote 3 down vote accepted

It appears that Mathematica does not support discontinuous CDFs. For example, try

F[x_] := ((Sign[x] + x) + 2)/4
dist = ProbabilityDistribution[{"CDF", F[x]}, {x, -1, 1}];
Plot[{F[x], CDF[dist, x]}, {x, -1, 1}]

and you can see the results are not the same. Even if we define $F$ equivalently as

G[x_] := Piecewise[{{(1 + x)/4, -1 <= x < 0}, {(3 + x)/4, 0 <= x <= 1}}]

we still don't get the right result.

share|improve this answer

Your Answer


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.