Building Your Own Domain
Q: How can I define my own domain so that it behaves similarly to the built-in domains (Section 3.3.10 of The Mathematica Book) such as the integers ()? Specifically, I want to have a domain of natural numbers () which would allow me to do things like and have Element () understand this new domain.
A: Paul Wellin (firstname.lastname@example.org) and Adam Strzebonski (email@example.com) suggest the following definition.
At first sight, this definition might appear more complicated than necessary. However, one cannot use the simpler construct because, for an arbitrary symbol, the definition should return the unevaluated expression.
After we define a Format,
our domain now has a symbolic representation.
Finally, we need to add interpretation rules for expressions involving .
Here is a test of our domain.
Converted by Mathematica May 8, 2000