# From built-in symbols to algebraic representation

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?

• It does not appear that Mathematica takes the straightforward path. Evaluate Probability[x > 0, x \[Distributed] UniformDistribution[{-1, 1}]] // Trace – Bob Hanlon Jan 15 '16 at 14:04
• 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! – Michael E2 Jan 15 '16 at 14:07
• @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. – Gleb Jan 15 '16 at 14:12
• Sometimes these things are done by table lookup. That seems likely with common, simple distributions like UniformDistribution. – Michael E2 Jan 15 '16 at 14:18

## 1 Answer

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}]

• Thanks a lot! That seems to answer my question :) – Gleb Jan 20 '16 at 12:17