Re: Forcing numbers to be real.
- To: mathgroup at smc.vnet.net
- Subject: [mg29078] Re: [mg29069] Forcing numbers to be real.
- From: BobHanlon at aol.com
- Date: Sun, 27 May 2001 18:04:44 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
You can use TagSet to set upvalues for specific variables
x /: Im[x] = 0;
x /: Re[x] = x;
{Re[x+y], Im[x+y]}
{x + Re[y], Im[y]}
Use the standard add-on package Algebra`ReIm`
Use ComplexExpand if all variables are Real
{Re[y+z], Im[y+z]} // ComplexExpand
{y + z, 0}
In version 4 or later use domain specifications in Simplify or FullSimplify
Simplify[{Re[y+z], Im[y+z]}, Element[{y, z}, Reals]]
{y + z, 0}
Bob Hanlon
In a message dated 2001/5/26 10:20:10 PM,
REMOOVE_THIS_drkirkby at AND_THIS_ntlworld.com writes:
>I've not used Mathematica much, but I know there is a way documented of
>forcing Mathematica to consider a number to be real, so having an
>imaginary part of 0. Can anyone tell me how to do it - I can't seem to
>find it in the docs, although I know it is there somewhere.
>