Reputation: 4966
Is there a way to simplify this conjugate expression:
expr=d12*Conjugate[C1]*C2 + d12*Conjugate[C2]*C1 + d13*Conjugate[C1]*C3 + d13*Conjugate[C3]*C1
into something like:
2 d12 (Re[C1*Conjugate[C2]]) + 2 d13 (Re[C1*Conjugate[C3]])
And in general, how Mathematica determines one expression is simpler than another? Is there a way to add some personalized rules to its simplification process? For example, can we tell Mathematica that we prefer 2*Re[C1*Conjugate[C2]]
than C1*Conjugate[C2]+C2*Conjugate[C1]
? Thanks.
Update:
Thanks for the suggestions. ComplexExpand
can expand it to real and imaginary part, but seems still can't simplify to the preferred form:
In: Simplify[ComplexExpand[expr, {C1, C2, C3}]]
Out: 2 (Im[C1] (d12 Im[C2] + d13 Im[C3]) + Re[C1] (d12 Re[C2] + d13 Re[C3]))
I tried the TransformationFunctions function like this but it doesn't work:
In: t = # /. (Im[C1] Im[C2] + Re[C1] Re[C2] -> 1/2 Re[C1\[Conjugate] C2]) &;
In: Simplify[ComplexExpand[expr, {C1, C2, C3}], TransformationFunctions -> {Automatic, t}]
Out: 2 (Im[C1] (d12 Im[C2] + d13 Im[C3]) + Re[C1] (d12 Re[C2] + d13 Re[C3]))
Am I doing the wrong way? Thanks.
Upvotes: 1
Views: 2955
Reputation: 13131
Actually it simplifies to smaller expression
expr=d12*Conjugate[C1]*C2+d12*Conjugate[C2]*C1+d13*Conjugate[C1]*C3 +
d13*Conjugate[C3]*C1;
Simplify[ComplexExpand[expr]]
gives
2 C1 (C2 d12 + C3 d13)
how Mathematica determines one expression is simpler than another? Is there a way to add some personalized rules to its simplification process
You can use the ComplexityFunction
option to Simplify
. The default is Automatic
and I think this uses Leaf count to decide. You can also use the TransformationFunctions
option to Simplify
to provide your own functions to apply. See help.
http://reference.wolfram.com/mathematica/ref/ComplexityFunction.html
http://reference.wolfram.com/mathematica/ref/TransformationFunctions.html
http://reference.wolfram.com/mathematica/ref/LeafCount.html
Upvotes: 3