Doing probabilistic calculations on a higher abstraction level
Asked Answered
F

2

19

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?

Footed answered 26/11, 2011 at 22:48 Comment(0)
B
4

>> 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://mcmap.net/q/668446/-how-do-you-work-out-conditional-probabilities-in-mathematica-is-it-possible

Bybidder answered 12/12, 2011 at 19:54 Comment(0)
M
2

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.

Mopup answered 28/11, 2011 at 3:23 Comment(2)
This is an example of the intermediate level of abstraction I have been talking about. The first equation I used in the question is true without any specification of distributions and other relations. It's like having a==b, b==c and concluding that a==c. You do this by providing instances of a,b, and c and showing its true. It's not quite the same, but I think you understand what I mean.Footed
@SjoerdC.deVries - Another example of higher level abstraction occurred to me when I read your Q, but I didn't have time (or desire to bring it up). I originally came across it when reading a book on Haskell (learnyouahaskell.com/starting-out), specifically the section on 'List Comprehensions'. Here's a link to a typeset image illustrating something I wish MMA could do in 'math notation': s3.amazonaws.com/lyah/setnotation.png Yet another example? Symbolic matrix algebra results/derivations/simplifications. (I know someone did work on SO on this a while ago... can't find it now.)Mopup

© 2022 - 2024 — McMap. All rights reserved.