1
$\begingroup$

This input gives the wrong result

ComplexExpand[Conjugate[f[x]], {x}]
(*f[x]*)

instead of Conjugate[f[x]].

In particular it works well with some functions, e.g.

ComplexExpand[Conjugate[f[x] /. f -> Sin], {x}]
(*Cosh[Im[x]] Sin[Re[x]] - I Cos[Re[x]] Sinh[Im[x]]*)
ComplexExpand[Conjugate[f[x, y] /. f -> Times], {x, y}]
(*-Im[x] Im[y] + Re[x] Re[y] - I (Im[y] Re[x] + Im[x] Re[y])*)

(note that ComplexExpand[Conjugate[f[x]], {x}]/. f -> Sin doesn't work) but not with others e.g.

ComplexExpand[Conjugate[Dot[x, y]], {x, y}]
(*x.y*)

Any idea how to deal with this problem? How can I get the correct output for the last example f=Dot? and for a generic function f?

Why the functions Dot and Times behaves in a different way?

$\endgroup$
  • 3
    $\begingroup$ The final question "Why the functions Dot and Times behaves in a different way?" is a good question, and should be separated into its own question. $\endgroup$ – QuantumDot Apr 1 '17 at 17:33
3
$\begingroup$

I think ComplexExpand works as documented. If you want it to assume that f[x] is not real, you need to specify this. For example

ComplexExpand[Conjugate[f[x]], {f[x]}]
(* -I Im[f[x]] + Re[f[x]] *)
$\endgroup$
  • $\begingroup$ Yes, this solve the problem in this specific case, thanks! But why there is a difference in these functions: ComplexExpand[Conjugate[Dot[x, y]], {x, y}] ComplexExpand[Conjugate[Times[x, y]], {x, y}]? Why I have to specify that Dot is a complex variables and I don't have to for the function Time? Is it connected to the NumericFunction attribute? I think it's important because I want to use ComplexExpand in an 'automatic way' that means that I'd like to don't care about the functions inside it $\endgroup$ – Giancarlo Apr 1 '17 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.