6
$\begingroup$

I would like to use the algebraic properties of Conjugate to expand it term by term to make Conjugate[x+y*z] into Conjugate[x]+Conjugate[y]Conjugate[z].

Similarly, how would one make Conjugate[x+y/z] into Conjugate[x]+Conjugate[y]/Conjugate[z]?

I know Distribute or Thread can make Conjugate[x+y*z] into Conjugate[x]+Conjugate[y z] but I need the multiplication to be expanded too.

Hope somebody can help me.

EDIT: None of the answers below seems to really work for me. For example, if I define a matrix Mat = {{(x + y) z, 0}, {0, (x + y) z}}and I take the 11-part

(Part[Mat, 1, 
   1])*(-z Conjugate[[Part[Mat, 1, 1] /. z -> -1/Conjugate[z]]] ) // foo  

it always gives -(x + y) z^2 Conjugate[[-((x + y)/Conjugate[z])]] . But what I want is something like (x+y)z(Conjugate[x]+Conjugate[y]). Same is true if I use // FunctionExpand or the modified conj.

$\endgroup$
3
  • 2
    $\begingroup$ Seems like FunctionExpand should be right up your alley here... $\endgroup$
    – ciao
    Aug 15, 2016 at 6:55
  • $\begingroup$ Wrong syntax in edit; you're indexing into Conjugate which is not a list or a normal expression ... would single parentheses be right there? $\endgroup$
    – BoLe
    Aug 16, 2016 at 11:55
  • $\begingroup$ You can do Mat[[1,1]] instead of Part ... but you must have Conjugate[...]. $\endgroup$
    – BoLe
    Aug 16, 2016 at 11:57

3 Answers 3

4
$\begingroup$

Maybe not the neatest but should fit your needs:

foo = # //. (c : Conjugate)[p : (_Plus | _Times)] :> c /@ p &

Conjugate[x + y*z] // foo
Conjugate[x] + Conjugate[y] Conjugate[z]
Conjugate[x + y/z] // foo
Conjugate[x] + Conjugate[y] / Conjugate[z]
$\endgroup$
1
  • 2
    $\begingroup$ I used to write patterns like Plus[__], and Times[__], but so I had to wrap them with HoldPattern; _Plus, and _Times, of course ... $\endgroup$
    – BoLe
    Aug 15, 2016 at 11:56
10
$\begingroup$
Conjugate[x + y*z] // FunctionExpand
Conjugate[x + y/z] // FunctionExpand

Conjugate[x] + Conjugate[y] Conjugate[z]

Conjugate[x] + Conjugate[y]/Conjugate[z]

$\endgroup$
1
$\begingroup$

Answer from Kuba has the advantage of locality. However, maybe you want Conjugate to behave in this way on its own. Division is taken care (see FullForm[y/z]).

Unprotect[Conjugate];    
x : Conjugate[_Plus] := Thread[Unevaluated[x], Plus]    
x : Conjugate[_Times] := Thread[Unevaluated[x], Times]    
Protect[Conjugate];

Conjugate /@ {x + y z, x + y/z}
$\endgroup$
1
  • $\begingroup$ Hmm I thought this might have worked for my matrix question since yours should globally change this behavior but it doesn't seem to. Any idea why? $\endgroup$
    – Camilo
    Aug 16, 2016 at 1:07

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.