Expressions Involving Complex Variables

The Wolfram Language usually pays no attention to whether variables like x stand for real or complex numbers. Sometimes, however, you may want to make transformations which are appropriate only if particular variables are assumed to be either real or complex.

The function (RefLink[ComplexExpand, paclet:ref/ComplexExpand]) expands out algebraic and trigonometric expressions, making definite assumptions about the variables that appear.

Expanding complex expressions.

This expands the expression, assuming that x and y are both real:

ComplexExpand[Tan[x+I y]]

In this case, a is assumed to be real, but x is assumed to be complex, and is broken into explicit real and imaginary parts:

ComplexExpand[a+x^2,{x}]

With several complex variables, you quickly get quite complicated results:

ComplexExpand[Sin[x] Exp[y],{x,y}]

There are several ways to write a complex variable z in terms of real parameters. As above, for example, z can be written in the "Cartesian form" (RefLink[Re, paclet:ref/Re])[z]+(RefLink[I, paclet:ref/I]) (RefLink[Im, paclet:ref/Im])[z]. But it can equally well be written in the "polar form" (RefLink[Abs, paclet:ref/Abs])[z] (RefLink[Exp, paclet:ref/Exp])[(RefLink[I, paclet:ref/I]) (RefLink[Arg, paclet:ref/Arg])[z]].

The option (RefLink[TargetFunctions, paclet:ref/TargetFunctions]) in (RefLink[ComplexExpand, paclet:ref/ComplexExpand]) allows you to specify how complex variables should be written. (RefLink[TargetFunctions, paclet:ref/TargetFunctions]) can be set to a list of functions from the set {(RefLink[Re, paclet:ref/Re]),(RefLink[Im, paclet:ref/Im]),(RefLink[Abs, paclet:ref/Abs]),(RefLink[Arg, paclet:ref/Arg]),(RefLink[Conjugate, paclet:ref/Conjugate]),(RefLink[Sign, paclet:ref/Sign])}. (RefLink[ComplexExpand, paclet:ref/ComplexExpand]) will try to give results in terms of whichever of these functions you request. The default is typically to give results in terms of (RefLink[Re, paclet:ref/Re]) and (RefLink[Im, paclet:ref/Im]).

This gives an expansion in Cartesian form:

ComplexExpand[Re[z^2],{z}]

Here is an expansion in polar form:

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

Here is another form of expansion:

ComplexExpand[Re[z^2],{z},TargetFunctions->Conjugate]