Re: More strange behavior by ComplexExpand

• To: mathgroup at smc.vnet.net
• Subject: [mg60621] Re: More strange behavior by ComplexExpand
• From: Peter Pein <petsie at dordos.net>
• Date: Thu, 22 Sep 2005 02:08:14 -0400 (EDT)
• References: <dgr3c0\$8g2\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Raul Martinez schrieb:
> 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
> doesn't. Instead, here is what it does:
>
> In[1]:=
>
>      ComplexExpand[ (a / Pi)^(1/4) Exp[ -(a t^2)/2 ] ]
>
> Out[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.
No, ComplexExpand treats your expression as complex. Have a look at

(a/Pi)^(1/4)*Exp[-(a*t^2)/2] /. a->-1

(0.5311259660135985 + 0.5311259660135984*I)*E^(0.5*t^2)

> This is puzzling to say the least. Moreover, it renders a^(1/4) as
> (a^2)^(1/8), which seems bizarre.

((-1)^2)^(1/8) is easyer to handle than (-1)^(1/4).
ComplexExpand _treats_ a as real and gets rid of the negative case.

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

Well, I guess you are thinking of

FullSimplify[ComplexExpand[(a/Pi)^(1/4)*Exp[-(a*t^2)/2]], a > 0]

a^(1/4)/(Sqrt[E^(a*t^2)]*Pi^(1/4))

> I welcome comments and suggestions.
>
>
> Raul Martinez
>
>
>
>
>
>

--
Peter Pein, Berlin
GnuPG Key ID: 0xA34C5A82
http://people.freenet.de/Peter_Berlin/

```

• Prev by Date: Hi all, can somebody tell me how to compile latex file converted from mathematica's nb ?
• Next by Date: Re: A Su Doku solver
• Previous by thread: Re: More strange behavior by ComplexExpand
• Next by thread: Re: More strange behavior by ComplexExpand