Mathematica Asked by Svetlana on May 19, 2021
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!
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] *)
Correct answer by Daniel Huber on May 19, 2021
Conjugate[2 f[x] + fc[x]] /. {Conjugate[f[x]] -> fc[x], Conjugate[fc[x]] -> f[x]}
(* f[x] + 2 fc[x] *)
Answered by Roman on May 19, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP