I trying to modify the behaviour of the built-in Conjugate[] operator on a particular function I have defined, to take into account that some of its variables are real.
ClearAll[f];
f /: Conjugate[f[k_]] := Conjugate[F[r]] Exp[I k r]
f[k_] := F[r] Exp[-I k r]
The problem with using UpValues in this way is that the DownValues for f[k] are evaluated before, resulting in:
Conjugate[f[k]]=Exp[I Conjugate[k r]] Conjugate[F[r]]
Using non-standard evaluation seems to do the trick
Conjugate[Unevaluated[f[k]]]=Exp[I k r] Conjugate[F[r]]
However, I want to use my function inside expressions like
f[k1] + f[k2] + Conjugate[f[k3]]
without having to manually replace f[_] by Unevaluated[f[_]].
Conjugate! – Leo Fang Jul 03 '13 at 16:09