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.

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
2  
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
add comment

1 Answer 1

up vote 1 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
add comment

Your Answer

 
discard

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.