Mathematica Asked by Massimo on April 6, 2021
I have a seemingly simple simplification involving conjugates:
$Assumptions = Element[{a}, Reals];
FullSimplify[ x E^(I a) + Conjugate[x] E^(-I a)]
which merely outputs this,
E^(-I a) (E^(2 I a) x + Conjugate[x])
I would have expected the expression above to simplify to
2 Re[x E^(I a)]
In order to use ComplexExpand, one needs to explicitly convert every cplx variable into either Cartesian or polar form, which causes quite some extra labour:
expr = x E^(I a) + Conjugate[x] E^(-I a);
repToCart = {x -> xRE + I xIM};
repToCplx = {xRE -> Re[x], xIM -> Im[x]};
$Assumptions = Element[{a, xRE, xIM}, Reals];
Output = FullSimplify[expr /. repToCart] /. repToCplx
outputs this:
2 Cos[a] Re[x] - 2 Im[x] Sin[a]
This is indeed the same as this:
2 Re[x E^(I a)]
But it is
Any tips on how to speed up the workflow here would be greatly appreciated 🙂
Following up to the comment of b.gates.you.know.what, I think that is the most useful answer.
ComplexExpand[x E^(I a) + Conjugate[x] E^(-I a), {x}, TargetFunctions -> {Re, Im}]
This approach spares the user to write replacement rules back and forth. The answer from Alexei Boulbitch is also useful, but not much different than the replacement rules I mentioned in my post.
Thanks to all. Massimo
Correct answer by Massimo on April 6, 2021
I cannot understand, why not to use ComplexExpand]
. However, if not, try this:
expr = x E^(I a) + Conjugate[x] E^(-I a) /. x -> z + I*t;
Simplify[expr // ExpToTrig, {a, z, t} [Element] Reals] /. {z ->
Re[x], t -> Im[x]}
(* 2 Cos[a] Re[x] - 2 Im[x] Sin[a] *)
Have fun!
Answered by Alexei Boulbitch on April 6, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP