Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

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

Search the Archive

Re: BitAnd[True,False]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131740] Re: BitAnd[True,False]
  • From: "Ernst H.K. Stelzer" <ernst.stelzer at physikalischebiologie.de>
  • Date: Thu, 26 Sep 2013 03:44:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20130925063645.E297C6A74@smc.vnet.net>

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 at gmail.com]
Sent: Wednesday, 25 September, 2013 08:37 AM
To: mathgroup at smc.vnet.net
Subject: [mg131740] 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





  • Prev by Date: Re: BitAnd[True,False]
  • Next by Date: Helping people on the internet -- was: Re: a simple question
  • Previous by thread: Re: BitAnd[True,False]
  • Next by thread: Re: BitAnd[True,False]