[Numpy-discussion] Boolean binary '-' operator

Nathaniel Smith njs at pobox.com
Tue Jun 27 19:07:20 EDT 2017


On Tue, Jun 27, 2017 at 3:09 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Tue, Jun 27, 2017 at 3:01 PM, Benjamin Root <ben.v.root at gmail.com> wrote:
>>
>> Forgive my ignorance, but what is "Z/2"?
>
> https://groupprops.subwiki.org/wiki/Cyclic_group:Z2
> https://en.wikipedia.org/wiki/Cyclic_group

This might be a slightly better link?
https://en.wikipedia.org/wiki/Modular_arithmetic#Integers_modulo_n

Anyway, it's a math-nerd way of saying "the integers modulo two", i.e.
the numbers 0 and 1 with * as AND and + as XOR. But the nice thing
about Z/2 is that if you know some abstract algebra, then one of the
most fundamental theorems is that if p is prime then Z/p is a "field",
meaning that * and + are particularly well-behaved. And 2 is a prime,
so pointing out that the bools with AND and XOR is the same as Z/2 is
a way of saying "this way of defining * and + is internally consistent
and well-behaved".

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the NumPy-Discussion mailing list