MathGroup Archive 2010

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

Search the Archive

Re: Newby Q: How to specify reals

Well, thanks for the clarification, and looking more closely at the
ComplexExpand usage and the Function page I believe I have a better
understanding of it. I do think the Function help page could be written more

What does the "Expand" in ComplexExpand and "expands" in the usage message
actually mean? The first examples you give make it look as its principal
operation is as in Expand, such as expanding polynomials. I think the
principal design was something like this:

ComplexExpand[f[z], {z}] expands f[z] to x[z] + I y[z] where x[z] and y[z]
are real valued functions of z and f[z] is a defined expression in z. x[z]
and y[z] are expressed in terms of TargetFunctions.

That seems to me to be a different meaning to "Expand" than expanding
products of polynomials. But the Help doesn't actually give that definition
and hence they leave its principal usage vague. Their second definition
should be the first one, and the first one the second one - if they want to
emphasize the basic functionality.

Nevertheless, whether you want to call it simplification or not,
ComplexExpand does employ considerable transformation of functions and
identities and to many users this will look like more than a simple Expand.

Also, users will often be working with expressions that contain only real
variables and with everything that happens they overlook the basic expansion
to x + I y.

The Help could also better specify the use of TargetFunctions. It should say
that it has the default value of TargetFunctions -> {Re, Im, Abs, Arg,
Conjugate, Sign} and that Mathematica will choose among all of them by the
internal algorithm. One might have the impression that {Re, Im} are the
default TargetFunctions, which is not the case. For example the following
does not give what one might expect and doesn't even expand to the usual

ComplexExpand[Abs[(x + I y)^2]] 

Abs[x + I y]^2 

Maybe it's a bug or a weakness in the algorithm. Or maybe the meaning of
"Expand" isn't quite what I wrote above. One would usually want:

ComplexExpand[Abs[(x + I y)^2], TargetFunctions -> {Re, Im}] 

x^2 + y^2 

David Park
djmpark at   

From: Andrzej Kozlowski [mailto:akoz at] 

On 25 Jun 2010, at 20:28, David Park wrote:

> Maybe ComplexExpand should have been called ComplexSimplify or
> - but it's too late now and I don't know if that, in itself, would
> the problem for beginners.

But, as has been pointed out many times, it *does" expand. How would
ComplexSImplify and ComplexReduce fit with the following behaviour:

In[63]:= ComplexExpand[(a + b)^3]

Out[63]= a^3 + 3*a^2*b + 3*a*b^2 + b^3

 ComplexExpand[(a + b)*(c + d)]

a*c + a*d + b*c + b*d

Is this reduction? Is is simplification? It's clearly *expansion* as it

ComplexExpand[z, {z}]

Re(z)+I Im(z)

and this

ComplexExpand[z, {z}, TargetFunctions -> {Arg, Abs}]

Abs[z]*Cos[Arg[z]] + I*Abs[z]*Sin[Arg[z]]

In fact, I don't think there is any other name but ComplexExpand or
something synonymous that fits this and all other behaviour of
ComplexExpand. To say that it "should have been called something else" is
actually misleading. 

Andrzej Kozlowski

  • Prev by Date: Re: Display question
  • Next by Date: Re: Sum of terms --> list
  • Previous by thread: Re: Newby Q: How to specify reals
  • Next by thread: Re: Newby Q: How to specify reals