Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: BitAnd[True,False]
Replies: 6   Last Post: Sep 27, 2013 2:37 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ernst H.K. Stelzer

Posts: 12
Registered: 2/14/12
Re: BitAnd[True,False]
Posted: Sep 26, 2013 3:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

BooleanTable[{p, q, And[p, q]}, {p, q}] // TableForm

True True True
True False False
False True False
False False False

BitAnd operates on the bits in an integer

{#1, #2, BitAnd[#1, #2]} & @@@ Tuples[{0, 1}, {2}] // TableForm

0 0 0
0 1 0
1 0 0
1 1 1


Greetings

Ernst


-----Original Message-----
From: Alan [mailto:alan.isaac@gmail.com]
Sent: Wednesday, 25 September, 2013 08:37 AM
Subject: BitAnd[True,False]

I'd hoped BitAnd would work on Boolean Lists so I gave it a try. If it had simply failed completely I'd be disappointed but would understand. But oddly, it half succeeds. Why? BitOr fails the same way, and BitNot always fails.

I just want to understand these results. I know there are ways to get the output I want.

Thanks,
Alan Isaac
(using Mathematica 9)

In[77]:= BooleanTable[{p,q,BitAnd[p,q]},{p,q}]//TableForm
Out[77]//TableForm=
True True True
True False BitAnd[False,True]
False True BitAnd[False,True]
False False False






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.