MathGroup Archive 2002

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

Search the Archive

Re: Absolute Value of Complex Numbers


In a message dated 7/1/02 3:52:13 AM, kyledavis at nowhere.com writes:

>Abs[2 Exp[3 * i]]
>answer = 2
>
>Abs[2 Exp[k * i]]
>answer = 2 Exp[-Im[k]]
>
>Isn't the second answer supposed to be the same with the first one,
>regardless with the value of k? How do I make the second calculation give
>me
>the right answer?
>

You apparently intend for k to be real.  You must convey that to Mathematica.

Clear[k];

If all variables are real then use ComplexEpand

{Abs[2 Exp[k*I]], Abs[2 Exp[k*I]] // ComplexExpand}

{2/E^Im[k], 2}

If specific variables are real then use an assumption with Simplify or 
FullSimplify

{Abs[2 Exp[k*I]], Simplify[Abs[2 Exp[k*I]], Element[k, Reals]]}

{2/E^Im[k], 2}

or explicitly set the imaginary part to zero.

k /: Im[k] = 0;

Abs[2 Exp[k*I]]
2

See also the standard add-on package Algebra`ReIm`


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: Absolute Value of Complex Numbers
  • Next by Date: non integer exponents in ContourPlot[]?
  • Previous by thread: Re: Absolute Value of Complex Numbers
  • Next by thread: Re: Absolute Value of Complex Numbers