Re: confused about asserting variable is element of
- To: mathgroup at smc.vnet.net
- Subject: [mg103196] Re: [mg103084] confused about asserting variable is element of
- From: dushanm at spinn.net (Dushan Mitrovich)
- Date: Thu, 10 Sep 2009 07:21:12 -0400 (EDT)
Many thanks to all who replied. Bob Hanlon's several alternative usages
were particularly informative. The one I was most interested in, also
suggested by Dan Litchblau:
$Assumptions = Element[a, Reals];
or
$Assumptions = $Assumptions && Element[a, Reals];
Leonid Shifrin notes that
In some hypothetical procedural language the statement Element[a, Reals]
would only make sense if it globally assigns <a> a property of being
real.
In fact, this is precisely what I want: an instruction telling Mathematica
that, within the scope of that particular Notebook and absent user instruc-
tions to the contrary, it is to assume in all procedures that the specified
variable is real. In particular, I don't want to have to re-specify that
property every time I perform an operation, as suggested below:
In Mathematica, everything is an expression, and most expressions don't
introduce side effects (global changes). When you enter Element[a,
Reals], this by itself does nothing. It does not, in particular, change
any global property of symbol <a>. However, this expression can be used
in commands like Simplify, FullSimplify, etc., to give them the informa-
tion that <a> should be considered real (in that particular computation)
I did initially refer to the UsingAssociations.html article, where I found
this description,
x \[Element\ dom or Element[x,dom] assert that x is an element
of the domain dom
This seemed like a straightforward statement of what I wanted to do, so
that's what I tried. The problem is that I thought it was an instruction
that applied globally to that Notebook. Now I've learned better.
Thanks for all the help and education.
- Dushan
- Follow-Ups:
- Re: Re: confused about asserting variable is
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: Re: confused about asserting variable is