Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Truth table for intermediate steps' topicStudent Support Forum > General > "Truth table for intermediate steps"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'Truth table for intermediate steps')
Author Date Posted
Truth table for intermediate steps Nicolas 04/30/12 00:53am
Re: Truth table for intermediate steps Patrick 05/01/12 2:50pm
Re: Truth table for intermediate steps yehuda ben-s... 05/02/12 09:21am
Re: Re: Truth table for intermediate steps Nicolas E. 05/02/12 2:42pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic