MathGroup Archive 1999

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

Search the Archive

Re: complex variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20757] Re: [mg20754] complex variable
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Thu, 11 Nov 1999 00:22:38 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

There are two approaches you can take. One is to load the package:

<< Algebra`ReIm`

Next, declare x and y to be real as follows:

x /: Im[x] = 0; y /: Im[y] = 0;

Now you can do what you wanted:

z = x + I*y;

In[6]:=
Re[z]

Out[6]=
x

In[7]:=
Im[z]

Out[7]=
y

However, in some ways it is preferable not to load the ReIm package at all
but to use the ComplexExpand function:

z = x + I*y;

In[5]:=
ComplexExpand[Re[z]]

Out[5]=
x

In[6]:=
ComplexExpand[Im[z]]

Out[6]=
y 

Note that ComplexExpand has the TargetFunctions option, which sometimes you
have to give a sutable setting to get what you expect, e.g.:

In[8]:=
ComplexExpand[Abs[z]]

Out[8]=
Abs[x + I y]

In[9]:=
ComplexExpand[Abs[z], TargetFunctions -> {Re, Im}]

Out[9]=
      2    2
Sqrt[x  + y ]

> From: Biao Wu <bwu at physics.utexas.edu>
To: mathgroup at smc.vnet.net
> Date: Wed, 10 Nov 1999 00:17:59 -0500
> To: mathgroup at smc.vnet.net
> Subject: [mg20757] [mg20754] complex variable
> 
> Hi, all
> 
> I have a question: how to define a symbolic variable as real or complex
> explicitly? This is related to what I want to do. In math, if I do
> 
> z=x+I*y; Im[z]
> 
> what I get is 
> 
> Im[x]+Re[y]
> 
> instead of what I want
> 
> y
> 
> If I can define "x" and "y" explicitly as real variables, I should be
> able to do this. Or is there any other way to do it?
> 
> Thanks.
> 
> 
> Wu, Biao         
> 
> 



  • Prev by Date: Integration problem
  • Next by Date: Re: Intersection and element counts
  • Previous by thread: Re: complex variable
  • Next by thread: Re: complex variable