Re: Is it doable in Mathematica? How?
- To: mathgroup at smc.vnet.net
- Subject: [mg39719] Re: [mg39704] Is it doable in Mathematica? How?
- From: Helge Andersson <helge at envic.chalmers.se>
- Date: Mon, 3 Mar 2003 23:48:57 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Konrad, Use ReplaceAll and Rule to a table of zeros and ones. Here is an example of your first example. tab=Flatten[Table[{i,j,k},{i,0,1},{j,0,1},{k,0,1}],2]/.{0->False,1->True}; och=And[Evaluate[Sequence@@tab[[#]]]]&/@Range[Length[tab]]; eller=Or[Evaluate[Sequence@@tab[[#]]]]&/@Range[Length[tab]]; TableForm[Fold[Append,Transpose[tab],{{},och,eller}],TableHeadings->{{"A","B","C"," ","And","Or"},Range[Length[tab]]}] /Helge Andersson Chalmers Sweden At 04:25 2003-03-03 -0500, you 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? > >-- > >Vänligen >Konrad >--------------------------------------------------- >phone #1: (+46/0) 708 - 70 73 92 >phone #2: (+46/0) 704 - 79 96 95 >url: http://konrads.webbsida.com >e-mail: chamsterkonrad at bigfoot.com >----------------------------------- > >Sleep - thing used by ineffective people > as a substitute for coffee > >Ambition - a poor excuse for not having > enough sence to be lazy >---------------------------------------------------