MathGroup Archive 2009

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

Search the Archive

Re: More /.{I->-1} craziness

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106039] Re: More /.{I->-1} craziness
  • From: ADL <alberto.dilullo at tiscali.it>
  • Date: Thu, 31 Dec 2009 03:14:24 -0500 (EST)
  • References: <hhf5s3$h4o$1@smc.vnet.net>

The reason is this:
In[1]:= I // FullForm
Out[1]//FullForm= Complex[0,1]

In[2]:= 1 + I // FullForm
Out[2]//FullForm= Complex[1,1]

So, "I" is simply a way to write down quickly the expression Complex
[0,1], while E and Pi directly represent the numbers E and Pi, without
any intermediate transformation.

Consequently, one should write:
In[3]:= 1 - 2 I /. Complex[x_, y_] -> Complex[x, -y]
Out[3]= 1+2*I

As far as I understand, in Mathematica, the transformation rules for
complex numbers should be always entered explicitly involving the
whole complex plane Complex[x_,y_].

The difference between symbols representing real numbers (E, Pi, ...)
and the complex I may be confusing: while this behavior is clearly
stated ("Numbers containing I are converted to the type Complex.") and
described in the section "Possible Issues", it is not explained
immediately and the only way to reveal it is using FullForm. Perhaps,
it should be reported in the "Basic examples".

ADL


On Dec 30, 10:17 am, AES <sieg... at stanford.edu> wrote:
> The more I play with these I->-I substitution rules, the more seemingly
> wildly inconsistent results emerge.  For example:  
>
>    In[1]:= -I/.I->-I
>
>    Out[1]= -I
>
>    In[3]:= -E/.E->-E
>
>    Out[3]= << The Esc e e Esc symbol >>
>
>    In[4]:= -Pi/.Pi->-Pi
>
>    Out[4]= \[Pi]
>
>    In[5]:= -Infinity/.Infinity->-Infinity
>
>    Out[5]= -\[Infinity]
>
> (In/Out[2] is removed because it was an irrelevant cell.)



  • Prev by Date: Re: Re: Replace and ReplaceAll -- simple application
  • Next by Date: Re: More /.{I->-1} craziness
  • Previous by thread: Re: More /.{I->-1} craziness
  • Next by thread: Discount continues: A WorkLife FrameWork....