Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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] –  rm -rf 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 at 0:08
add comment

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.