MathGroup Archive 2008

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

Search the Archive

Re: Domains

  • To: mathgroup at
  • Subject: [mg85330] Re: Domains
  • From: David Bailey <dave at>
  • Date: Wed, 6 Feb 2008 05:40:43 -0500 (EST)
  • References: <foavks$hn3$>

Akki wrote:
> Hi,
> How does one create a domain for a variable in Mathematica ?
> For e.g. x is a variable and I would like to create a domain for x
> consisting  of 3, 5, 7 only.
> i.e. dom = {3,5,7} then use the condition \Element[x,dom]
> Thanks,
> Akki
Variables don't have domains as such, but you can create a variable that 
contains a list that will act as a domain. Thus, suppose you have:


then you can test if x is in that domain by using:


It might be helpful if you described at slightly greater length what it 
is you are trying to do - maybe with some code. For example, as written, 
it is up to you to remember that xdom is the domain of x. If you were 
dealing with many variables, it might be worth automating this so that 
you could write something like withinDomain[x].

David Bailey

  • Prev by Date: Re: NDSolve: PDE's with more than 2 indep. variables.
  • Next by Date: Re: Efficient way of reading matrices
  • Previous by thread: Re: Domains
  • Next by thread: Re: Domains