Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Complex Oddity

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

On 5/28/05 at 5:39 AM, nospamjreed at alum.mit.edu (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

In[1]:=
z = x + I*y; 
FullForm[z]

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