MathGroup Archive 2010

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

Search the Archive

Re: Absolute value

I am not sure if I understand exactly what you want but perhaps this might help:

 ComplexExpand[Abs[(1/2)*(A1*E^(I*\[Phi]1) - A2*E^(I*\[Phi]2) +
              A1*E^(I*\[Phi]1)*Cos[Sqrt[2]*c*z] + A2*E^(I*\[Phi]2)*
 ExcludedForms -> Cos[Sqrt[2]*c*z]]

(1/4)*(A1^2*(Cos[Sqrt[2]*c*z] + 1)^2 +
      2*A1*A2*(Cos[Sqrt[2]*c*z]^2 - 1)*Cos[\[Phi]1 - \[Phi]2] +
      A2^2*(Cos[Sqrt[2]*c*z] - 1)^2)

Andrzej Kozlowski

On 28 Jun 2010, at 15:30, Marco Masi wrote:

> Yes, thank you, that brough me a step forward (and yes, I forgot to square the Abs value in the previous example... sorry for that).
> However, there is still a step which I can't accomplish. Please try the following:
> FullSimplify[ ComplexExpand[ Abs[1/2 (A1 E^(I \[Phi]1) - A2 E^(I \[Phi]2)+ A1 E^(I \[Phi]1) Cos[Sqrt[2] c z] + A2 E^(I \[Phi]2) Cos[Sqrt[2] c z])]]^2]
> I would like to have Mathematica avoiding one of the resulting Cos[2 Sqrt[2] c z] expression, and maintain both as Cos[Sqrt[2] c z], and then simplify. How should I proceed?
> Regards, Mark.
> --- Dom 27/6/10, Murray Eisenberg <murray at> ha scritto:
> Da: Murray Eisenberg <murray at>
> Oggetto: Re: [mg110596] Absolute value
> A: mathgroup at
> Data: Domenica 27 giugno 2010, 17:37
> Actually, the correct answer should be the square-root of what you claim is the answer.
> In such problems, remember the crucial fact that Mathematica does not "know " that you intended phi1 and phi2 to be real, and hence it does not attempt further simplification. By default, symbolic quantities in Mathematica are interpreted as potentially complex rather than real when they appear in expressions involving complex numbers.
> In such situations, ComplexExpand is your friend:
>  ComplexExpand[Abs[Exp[I phi1] + Exp[I*phi2]]] // InputForm
> Sqrt[(Cos[phi1] + Cos[phi2])^2 + (Sin[phi1] + Sin[phi2])^2]
>  ComplexExpand[Abs[Exp[I phi1]+Exp[I*phi2]]] // Simplify // InputForm
> Sqrt[2 + 2*Cos[phi1]*Cos[phi2] + 2*Sin[phi1]*Sin[phi2]]
> (I used InputForm here only in order to create one-dimensional output. In actual use you wouldn't do that, so you'd actually see the two-dimensional square-root notation.)
> On 6/27/2010 4:55 AM, Marco Masi wrote:
>> 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.
> -- Murray Eisenberg                     murray at
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305

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