bags? 2.5.x?

Carsten Haese carsten at uniqsys.com
Sat Feb 2 12:28:45 EST 2008


On Sat, 2008-02-02 at 01:17 -0800, Paul Rubin wrote:
> Arnaud Delobelle <arnodel at googlemail.com> writes:
> > * For sets {x, y} union {y, z} = {x, y, z}.  The natural way of
> >   extending this to multisets is having the union operator take the
> >   max of the multiplicities of each element, i.e.
> 
> That certainly doesn't fit the intuition of a bag of objects.  I'd
> think of the union of two bags as the result of dumping the contents
> of both bags onto the table, i.e. you'd add the two vectors.

In addition to possibly being more intuitive, the latter also agrees
with a use case of bags in complex analysis. If you consider the zeroes
of complex polynomials, let B1 be the zeroes of polynomial P1, and B2 be
the zeroes of polynomial P2, then B1+B2 are the zeroes of the product
P1*P2.

Simple example: P1(z)=z-1, P2(z)=(z-1)^2. P1 has a simple zero at z=1,
P2 has a double zero at z=1. The product is (z-1)^3, which has a triple
zero at z=1.

-- 
Carsten Haese
http://informixdb.sourceforge.net





More information about the Python-list mailing list