Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Is it doable in Mathematica? How?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39751] Re: Is it doable in Mathematica? How?
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Thu, 6 Mar 2003 02:34:57 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <b3v7ef$k96$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <b3v7ef$k96$1 at smc.vnet.net>,
 "Konrad Den Ende" <chamsterkonrad at bigfoot.com> wrote:

> I'd like to create a truth table for, say, A, B and C, as
> well as two different expression, say, A&&B&&C and
> (A||B) -> C. How do i go about that?
> 
> I have tried Table, but since True/False are not allowed
> there i got stuck. The help in Mathematica was of little
> help in this case. Any hints or suggestions?

You can use Distribute (or Outer) to produce all possible A, B, C. Then 
you can use @@@ (Apply at level 1) to apply the Boolean operators:

 Transpose[Module[{tab=Distribute[Table[{False,True},{3}],List,List]},
  Join[Transpose[tab],{And @@@ tab},{Implies[#1 || #2, #3] & @@@ tab}]]]

Then use TableForm to display with headings:

 TableForm[%, TableHeadings -> 
   {None, {A, B, C, A && B && C, Implies[A || B, C]}}]

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul



  • Prev by Date: Mathlink problem with binary.tm in Linux
  • Next by Date: How do i open a notebook from mathlink (python)
  • Previous by thread: Re: Re2: Is it doable in Mathematica? How?
  • Next by thread: Re: Is it doable in Mathematica? How?