MathGroup Archive 1995

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

Search the Archive

Re: Complex variables

Stephen Resenbloom in  [mg1478] Complex variables

> In Mathematica is there a way to specify that given variables are 
purely real?
i.e. if f= x + I y and one can specify that x and y are purely real
variables, then Mathematica should be able to calculate
Re[f] = x and Im[f]=y. So far I have found no way to do this.

I'll come to your specific query below, but you may find the system  
function ComplexExpand useful: it assume that variable are real  
unless told other wise.

f = x + I y;

ComplexExpand[{Re[f], Im[f], Conjugate[f], Abs[f]}]

	                      2    2
	{x, y, x - I y, Sqrt[x  + y ]}

ComplexExpand[{Re[g], Im[g], Conjugate[g], Abs[g]},{g}]
	{Re[g], Im[g], -I Im[g] + Re[g], Abs[g]}

ComplexExpand has an option TargetFunctions which lets you specify  
the kind of reduction you would like:

ComplexExpand[ Conjugate[g], {g}, TargetFunctions -> {Abs}]//Simplify


The package
<< Algebra`ReIm`
Lets you specify which variable are real, as you want (note that   
we use up definitions to localize the effect and avoid the need to  
unprotect Im and Re).

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

{Re[f], Im[f], Conjugate[f], Abs[f]}

	{x, y, x - I y, Abs[x + I y]}

The result for Abs is rather surprising.

Here  is a little more

ComplexExpand[a^b, {a}]//Factor  (*{a} says that a is complex*)

	Abs[a]  (Cos[b Arg[a]] + I Sin[b Arg[a]])

We can use

to put this in a more  compact form


	 I b Arg[a]       b
	E           Abs[a]

Allan Hayes
hay at

  • Prev by Date: question
  • Next by Date: Re: question
  • Previous by thread: Re: question
  • Next by thread: Re: Complex variables