Facing the same problem reported here: Conjugation with real elements answers are working, I thought of the following solution:
Unprotect[Conjugate];
Conjugate[x_] := x /; Element[x, Reals]
Protect[Conjugate];
but when I test it:
$Assumptions = {Element[y, Reals]};
Conjugate[y]
(* output *)
Conjugate[y]
doesn't seem to be doing what I need. If I don't use $Assumptions
, then:
Refine[y, y \[Element] Reals];
Conjugate[y]
Simplify[Conjugate[y]]
(* output *)
Conjugate[y]
Conjugate[y]
Can someone please explain why my "solution" is not working?
x/x
will immediately simplify to1
, but for some more complicated expression, you need to useSimplify
(orFullSimplify
). Your "solution" does not work because the assumption that $y$ is real is not automatically taken into account, and therefore your custom downvalue (Conjugate[x_] := x /; Element[x, Reals]
) is not used. $\endgroup$Refine
correctly. It seems to me like you used it like Assumptions expectingRefine[y, y \[Element] Reals]
; to imply thaty
will be real throughout the notebook butRefine
only acts locally on it's first argument by applying the assumptions from the second argument. $\endgroup$Refine[y, y \[Element] Reals] // EchoLabel["Refine[y,y\[Element]Reals]"]; Conjugate[y] // EchoLabel["Conjugate[y]"]; Refine[Conjugate[y], y \[Element] Reals] // EchoLabel["Refine[Conjugate[y],y\[Element]Reals]"]; Conjugate[y] // EchoLabel["Conjugate[y]"]
$\endgroup$