| Author |
Comment/Response |
yehuda ben-shimol
|
05/02/12 09:21am
Well, after some head scratching, Mathematica sure can do that EASILY, but this is not for the novice user
start with your expression (I used InputForm for that)
expr = Implies[p && Not[q], Not[s]]
you want to decompose your function to all of its subexpressions, and for that you need to use Level[]
lv = SortBy[Level[expr, {0, -1}], Depth]
Now, if you want to generate your truth table elegantly, use
BooleanTable[lv,{p,q,s}]
and display that as
TableForm[BooleanTable[lv, {p, q, s}],
TableHeadings -> {None, StandardForm /@ lv}]
Thats it
yehuda
URL: , |
|