Re: Absolute value

• To: mathgroup at smc.vnet.net
• Subject: [mg110627] Re: Absolute value
• From: Marco Masi <marco.masi at ymail.com>
• Date: Tue, 29 Jun 2010 06:59:17 -0400 (EDT)

```Thanks, this gave some insight. And yet I'm struggling to get it in another form. I have to work with an expression like:

FullSimplify[
Collect[ComplexExpand[
Abs[A1 E^(I \[Phi]1) ((1 + Cos[Sqrt[2] c z])/2) +
AD E^(I \[Phi]D) I/Sqrt[2] Sin[Sqrt[2] c z] +
A2 E^(I \[Phi]2) ((Cos[Sqrt[2] c z] - 1)/2)]^2,
TargetFunctions -> {Re, Im}], A1 | A2 | AD], TrigFactor]

Which does not separate A1, A2 and AD. I would like to have an output in a form like:

A1^2*f1[Cos[Sqrt[2] c z],Sin[Sqrt[2] c z]] + A2^2*f2[Cos[Sqrt[2] c z],Sin[Sqrt[2] c z]] + AD^2*f3[Cos[Sqrt[2] c z],Sin[Sqrt[2] c z]],

where f1, f2, and f3 are some functions of Cos[Sqrt[2] c z] and Sin[Sqrt[2] c z]. Is this possible?

Regards, Mark.

--- Lun 28/6/10, Peter Pein <petsie at dordos.net> ha scritto:

Da: Peter Pein <petsie at dordos.net>
Oggetto: Re: Absolute value
A:
Data: Luned=EC 28 giugno 2010, 09:05

Am Mon, 28 Jun 2010 06:30:57 +0000 (UTC)
schrieb Marco Masi <marco.masi at ymail.com>:

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

Hi Mark,

try squaring the absolute value before using ComplexExpand:
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]]

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

but I would prefer:

Collect[
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,
TargetFunctions -> {Re,Im}],
A1 | A2, TrigFactor]

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

Peter

```

• Prev by Date: Re: precedence for ReplaceAll?
• Next by Date: Customizing Manipulate's Autorun
• Previous by thread: Re: Absolute value
• Next by thread: Re: Absolute value