       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:=
Re[z]

Out=
x

In:=
Im[z]

Out=
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:=
ComplexExpand[Re[z]]

Out=
x

In:=
ComplexExpand[Im[z]]

Out=
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:=
ComplexExpand[Abs[z]]

Out=
Abs[x + I y]

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

Out=
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