Re: Real variables (i.e. non-complex)
- To: mathgroup at smc.vnet.net
- Subject: [mg16565] Re: Real variables (i.e. non-complex)
- From: "Kevin J. McCann" <kevinmccann at Home.com>
- Date: Wed, 17 Mar 1999 23:54:50 -0500
- Organization: @Home Network
- References: <7cl7ff$9d1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Christian,
It is a bit awkward:
<< Algebra`ReIm`
Re[a] ^= a;
Im[a] ^= 0;
I usually use the following:
<< Algebra`ReIm`
ri[x_]:=Module[{},
Re[x]^=x;
Im[x]^=0;
Conjugate[x]^=x;
]
then
ri[a]
The "^=" is called an Upset and essentially associates the rule with the
variable, i.e. whenever Mathematica sees Re[a] it returns a, but only for the
variable a.
Cheers,
Kevin
Christian wrote in message <7cl7ff$9d1 at smc.vnet.net>...
>Hello!
>
>How do I tell Mathematica to assume that one variable is real (i.e.
Im[x]=0)
>or positive? I hoped to achieve that by setting appropriate attributes
(like
>constant) but there are none...
>
>Christian
>
>
>