Re: Intersection @ Complement

*To*: mathgroup at smc.vnet.net*Subject*: [mg58133] Re: [mg58104] Intersection @ Complement*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Sun, 19 Jun 2005 03:43:48 -0400 (EDT)*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst*References*: <200506181008.GAA08852@smc.vnet.net>*Reply-to*: murray at math.umass.edu*Sender*: owner-wri-mathgroup at wolfram.com

I see nothing whatsoever "crazy" about this behavior. Perhaps not what YOU expected, but definitely not "crazy"! There is no built-in set type of object in Mathematica. But Intersection and Complement are set operations, not list operations. So Mathematica gives exactly what I would expect when I intesect or complement the SETS of elements in the given lists. And in all the cases shown, the result is a sorted list representing the corresponding set. Zak Seidov wrote: > Some crazy thing Mmca does with > Intersection/Complement: > > s1={1,2,5,7,4,4,1};s2={1,6,3,5,7,7,1,6}; > Intersection[s1,s2] > {1,5,7} (* not {1,1,5,7} ?!*) > Complement[s1,s2] > {2,4} (* not {2,4,4} ?!*) > Complement[s2,s1] > {3,6} (* not {3,6,6,7} ?!*) > > Interestingly, in both cases Mmca Help > says that the result is SORTED list, > while actually it's UNION not SORT that works?! > And note that in the last case 7 is absent at all ?! > what d'u think about this? thanks a lot, zak -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**References**:**Intersection @ Complement***From:*Zak Seidov <zakseidov@yahoo.com>