Re: Logic and Truth Tables with Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg29853] Re: Logic and Truth Tables with Mathematica?
- From: "Orestis Vantzos" <atelesforos at hotmail.com>
- Date: Fri, 13 Jul 2001 04:19:35 -0400 (EDT)
- Organization: National Technical University of Athens, Greece
- References: <9iji4d$ris$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
ShowTruthTable[logicF_] := Module[{TT = Outer[logicF, {False, True}, {False, True}]}, TT = Map[ToString, TT, {2}]; GridBox[{{ToString@logicF, "False", "True"}, {"False"}~Join~ TT[[1]], {"True"}~Join~TT[[2]]}, ColumnLines -> {True, False}, RowLines -> {True, False}] // DisplayForm] The argument is the logical function you want to study. If you don't want to create a table, but just want the truth table in matrix form, just use the Outer[...] expression. Orestis <heathw at in-tch.com> wrote in message news:9iji4d$ris$1 at smc.vnet.net... > Hi, > Can Mathematica, given a relation such as P->Q generate the truth table? > Is there a book available that talks about Mathematica and logic? > Thanks, > Heath >