7
$\begingroup$

Could you help me, please? I have two complex functions of real variable f[x] and fc[x] such that one is a conjugate of another one. I'd like to take a conjugate of an expression that includes both of these functions. Is it possible to define Conjugate operation for both of these functions?

I'm looking for something like that:

Conjugate[f[x_]] := fc[x];

Conjugate[fc[x_]] := f[x];

Eq = Conjugate[2f[x] + fc[x]]

I'd like to get Eq = 2 fc[x] + f[x]

Thank you in advance for your help!

$\endgroup$

2 Answers 2

11
$\begingroup$

Conjugate[f[x_]] := fc[x]; will fail because MMA tries to store this rule under Conjugate, which is protected.

However, you may store it under f by using up-set or up-set-delayed:

Conjugate[f[x_]] ^:= fc[x];

Conjugate[fc[x_]] ^:= f[x];

Eq = Conjugate[2 f[x] + fc[x]]

(* f[x] + 2 fc[x] *)
$\endgroup$
1
  • $\begingroup$ Fantastic! It is exactly what I was looking for! Thank you! $\endgroup$
    – Svetlana
    Commented Apr 20, 2021 at 18:41
2
$\begingroup$
Conjugate[2 f[x] + fc[x]] /. {Conjugate[f[x]] -> fc[x], Conjugate[fc[x]] -> f[x]}
(*    f[x] + 2 fc[x]    *)
$\endgroup$
0

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.