I recently ran into something that should be straight forward, but seems to be incredibly complex.
If I define some function,
f[x_,y_]:=x+y
I wish to take the derivative of the complex conjugate. I have found some workarounds, such as here.
excluded=OptionValue[SystemOptions[], "DifferentiationOptions"->"ExcludedFunctions"];
SetSystemOptions["DifferentiationOptions"->
"ExcludedFunctions"->Union[excluded,{Conjugate}]];
Unprotect[Conjugate];
Conjugate /: D[Conjugate[f_], x__] := Conjugate[D[f, x]]
Protect[Conjugate];
However, let's say I choose the variable to differentiate to be the complex conjugate. If I set y to some constant
D[Conjugate[f[x, 1]], Conjugate[x]] (*1*)
I get the desired result. However, if I set y as a variable
D[Conjugate[f[x, y]], Conjugate[x]] (*0*)
I get the wrong result, while
D[Conjugate[f[x, y]], x] (*1*)
It appears that when I have two or more variables, the result doesn't work because the conjugate isn't expanded.I have used the FunctionExpand function, which yields the correct results, but I am more interested in why the disconnect occurs
D[Conjugate[f[x, 2 y]], Conjugate[x]]
. Have you considered something linef[x_, y_] := Cos[x] + Sin[y]
? It looks like results are pretty much wrong anyways. $\endgroup$