4
$\begingroup$

If I have an expression with Mathematica's built-in functions like

Probability[x > 0, x \[Distributed] UniformDistribution[{-1, 1}]]

its algebraic representation would be something like

Integrate[PDF[UniformDistribution[{-1, 1}], x], {x, 0, \[Infinity]}]

If I understand correctly, Mathematica's engine does the transformation from first to second representation and then evaluates it.

Is there a function that will take as input first expression and give me the second?

$\endgroup$
  • 3
    $\begingroup$ It does not appear that Mathematica takes the straightforward path. Evaluate Probability[x > 0, x \[Distributed] UniformDistribution[{-1, 1}]] // Trace $\endgroup$ – Bob Hanlon Jan 15 '16 at 14:04
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Jan 15 '16 at 14:07
  • $\begingroup$ @BobHanlon Ok thanks so it's much more complex than I imagined. Maybe what I'm asking is not possible, or just in some very simple cases. $\endgroup$ – Gleb Jan 15 '16 at 14:12
  • 2
    $\begingroup$ Sometimes these things are done by table lookup. That seems likely with common, simple distributions like UniformDistribution. $\endgroup$ – Michael E2 Jan 15 '16 at 14:18
3
$\begingroup$

You could use pattern-matching on the HoldAll form of the Probability input and transfer from the first form to the second. The three arguments are the predicate, variable, and the distribution. So for your example

{pred, var, dist} = {x>0, x, UniformDistribution[{-1, 1}]}

the equivalence is

Probability[pred, Distributed[var, dist] == 
Integrate[Boole[pred] PDF[dist, x], {x, -Infinity, Infinity}]
$\endgroup$
  • $\begingroup$ Thanks a lot! That seems to answer my question :) $\endgroup$ – Gleb Jan 20 '16 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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