MathGroup Archive 1992

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

Search the Archive

Re: Replace

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Replace
  • From: p617hfa at sun24.mpifr-bonn.mpg.de (Heino Falcke)
  • Date: Fri, 9 Oct 92 09:36:51 +0100

John Pender complains:

>In[4]:= 5 I /. I->-I
>
>Out[4]= 5 I        *************  what the hell?
>
>the fact that mma won't make the substitution if there is anything in front 
>of I in the expression of interest blows the whole deal.  


Just have a look at complex numbers with FullForm. Don't get confused
by the OutputForm I representation.

In[1]:= FullForm[5 I]

Out[1]//FullForm= Complex[0, 5]

In[2]:= FullForm[-I]

Out[2]//FullForm= Complex[0, -1]

The correct substitution would be Complex[a_,b_] :> Complex[a,-b]
But it's true this is a little bit confusing.

Heino Falcke






  • Prev by Date: Memory management by Share[]?
  • Next by Date: Re: Memory management by Share[]?
  • Previous by thread: Replace
  • Next by thread: Mma vectors do not have to be one-dimensional