1

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?

Giancarlo
  • 712
  • 4
  • 11
  • 3
    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. – QuantumDot Apr 01 '17 at 17:33

1 Answers1

3

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]] *)
mikado
  • 16,741
  • 2
  • 20
  • 54
  • 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 – Giancarlo Apr 01 '17 at 16:15