Re: finite domains
- To: mathgroup at smc.vnet.net
- Subject: [mg53053] Re: finite domains
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Wed, 22 Dec 2004 04:52:43 -0500 (EST)
- Organization: The University of Western Australia
- References: <cp3t2v$9ai$1@smc.vnet.net> <200412201134.GAA02658@smc.vnet.net> <cq8u48$h47$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cq8u48$h47$1 at smc.vnet.net>, János <janos.lobb at yale.edu>
wrote:
> I looked at the article and I understand that for that particular case.
> However that case fell back in the definition on an already existing
> infinite domain of the same order namely Z. There is also a similar
> definition in the Book for Odd numbers.
>
> In my case I cannot fall back on an existing finite domain, or I do not
> know how to explore/exploite it with Boolean.
>
> I am thinking of a domain named Irany having elements
> {North,East,South,West}. How can I do that without a reference to a
> more basic domain as foundation and expect that
> Element[NorthWest,Irany] will give me False?
The following code does what _you_ want:
Irany /: Element[x_, Irany]:= MemberQ[{North,East,South,West}, #]& /@ x
Element[{North, West}, Irany]
Element[NorthWest, Irany]
However, this violates the "spirit" of Mathematica because, for an
arbitrary symbol, the definition should return the unevaluated
expression -- but if you try
Element[y, Irany]
you get false, rather than the unevaluated expression. Now, y could be
North, or it could be NorthWest ...
Cheers,
Paul
--
Paul Abbott Phone: +61 8 6488 2734
School of Physics, M013 Fax: +61 8 6488 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto:paul at physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul
- Follow-Ups:
- Re: Re: finite domains
- From: János <janos.lobb@yale.edu>
- Re: Re: finite domains
- References:
- Re: finite domains
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Re: finite domains