MathGroup Archive 2010

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

Search the Archive

Re: Absolute value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110605] Re: Absolute value
  • From: "David Park" <djmpark at comcast.net>
  • Date: Mon, 28 Jun 2010 02:27:34 -0400 (EDT)

Maybe someone will give a more direct calculation, but otherwise this is
slightly on the tricky side. Paste the following into a notebook and
evaluate.

Print["Initial complex expression:"] 
step1 = Exp[I phi1] + Exp[I*phi2] 
Print["Convert to trigonometric form."] 
step2 = step1 // ExpToTrig 
Print["Calculate the Abs value squared and expand to real + imaginary \
form, with the imaginary part zero."] 
step3 = ComplexExpand[Abs[step2]^2, TargetFunctions -> {Re, Im}] 
Print["Use TrigFactor."] 
step4 = step3 // TrigFactor 
Print["Take the square root and simplify"] 
Simplify[Sqrt[step4], {phi1, phi2} \[Element] Reals] 

1) It seemed easier to calculate Abs^2 and then take the square root at the
end. 

2) We need to use ComplexExpand to expand a complex expression to the form
(real part) + I (imaginary part) and since the imaginary part is already
zero we have to use the TargetFunctions option to get this to evaluate to
the extent that we want.

3) We have to use TrigFactor to obtain the trigonometric form you are
looking for. How did I know that? I didn't really. I tried TrigExpand,
TrigReduce and then TrigFactor. But since the expression looks like one that
could be factored I should have tried TrigFactor first.

4) Finally we take the square root and simplify using real variable
assumptions.

Both the Complex and ComplexExpand Function pages need more explicit notes
and examples to point users in the right direction.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Marco Masi [mailto:marco.masi at ymail.com] 


I would like to calculate the absolute value of complex quantities. For
example Abs[Exp[I phi1]+Exp[I*phi2]], which sould give 2 (1+cos(phi1-phi2)).
However it does not work. I tried to use real numbers as assumtion, but it
always answers "Abs[Exp[I phi1]+Exp[I*phi2]]". What am I doing wrong?

Regards, Mark.




  • Prev by Date: Re: Absolute value
  • Next by Date: Re: Absolute value
  • Previous by thread: Re: Absolute value
  • Next by thread: Re: Absolute value