Bug introduced in 8.0.0 and fixed in 10.3.0

Could someone check that I haven't gone mad? I would like to take the maximum of two $[0, 2 \pi]$ independent uniform random variables.

distr = 
  Max[x, y],
  {x \[Distributed] UniformDistribution[{0, 2 Pi}], 
   y \[Distributed] UniformDistribution[{0, 2 Pi}]}];

FullSimplify (and Simplify) thinks this is a uniform $[0, 2 \pi]$ distribution:

FullSimplify[distr]  (* outputs UniformDistribution[{0, 2 Pi}] *)

But if I take the PDF of each distribution, I get different answers:

PDF[distr, x] // FullSimplify[#, 0 < x < 2 Pi] &  (* returns x/(2 Pi^2) *)
PDF[FullSimplify[distr], x] // FullSimplify[#, 0 < x < 2 Pi] &  (* returns 1/(2 Pi)*)

Intuitively, the maximum of two independent uniform random variables will not be uniformly distributed, because it's very unlikely that both will be less than $\epsilon$, say.

Is this a bug, or have I misunderstood something? Mathematica 10.2 on Mac OS 10.10.

  • $\begingroup$ What if you use OrderDistribution[] instead? $\endgroup$ Commented Aug 26, 2015 at 16:29
  • $\begingroup$ OrderDistribution works correctly, agreeing with the above non-Simplifyed PDF. Thanks - I wasn't aware of OrderDistribution. $\endgroup$ Commented Aug 26, 2015 at 16:34
  • $\begingroup$ Looks like a bug. I would report it to [email protected], or I could do that for you. $\endgroup$
    – Searke
    Commented Aug 26, 2015 at 16:35
  • $\begingroup$ I'll do it, thanks. Who around here does the bug header ("bug since 8.0" or whatever)? $\endgroup$ Commented Aug 26, 2015 at 16:36
  • $\begingroup$ Added the tag; as for the header, let's wait for somebody with an earlier version to chime in before adding it. $\endgroup$ Commented Aug 26, 2015 at 16:42

1 Answer 1


The problem arises due to PiecewiseExpand operating inside TransformedDistribution, similarly to the following

pw = PiecewiseExpand[f[Max[x, y], z]]

(* Piecewise[{{f[x, z], x - y >= 0}}, f[y, z]] *)

however this kind of transformation is not appropriate when f is TransformedDistribution

pw /. {f -> TransformedDistribution, 
          z -> {x \[Distributed] UniformDistribution[{0, 2 Pi}], 
                y \[Distributed] UniformDistribution[{0, 2 Pi}]}}

(* UniformDistribution[{0, 2 Pi}] *)

Thank you for pointing out this bug. It has been fixed in the development version, so that FullSimplify will return the unchanged TransformedDistribution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.