MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: finite domains


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


  • Prev by Date: Machine date and Mathematica Date
  • Next by Date: Re: Information about subscripted function
  • Previous by thread: Re: Re: finite domains
  • Next by thread: Re: Re: finite domains