Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doing probabilistic calculations on a higher abstraction level

To the downvoters: this isn't a question about mathematics, it's a question about the programming language Mathematica.

One of the prime characteristics of Mathematica is that it can deal with many things symbolically. But if you come to think about it, many of the symbolic features are actually only halfway symbolic.

Take vectors for instance. We can have a symbolic vector like {x,y,z}, do a matrix multiplication with a matrix full of symbols and end up with a symbolic result and so we might consider that symbolic vector algebra. But we all know that, right out of the box, Mathematica does not allow you to say that a symbol x is a vector and that given a matrix A, A . x is a vector too. That's a higher level of abstraction, one that Mathematica (currently) does not very well deal with.

Similarly, Mathematica knows how to find the 5th derivative of a function that's defined in terms of nothing than symbols, but it's not well geared towards finding the r th derivative (see the "How to find a function's rth derivative when r is symbolic in Mathematica?" question).

Furthermore, Mathematica has extensive Boolean algebra capabilities, some stone age old, but many recently obtained in version 7. In version 8 we got Probability and friends (such as Conditioned) which allows us to reason with probabilities of random variables with given distributions. It's a really magnificent addition which helps me a lot in familiarizing myself with this domain, and I enjoy working with it tremendously. However,...

I was discussing with a colleague certain rules of probabilistic logic like the familiar

enter image description here

i.e., the conditional probability of event/state/outcome C given event/state/outcome A is true.

Specifically, we were looking at this one:

enter image description here

and although I had spoken highly about Mathematica's Probability just before I realized that I wouldn't know how to solve this right away with Mathematica. Again, just as with abstract vectors and matrices, and symbolic derivatives, this seems to be an abstraction level too high. Or is it? My question is:

Could you find a way to find the truth or falsehood in the above and similar equations using a Mathematica program?

like image 596
Sjoerd C. de Vries Avatar asked Nov 26 '11 22:11

Sjoerd C. de Vries


2 Answers

>> Mathematica does not allow you to say that a symbol x is a vector

Sure it does... Close enough anyway... that it's a collection of Reals. It's called assumptions or conditioning, depending on what you want to do.

Refine[Sqrt[x]*Sqrt[y]]

The above doesn't refine because it assumes X and Y can be any symbol, but if you narrow their scope, you get results:

Assuming[ x > 0 && y > 0, Refine[Sqrt[x]*Sqrt[y]]]

It would be very nice to have the ability to say: Element[x,Reals^2] (2-dimensional real vector), maybe in Mathematica 9. :-)


As for this problem:

>> Could you find a way to find the truth or falsehood in the above and similar equations using a Mathematica program?

Please refer to my answer (first one) on this question to see a symbolic approach to Bayes theorem: https://stackoverflow.com/questions/8378336/how-do-you-work-out-conditional-probabilities-in-mathematica-is-it-possible

like image 167
Gregory Klopper Avatar answered Oct 17 '22 01:10

Gregory Klopper


Just glanced at this and found an example from the documentation on Condition:

In[1]:= c = x^2 < 30; a = x > 1;

(Sorry for the formatting here...)

In[2]:= Probability[c \[Conditioned] a, x \[Distributed] PoissonDistribution[2]] == 
Probability[c && a, x \[Distributed] PoissonDistribution[2]] / Probability[a, x \[Distributed] PoissonDistribution[2]]

Which evaluates to True and corresponds to a less general version of the first example you gave.

I'll revisit this later tonight if I have time.

like image 21
telefunkenvf14 Avatar answered Oct 17 '22 00:10

telefunkenvf14