# Pseudo-code for rules of probability?

I am having a hard time in Stats understanding some basic rules of probability and set-theory, namely $P(A|B)$, $P(A\ \textrm{and}\ B)$ and $P(A\ \textrm{or}\ B)$ where $A$ and $B$ depend on each other. I use Mathematica all the time through my school, and I love to program in my free-time (sometimes writing small scripts for Mathematica).

I can understand confusing subjects that deal with logic when they are in a programming language syntax, so I thought I could understand what's going on better if I had a written syntax to look at. Will anyone bother to help?

• Are you asking for an example on how to deal with Bayes theorem in Mathematica? – Stefan Jul 18 '13 at 8:02
• @Stefan In a way, yes. Basically, what would the code for those three basic rules look like in Mathematica's programming language so that I can play around with it to understand it better? – jocopa3 Jul 18 '13 at 8:12

The Wolfram Demonstration Project has 13 submissions that use Bayes Theorem: See here

More specifically:

Probability Of Being Sick After Having Tested Positive For A Disease

Bayes's Theorem And Inverse Probability

Total Probability And Bayes's Theorem