1
$\begingroup$

I am trying to take product of a complex number with its conjugate. When I take

A*Conjugate[A] // FullSimplify

The output is as desired

Abs[A]^2

But when I try

FullSimplify@(A*Conjugate[A]*B*Conjugate[B])

The output is

A B Conjugate[A] Conjugate[B]

Why mathematica is not showing the output as

Abs[A]^2 Abs[B]^2

I am using Mathematica 11.2.0.

$\endgroup$
2
  • $\begingroup$ ComplexExpand does the work: A*Conjugate[A]*B*Conjugate[B] // ComplexExpand. $\endgroup$
    – rmw
    Commented Nov 10, 2018 at 13:41
  • $\begingroup$ @rmw - You have let ComplexExpand assume that A and B are real-valued. The OP is working with complex variables. $\endgroup$
    – Bob Hanlon
    Commented Nov 10, 2018 at 15:29

2 Answers 2

1
$\begingroup$

You can use ComplexExpand

simplify = 
  Simplify[ComplexExpand[#, Variables[Level[#, {-1}]], 
     TargetFunctions -> {Abs, Arg}]] &;

A*Conjugate[A] // simplify

(* Abs[A]^2 *)

simplify[A*Conjugate[A]*B*Conjugate[B]]

(* Abs[A]^2 Abs[B]^2 *)
$\endgroup$
1
  • $\begingroup$ Thank you. This will save a lot of time in my calculations :-) $\endgroup$
    – Archimedes
    Commented Nov 10, 2018 at 15:00
1
$\begingroup$

It is somewhat counterintuitive, but Mathematica might indeed think that A B Conjugate[A] Conjugate[B] is simpler.

LeafCount[Abs[A]^2 Abs[B]^2]
LeafCount[A B Conjugate[A] Conjugate[B]]

9

7

Notice that LeafCount is not the precise ComplexityFunction used by FullSimplify, but it may still give you an idea.

In the end, simplification is always a matter of taste.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.