MathGroup Archive 1999

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

Search the Archive

Re: complex variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20760] Re: complex variable
  • From: "Kevin J. McCann" <kevinmccann at Home.com>
  • Date: Thu, 11 Nov 1999 00:22:39 -0500
  • Organization: @Home Network
  • References: <80auvr$j3s@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

There are a couple of ways. Here is the one I use:

<< Algebra`ReIm`

Re[x] ^= x; Im[x] ^= 0;
Re[y] ^= y; Im[y] ^= 0;

z = x + I y

Re[z]
x

Im[z]
y

The "^=" construct is called an Upset, and basically assigns the rule to the
variable itself so that when the Re function encounters the variable x, it
does the right thing.

Cheers,

Kevin

Biao Wu <bwu at physics.utexas.edu> wrote in message
news:80auvr$j3s at smc.vnet.net...
> 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: Re: Deleting a DownValue, Evaluate[f@@argList]=. does not do it
  • Next by Date: Re: Calculus WIZ or Calculus&Mathematica ?
  • Previous by thread: Re: complex variable
  • Next by thread: RawBitmap