I came across this post http://www.stiglerdiet.com/2012/02/10/mathematica-a-love-story/
and in the commented section near the end someone mentions this can not be elegantly done in Maple. I would like to disprove this comment. He says "There’s NO WAY any numeric language like R or Maple can try to do this."
I don't believe it, and I welcome anyone to disprove his comment. Or anyone to comment on the topic.
I have replicated his comment here:
quote...
I want to quickly touch up on symbolic language…. Someone mentioned Maple… try this in Maple…
First, I define Bayes’ Theorem and probabilistic logic through symbolic use (looks a lot prettier in Mathematica, where a lot of this text is special symbols):
Remove[P]
Unprotect@Intersection;
Intersection[A_Symbol, B_Symbol] := {A, B}
Intersection[A_Not, B_Symbol] := {A, B}
Intersection[A_Symbol, B_Not] := {A, B}
P[Int_List /; Length@Int == 2] :=
P[Int[[2]] [Conditioned] Int[[1]]] P[Int[[1]]]
P[B_, A_] :=
If[NumericQ@B, B,
P[B [Conditioned] A] P[A] + P[B [Conditioned] Not@A] P[Not@A]]
P[Not@B_, A_: 1] := If[NumericQ@A, 1 - P[B], 1 – P[B, A]]
P[A_ [Conditioned] B_] := P[A [Intersection] B]/P[B, A]
P[Not@A_ [Conditioned] B_] := 1 – P[A [Conditioned] B];
Then I use it, and query various probabilities:
P[Sunny] = .7;
P[Happy [Conditioned] Sunny] = .9;
P[Happy [Conditioned] [Not] Sunny] = .4;
P[Sunny [Conditioned] Happy]
Answer: 0.84
P[Cancer] = .01;
P[Test [Conditioned] Cancer] = 0.9
P[Test [Conditioned] ! Cancer] = 0.2
P[Test, Cancer]
P[! Test, Cancer]
Answers: 0.207, 0.793
P[Cancer [Conditioned] Test]
P[! Cancer [Conditioned] Test]
P[Cancer [Conditioned] ! Test]
P[! Cancer [Conditioned] ! Test]
Answers: 0.0434783, 0.956522, 0.00126103, 0.998739
As ugly as this code may look to the uninitiated in text, it’s actually very pretty and elegant in Mathematica. There’s NO WAY any numeric language like R or Maple (and even MATLAB without expensive symbolic package) can try to do this. It’s just a whole new level of juicy stuff! 
...end quote