Message Boards Message Boards

0
|
7606 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Convert from a closed form to the truth table using Boolean functions?

Posted 7 years ago

Hello!

I would like to understand how to work with boolean functions in a better way. Can you show me how to convert from a closed form to the truth table, ANF or DNF? For example, say I have a polynomial on four variables,

f(w,x,y,z) = wx + yz

This should be in ANF like this:

[Xor[x1x2,x3x4] so I feel like I should be able to get Mathematica to spit out a truth table, but this>

Boole[BooleanTable[Xor[x1*x2, x3*x4]]]

does not work at all.

How can I get the truth table from that? Doing it out by hand gets old real fast:)

Thanks! Mary

POSTED BY: Mary Shepard
2 Replies
Posted 7 years ago

Something like this?

In[1]:= Boole@BooleanTable[
    Xor[
        And[x1, x2],
        And[x3, x4]
    ],
    {x1, x2, x3, x4}
  ]

Out[1]= {0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0}
POSTED BY: Hans Milton

What do you mean by multiplication? In Mathematica True and False are NOT treated as 1 and 0. So one can not create an AND function by multiplying. Use the proper functions: And, Or, Xor, Nand, Nor, Xnor et cetera. Furthermore BooleanTable needs a second argument with the variables...

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract