MathGroup Archive 2009

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106048] Re: More /.{I->-1} craziness
  • From: "Norbert P." <bertapozar at gmail.com>
  • Date: Thu, 31 Dec 2009 03:16:13 -0500 (EST)
  • References: <hhf5s3$h4o$1@smc.vnet.net>

On Dec 30, 1: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.)

It might seem inconsistent, but as you can read in tutorial/
PatternsForSomeCommonTypesOfExpression:
   "Especially for some common kinds of expressions, the standard
output format used by   Mathematica is not particularly close to the
full internal form. But it is the internal form that you must use in
setting up patterns. "

So when you look at the expressions you give:
In[1]:= FullForm/@{I,-I,E,-E,Pi,-Pi,Infinity,-Infinity}
Out[1]= {Complex[0,1],Complex[0,-1],E,Times[-1,E],Pi,Times
[-1,Pi],DirectedInfinity[1],DirectedInfinity[-1]}

Hope that helps,
Norbert


  • Prev by Date: Discount continues: A WorkLife FrameWork....
  • Next by Date: Re: bug in RandomChoice if weight is zero?
  • Previous by thread: Re: More /.{I->-1} craziness
  • Next by thread: Re: More /.{I->-1} craziness