Re: confused about asserting variable is element of Reals
- To: mathgroup at smc.vnet.net
- Subject: [mg103099] Re: confused about asserting variable is element of Reals
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Tue, 8 Sep 2009 05:56:37 -0400 (EDT)
- References: <h829lj$3tg$1@smc.vnet.net>
On 2009.09.07. 8:36, dushan wrote:
> I'm still learning Mathematica (using 7.0.1) and don't understand
> Mathematica's response. After finally finding out how to assert that a
> variable is real, I tried to verify this by asking Mathematica to show me that
> it knew the imaginary part of the variable is zero. But I couldn't
> find a way to do that.. Here're my instructions:
>
> In[1]:= a (ESC)el(ESC) Reals
> Out[1]:= a (the element-of symbol) Reals
>
> In[2]:= ##Im[a]
> Out[2]:= Im[a]
>
> where '##' is any of {null, Refine[, Simplify[, FullSimplify[}. I
> also tried some other combinations, such as 'a^2 - Re[a]^2', but these
> didn't help either.
>
> What am I doing wrong? How do I verify such things?
>
I recommend reading through this introductory tutorial:
http://reference.wolfram.com/mathematica/tutorial/UsingAssumptions.html
x \[Element] Reals does not tell Mathematica to treat x as a real number
in the future, just like x == 2 doesn't assign the value 2 to x.
However, these expressions can be used in assumptions.
Simplify[Im[x], x \[Element] Reals]
Assuming[x \[Element] Reals, Simplify[Im[x]]]
Assuming[x == 2, Refine[x]]
I hope this helps,
Szabolcs