1
|
10778 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# Simplification of expression with complex variables

Posted 11 years ago
 Hello!  I'm  using  Mathematica  9.0.0.0  and I stuck with very simpleexamples. Thera are well known rules for complex conjugation x  x*= |x|^2 and x + x*=2 Re(x)Problem 1.It is fine to tryIn:= FullSimplify[x Conjugate[x]]Out= Abs[x]^2However it doesn't work withIn:= FullSimplify[x y Conjugate[x y]]Out= x y Conjugate[x] Conjugate[y]  I'd like it should be Abs[x]^2 Abs[y]^2Problem 2.It is fine to tryIn:= FullSimplify[x + Conjugate[x]]Out= 2 Re[x]orIn:= FullSimplify[x y + Conjugate[x y]]Out= 2 Re[x y]However it doesn't work withIn:= FullSimplify[x y + Conjugate[x] Conjugate[y]]Out= x y + Conjugate[x]Conjugate[y]I want it should be 2 Re[x y]Please, help me.
3 Replies
Sort By:
Posted 11 years ago
 Nesser, it works excellent now! Thanks a lot! Ideed FullSimplify should be not used.
Posted 11 years ago
 Updated 9/1/13 to answer follow up.Added additional rules, so that no need to use FullSimplify (sometimes using FullSimplify will reverse the effect of your own rule). Here are 5 rules that covers the cases you have and the new one you added.  (if more cases are not covered, new rules can be added)You can also also apply all the rules at once, so that you do not have to determine beforehand which one to use for different expression. Mathematia internal pattern matching will pick the rule needed to apply. ClearAll[x, y, z, g, foo]; p1 = Times[Conjugate[x_] Conjugate[y_]] :> Conjugate[x y]; p2 = Times[x_ Conjugate[x_]] :> Abs[x]^2; p3 = Abs[x_ y_]^n_. :> Abs[x]^n Abs[y]^n; p4 = Plus[x_ Conjugate[y_] , y_ Conjugate[x_] ] :> 2 (Re[x] Re[y] +  Im[x] Im[y]); p5 = Plus[x_ , Conjugate[x_] ] :> 2 Re[x]; allRules = {p1, p2, p3, p4, p5};  expr = {   {foo = x Conjugate[y] + y Conjugate[x]; foo, foo //. allRules},   {foo = x Conjugate[y] + y Conjugate[x] + z Conjugate[g] + g Conjugate[z]; foo, foo //. allRules},   {foo = x Conjugate[x]; foo, foo //. allRules},   {foo = x y Conjugate[x y]; foo, foo //. allRules},   {foo = x y z Conjugate[x y z]; foo, foo //. allRules},   {foo = x + Conjugate[x]; foo, foo //. allRules},   {foo = x y + Conjugate[x y], foo; foo //. allRules},   {foo = x y z + Conjugate[x y z]; foo, foo //. allRules},   {foo = x y + Conjugate[x] Conjugate[y]; foo, foo //. allRules},   {foo = x y z g + Conjugate[x] Conjugate[y]  Conjugate[z]  Conjugate[g]; foo, foo //. allRules}   };Grid[expr, Frame -> All, Spacings -> {.5, 1}, Alignment -> Left]This gives Posted 11 years ago
 Thank you, Nasser. It is rather good solution but it doesn't work with x Conjugate[y] + Conjugate[x] yI didn't manage to solve in the same manner. Another idea?