MathGroup Archive 1998

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

Search the Archive

Re: Complex -> List does not work



It  probably does not answer the question "why" but the following might
throw some light it:

In[28]:=
ReleaseHold[Hold[Complex[2,3]]/.Complex->List]

Out[28]=
{2,3}

In[29]:=
ReleaseHold[Hold[2+3 I]/.Complex->List]

Out[29]=
2+3 I

So 2+3 I is not "really" the same as Complex[2,3]. After evaluating
Complex[2,3] its head Complex  behaves like the head "Integer" that
(for example) the integer 2 has rather than like the head List in
{2,3}.

At 2:22 AM -0500 1/20/98, Gianluca Gorni wrote:
>Hello!
>
>I naively tried the following way of turning a complex number into a
>couple of real numbers:
>
>         2 + 3 I /. Complex -> List
>
>but it gives me back
>
>                2 + 3 I
>
>even though the full form of 2+3I is Complex[2,3]. The reverse however
>is possible:
>
>   {2,3}/.List->Complex  gives  2+3I
>
>The help browser says that "you have to use Re and Im to extract parts
>of Complex numbers".
>
>Why this exception to the basic principles of replacement rules?
>
>                 Gianluca Gorni
>
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>Gianluca Gorni
>Universita` di Udine
>Dipartimento di Matematica e Informatica via delle Scienze 208
>I-33100 Udine UD
>Italy
>
>Ph.:(39) (432) 558422    Fax:(39) (432) 558499
>mailto:gorni@dimi.uniud.it
>http://www.dimi.uniud.it





  • Prev by Date: RE: Re[a + I b] = a
  • Next by Date: RE: Method to eliminate
  • Prev by thread: Complex -> List does not work
  • Next by thread: Re: Complex -> List does not work