Re: how implement sets
- To: mathgroup at smc.vnet.net
- Subject: [mg41520] Re: how implement sets
- From: Murray Eisenberg <murraye at attbi.com>
- Date: Sat, 24 May 2003 01:04:21 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <8C4EF710DD920AC-428-10B7@App2>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
I looked at those items and I don't think they do what I'm asking about! Bobby Treat wrote: > Have a look at > > http://library.wolfram.com/infocenter/BySubject/Mathematics/Foundations/SetTheory/ > > > Bobby > > -----Original Message----- > From: Murray Eisenberg <murraye at attbi.com> To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net > Sent: Fri, 23 May 2003 03:29:33 -0400 (EDT) > Subject: [mg41520] how implement sets > > Mathematica has no built-in data type for sets in the mathematical sense > (no implied order of elements). This is to ask your advice in how in > Mathematica to implement sets, for use in teaching math, where the > distinction between an "ordered set" and just a plain "set" is crucial. > > Inherently, lists in Mathematica have an order, so List itself certainly > cannot be the correct thing to use. Here are two possibilities: > > (1) A set is a list with no repeated parts. Then a function SetQ is > needed to test that. Obvious definition: > > SetQ[x_] := ListQ[x] && Length[Union[x]] == Length[x] > > (2) Create a new "datatype" by using an appropriately-named head, such > as -- WHAT? Mathematica has already appropriated the word Set for > something else, of course. Perhaps Class or Collection? (And then > overload Union, Intersection, Complement so they do what they should > with such objects.) -- 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