# FullSimplify on TransformedDistribution

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 =
TransformedDistribution[
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.

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

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.