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

closed as off-topic by Daniel Lichtblau, MarcoB, march, RunnyKine, Louis Apr 6 at 17:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, MarcoB, march, RunnyKine, Louis
If this question can be reworded to fit the rules in the help center, please edit the question.

5  
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
1  
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 5 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

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