Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

consider this simple Input:

Probability[g <= m && m <= -g + 1,
  {m, g} \[Distributed] UniformDistribution[{{0, 1}, {0, gg}}]]

which generates a piecewise continuous function:

$$\begin{cases} 1-gg & gg\le\frac{1}{2}\\ \frac{1}{4\,gg} & \text{True} \end{cases}$$

My question is: why does mathematica outputs True rather that gg>1/2?

share|improve this question
Because it is the default case, and while g <= 1/2 partitions the space into only two sections, consider the piecewise function found in this answer. Overall, it is just simpler to have a default that is always run if no others match. – rcollyer Jul 19 '13 at 15:05
Note further that the actual output has the form Piecewise[{{1 - gg, gg <= 1/2}}, 1/(4*gg)] (execute Probability[g <= m && m <= -g + 1, {m, g} \[Distributed] UniformDistribution[{{0, 1}, {0, gg}}]] // InputForm to see). – Michael E2 Jul 19 '13 at 15:28
I understand now, thanks. – Emilio Calvano Jul 19 '13 at 18:26
up vote 2 down vote accepted

If you don't like the output format for Piecewise because it contains the default choice True, you may find it clearer to bring the output into a form that uses ConditionalExpression as follows:

p = Probability[
   g <= m && m <= -g + 1, {m, g} \[Distributed] 
    UniformDistribution[{{0, 1}, {0, gg}}]];

probability /. Solve[probability == p, probability, Reals]

$$\left\{ \text{ConditionalExpression}\left[1-\text{gg},\text{gg}<\frac{1}{2}\right],\text{Conditional Expression}\left[\frac{1}{4\text{gg}},\text{gg}>\frac{1}{2}\right]\right\} $$

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.