MathGroup Archive 2009

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106050] Re: More /.{I->-1} craziness
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Thu, 31 Dec 2009 03:16:36 -0500 (EST)
  • References: <hhf5s3$h4o$1@smc.vnet.net>

AES 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.)
> 
I can't really see what point you are trying to make. One of the first 
things you learn about replacement rules is that they operate 
structurally, and the structure of -I (FullForm[-I]) is Complex[0,-1], 
which clearly does not match FullForm[I], which is Complex[0,1] - end of 
story!

Complex numbers are represented in this way internally for efficiency 
for fairly obvious reasons when you consider the range of things you can 
do with complex expressions.

Conjugate will give you a proper complex conjugate.

There is nothing special about I - there are lots of expressions that do 
not transform as one might naively expect - again FullForm will reveal why:

1/Sqrt[x] /. Sqrt[x] -> Q

Exp[x] /. Exp -> Q

etc.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: bug in RandomChoice if weight is zero?
  • Next by Date: Re: Weird localization bug!
  • Previous by thread: Re: More /.{I->-1} craziness
  • Next by thread: Re: More /.{I->-1} craziness