can Mathematica be useful for this?
- To: mathgroup at smc.vnet.net
- Subject: [mg56545] can Mathematica be useful for this?
- From: Pedrito <pedrito6 at softhome.net>
- Date: Thu, 28 Apr 2005 02:40:47 -0400 (EDT)
- References: <718e40e89ee7126bf169d5585b776d5c@akikoz.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks a lot Andrzej. Your idea of using Mathematica for the logic algebra simplifications is great. I have been trying different systems of rules for evaluation and finally I found that Mathematica is able to obtain numeric results just with these eight rules: p[True] = 1; p[False] = 0; p[A_] := p[LogicalExpand[A]] /; ! A === LogicalExpand[A]; p[! A_] := 1 - p[A]; p[! A_ && B_] := p[B] - p[A && B]; p[A_ && ! B_] := p[A] - p[A && B]; p[A_ || B_] := p[A] + p[B] - p[A && B]; p[A_, B_] := p[A && B]/p[B]; Now, it's possible to solve the previous probability problem this way: initialData = {p[ S] == 1/3, p[F] == 26/100, p[G] == 2/10, p[F && S] == 15/100, p[F && G] == 5/100, p[G && S] == 1/10, p[F && G && S] == 2/100}; FullSimplify[p[(F && !G && !S) || ( !F && G && !S) || ( !F && !G && S)], initialData] -->19/75 FullSimplify[p[F || G || S], initialData] -->77/150 I have found a case where FullSimplify doesn't evaluate numerically: FullSimplify[p[F], p[F] == 1/10] -->p[F] So I have to write: FullSimplify[p[F]+0., p[F] == 1/10] 0.1 Is there another way for obtaining a numeric result with FullSimplify? Thanks in advance!