MathGroup Archive 2001

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

Search the Archive

Re: Forcing numbers to be real.

  • To: mathgroup at
  • Subject: [mg29078] Re: [mg29069] Forcing numbers to be real.
  • From: BobHanlon at
  • Date: Sun, 27 May 2001 18:04:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

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 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. 

  • Prev by Date: RE: ListPlot Points
  • Next by Date: NonlinearFit work but NonlinearRegress, why?
  • Previous by thread: Re: Forcing numbers to be real.
  • Next by thread: Re: Forcing numbers to be real.