Related to 123974, is there a way to make the ConjugateTranspose function, input as esc-hc-esc distributive for all symbols? For example, with d = (a + b)/Sqrt[2], I want d\[HermitianConjugate] give $(a^\dagger+b^\dagger)/\sqrt{2}$. I can define

hc[x__Plus] := Plus @@ (ConjugateTranspose /@ (List @@ x))

which only takes care of terms like hc[a+b] bit not for more complicated expressions.

  • $\begingroup$ Have you looked at Distribute? $\endgroup$ Commented Feb 21, 2018 at 10:09
  • $\begingroup$ @SjoerdSmit yes, Distribute works for e.g. a+b but not, say, (a+b)/2 $\endgroup$ Commented Feb 21, 2018 at 15:26

1 Answer 1


How does this work for you?

ConjugateTranspose[d] //. {
  ConjugateTranspose[(op : (Plus | Times))[a__]] :> op @@ (ConjugateTranspose /@ {a}),
  ConjugateTranspose[NonCommutativeMultiply[a__]] :> NonCommutativeMultiply @@ (ConjugateTranspose /@ Reverse[{a}]),
  ConjugateTranspose[n_?NumericQ] :> Conjugate[n]

Essentially, this uses ReplaceRepeated to implement the algebraic rules of ConjugateTranspose: it falls through addition and (scalar) multiplication; it turns numbers into their conjugates; and it falls through non-commutative multiplication but reverses the order of multiplication.

  • $\begingroup$ works for me, thanks a lot! $\endgroup$ Commented Feb 21, 2018 at 15:27
  • $\begingroup$ also added rule: ConjugateTranspose[ConjugateTranspose[a__]] :> a so that $(a^\dagger)^\dagger=a$. $\endgroup$ Commented Feb 21, 2018 at 15:55
  • $\begingroup$ Oh, it doesn't do that by itself? Well, seems sensible to me, then. I would change the matching pattern to ConjugateTranspose[ConjugateTranspose[a_]], though, since ConjugateTranspose should never have more than one argument in the first place. $\endgroup$ Commented Feb 21, 2018 at 16:19
  • $\begingroup$ good, point, thanks again! $\endgroup$ Commented Feb 21, 2018 at 16:25

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.