MathGroup Archive 2005

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

Search the Archive

Re: Complex Oddity

  • To: mathgroup at
  • Subject: [mg57480] Re: Complex Oddity
  • From: Bill Rowe <readnewsciv at>
  • Date: Sun, 29 May 2005 01:03:40 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 5/28/05 at 5:39 AM, nospamjreed at (John Reed) wrote:

>I was trying to separate the real and imaginary parts of a
>complicated expression, and ended up with something strange.  Here
>is a short version of what happened.

>Let z = x + I y, then realPart = z /. {Complex[a_,b_]->a} gives
>realPart = x.  Great!

>Now, try imagPart = z /. {Complex[a_,b_]->b}  returns with imagPart
>= x + y. Oops

>In my original expression, it was harder to see, but the same error
>was occuring. 

This isn't an error. To see why consider

z = x + I*y; 

Out[2]//FullForm=FullForm[x + Complex[0, 1]*y]

In your first example, the rule Complex[a_,b_]->a replaces the expression Complex[0,1] with 0 and the entire expression becomes x + 0 y which of course is x.

In the second example, Complex[0,1] gets replaced by 1 and of course the expression becomes x + y.
To reply via email subtract one hundred and four

  • Prev by Date: Re: Limit of list
  • Next by Date: Re: Solve question
  • Previous by thread: Re: Complex Oddity
  • Next by thread: Re: Complex Oddity