MathGroup Archive 2005

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

Search the Archive

Re: More strange behavior by ComplexExpand

  • To: mathgroup at
  • Subject: [mg60622] Re: [mg60603] More strange behavior by ComplexExpand
  • From: Pratik Desai <pdesai1 at>
  • Date: Thu, 22 Sep 2005 02:08:15 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

Raul Martinez wrote:

>To Mathgroup,
>I use Mathematica 5.2 with Mac OS X (Tiger).
>Add the following to a recent thread on the sometimes strange  
>behavior of ComplexExpand.
>I used ComplexExpand with an argument in which all the variables in  
>the argument of the function are real. Since ComplexExpand is  
>supposed to assume that all variables are real by default, one would  
>expect ComplexExpand to return the expression without change, but it  
This is not exactly true, in mathematica all the variables are assumed 
complex (alteast what I have experienced so far)

In my opinion not only doyou have to specifically assign your variable 
to be real by using Assuming or $Assumptions +Simplify, but also you 
have specifiy the values of "a" on the real line and hence your 
expression will change based on the complex expand algorithm

$Assumptions = {-â?? < a < 0, t ϵ Reals}
s1=ComplexExpand[(a/Ï?)^(1/4) *Exp[-(a t^2)/2]] // Simplify
 >>((1 + I)*(a^2)^(1/8)*Sqrt[E^(a*t^2)])/(Sqrt[2]*E^(a*t^2)*Pi^(1/4))

$Assumptions = {0 < a < â??, t ϵ Reals}
s2=ComplexExpand[(a/Ï?)^(1/4) *Exp[-(a t^2)/2]] // Simplify

$Assumptions = {a ϵ Reals, t ϵ Reals}
s3=ComplexExpand[(a/Ï?)^(1/4) *Exp[-(a t^2)/2]] // Simplify
 >>((a^2)^(1/8)*Sqrt[E^(a*t^2)]*(Cos[Arg[a]/4] + 

s4=Simplify[(a/Ï?)^(1/4) *Exp[-(a t^2)/2]]

fundamentally you are asking by, using complexexpand, to expand your 
given function in a complex way....

>Instead, here is what it does:
>     ComplexExpand[ (a / Pi)^(1/4) Exp[ (-(a t^2)/2 ] ]
>     (Exp[-a t^2] Sqrt[Exp[a t^2]] (a^2)^(1/8) Cos[Arg[a] / 4]) / Pi^ 
>(1/4) + i (Exp[-a t^2] Sqrt[Exp[a t^2]] (a^2)^(1/8) Sin[Arg[a] /  
>4]) / Pi^(1/4).
>I have inserted parentheses in a few places to improve the legibility  
>of the expressions.
>ComplexExpand treats the variable "a" as complex, but "t" as real.  
>This is puzzling to say the least. Moreover, it renders a^(1/4) as  
>(a^2)^(1/8), which seems bizarre.
If you look closely at your expression, the only issue of complexity 
occurs with your "a" variable because appears as a radical which may 
have complex nature based on where it is defined on the Real number line

>My interest is not in obtaining the correct result, which is easy to  
>do. Rather, I bring this up as yet another example of the  
>unreliability of ComplexExpand. In case anyone is wondering why I  
>would use ComplexExpand on an expression I know to be real, the  
>reason is that the expression in question is a factor in a larger  
>expression that contains complex variables. Applied to the larger  
>expression, ComplexExpand returned an obviously incorrect expansion  
>that I traced to the treatment of the example shown above.
>I welcome comments and suggestions.
>Thanks in advance,
>Raul Martinez
Hope this helps

Pratik Desai

Pratik Desai
Graduate Student
Department of Mechanical Engineering
Phone: 410 455 8134

  • Prev by Date: Re: Re: "layering" 2d plots
  • Next by Date: Re: Replacement Rule
  • Previous by thread: Re: Re: More strange behavior by ComplexExpand
  • Next by thread: Re: More strange behavior by ComplexExpand