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 would like to evaluate the PDF of a custom ProbabilityDistribution at the min and max values. However, PDF[...] returns 0 at the boundary conditions. Is there an elegant way to prevent this? Example:

dst = ProbabilityDistribution[2 x, {x, 0, 1}];
PDF[dst, 0.99999] (* = 1.99998 *)
PDF[dst, 1] (* = 0 *) (* I would like this to return 2 *)

The docs say that

the pdf is taken to be zero for $x < x_{min}$ and $x > x_{max}$

It seems inconsistent that the PDF is forced to zero at $x = x_{max}$.

share|improve this question
It's either a bug in the definition or incorrect documentation. Implementation wise, it is definitely defined only for $x_{min}<x<x_{max}$ and not for $x_{min}\le x\le x_{max}$. For example, see what this gives you: PDF[ProbabilityDistribution[f, {x, 0, 1}], x] – R. M. Aug 1 '12 at 7:58
Does it have impact on any of your calculations? I don't think it will matter at all, so why care? Plot[PDF[dst, x], {x, -1, 2}, ExclusionsStyle -> Directive[Gray, Dashed]]does exactly what you would expect. Same for Integrate[PDF[dst, x], {x, -\[Infinity], \[Infinity]}] – Sjoerd C. de Vries Aug 1 '12 at 9:04
Knowing of this issue you can use e.g. Limit[PDF[dst, x], x -> 1 , Direction -> 1] and Limit[PDF[dst, x], x -> 0 , Direction -> -1] to get 2 or 0 respectively. – Artes Aug 1 '12 at 9:35
Side note: the PDF you used in ProbabilityDistribution is not normalized. This is known to cause various functions to silently return incorrect results. – Szabolcs Feb 22 '14 at 0:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.