[Date Index]
[Thread Index]
[Author Index]
domains as sets
*To*: mathgroup at smc.vnet.net
*Subject*: [mg95817] domains as sets
*From*: Murray Eisenberg <murray at math.umass.edu>
*Date*: Wed, 28 Jan 2009 06:28:51 -0500 (EST)
*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst
*Reply-to*: murray at math.umass.edu
Mathematica has no built-in structure of "set". A list has an explicit
order. A reasonable thing to do is to decree a list S to be a set if it
has no duplicate elements, i.e.:
setQ[S_]:= (ListQ[x] && (Sort[x] == Union[x])
That's OK for finite sets.
But I'm trying to set up some definitions that will allow me also to
treat at least some infinite sets in the same framework. And I want to
extend the available domains so as to include some other common ones,
such as the set Naturals of natural numbers (i.e., nonnegative integers).
Here's a start:
domainQ[dom_] :=
MemberQ[{Naturals, Reals, Integers, Complexes, Algebraics, Primes,
Rationals, Booleans}, dom]
setQ[x_] := (ListQ[x] && (Sort[x] == Union[x])) ~Or~ domainQ[x]
finiteQ[x_] := setQ[x] && ! domainQ[x]
Next, I want to allow ordinary elementhood, denoted by what in
Mathematica would be typed as Esc elem Esc, to work for both finite sets
and domains, including the newly introduced domains. Here's what seems
to be a way:
Unprotect[Element];
Element[x_,Naturals]:=Element[x,Integers]&&NonNegative[x]
Element[x_,lis_?finiteQ]:=MemberQ[lis,x]
Protect[Element];
So far this all seems OK. But I want to proceed to subset inclusion,
union, intersection, cartesian product, etc. Do you see any obvious, or
not-so-obvious snags for doing so that would be caused by the preceding
start?
--
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
Prev by Date:
**Re: specifying the integration interval using a function**
Next by Date:
**Re: Partial derviatives in mathematica**
Previous by thread:
**HDF data Import**
Next by thread:
**Sampling from a simplex: part 2**
| |