MathGroup Archive 1998

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

Search the Archive

Re: Question for using complex variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13795] Re: Question for using complex variables
  • From: Tobias Oed <tobias at physics.odu.edu>
  • Date: Fri, 28 Aug 1998 04:18:19 -0400
  • Organization: Old Dominion University
  • References: <6r10kv$fjg@smc.vnet.net> <6rravl$1bk@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul Abbott wrote:
> 
> Chongdae Park wrote:
> 
> > Here, x, y, w, and z are all real values. Then I expected
> >
> > Complex[x,y]*Complex[w,z]=(xw-yz)+I(xz+yw)
> 
> First, note that
> 
>   In[1]:= ?Complex
>   "Complex is the head used for complex numbers."
> 
> so, to work with complex variables in explicit form, you should not use
> Complex but instead enter them directly as x+I y, etc.
> 
> Second, ComplexExpand is the operator you want for simplifying complex
> expressions (assuming that the variables x,y,w,z are real):
> 
>   In[2]:= ComplexExpand[(x + I y) (w + I z)]
>   Out[2]= w x - y z + I (w y + x z)

Is this really what you get ? On my machine I have the result:

In[1]:= ComplexExpand[(x + I y) (w + I z)]

Out[1]=w x + I w y + I x z - y z

To get your answer, I need to do: 

In[1]:= test=(x + I y) (w + I z)

Out[1]= (x + I y) (w + I z)

In[2]:=
(Factor[Select[#,!FreeQ[#,Complex,2]&]]+Select[#,FreeQ[#,Complex,2]&])&[Expand[test]]

Out[2]= w x - y z + I (w y + x z)

I think the purpose of the ComplexExpand function is not to expand a 
product of cmplex number, but instead to help simplify expressions 
involving functions dealing with complex numbers:  

In[3]:= ??ComplexExpand   
ComplexExpand[expr] expands expr assuming that all variables are real.
   ComplexExpand[expr, {x1, x2, ... }] expands expr assuming that
variables
   matching any of the xi are complex.

Attributes[ComplexExpand] = {Protected, ReadProtected}
 
Options[ComplexExpand] = 
  TargetFunctions -> {Re, Im, Abs, Arg, Conjugate, Sign}

For expample, if z is complex but x is real 

In[4]:= Re[x z]

Out[4]= Re[x z]

In[5]:= ComplexExpand[%,{z}]

Out[5]= x Re[z]

Tobias

> 
> Cheers,
>         Paul
> 
> ____________________________________________________________________
> Paul Abbott                                   Phone: +61-8-9380-2734
> Department of Physics                           Fax: +61-8-9380-1014
> The University of Western Australia            Nedlands WA  6907
> mailto:paul at physics.uwa.edu.au  AUSTRALIA
> http://www.physics.uwa.edu.au/~paul
> 
>             God IS a weakly left-handed dice player
> ____________________________________________________________________


  • Prev by Date: Re: Disappearing variables
  • Next by Date: Re: Help: How to add label such as "alpha" in plotting?
  • Previous by thread: Re: Question for using complex variables
  • Next by thread: simplifying complex polynomials