Re: Absolute Value of Complex Numbers

*To*: mathgroup at smc.vnet.net*Subject*: [mg35203] Re: [mg35196] Absolute Value of Complex Numbers*From*: BobHanlon at aol.com*Date*: Tue, 2 Jul 2002 02:11:57 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

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