Skip to main content
Changed definitions to allow higher derivatives and different treatment of Conjugate.
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

Edited because the goal was changed in the comment:

This can be done by directly defining the outcome of Derivative when applied to g in the two combinations that you seem to be interested in:

Derivative[1][g][x_] := d[g[x]]

Derivative[1][Conjugate][g[x_]] := d[Conjugate[g[x]]]Conjugate[d[g[x]]]/d[g[x]]d[g[x]];
Derivative[1][Conjugate][d[x_]] := Conjugate[d[d[x]]]/d[d[x]]

Derivative[1][d][x_] := d[d[x]]/d[x];
Derivative[1][d][x_Symbol] := d[d[x]]

On the second line, I used the fact that g is a generic function whose derivative under a Conjugate by default invokes the chain rule. All I do then is to reverse the chain rule by dividing by the factor d[g[x]] that the chain rule will produce. This leaves only the factor I want, and I then replace that by the desired outcome d[Conjugate[g[x]]].

The analogous thing is done for d to allow higher derivatives. The exception is when d[x] is encountered where x is the differentiation variable (which isn't in the question, but I expect may happen). Then there is no chain rule needed, and I therefore specify a separate rule for it with the pattern x_Symbol.

Here is the test:

D[g[x], x]

(* ==> d[g[x]] *)

D[Conjugate[g[x]], x]

(* ==> d[Conjugate[g[x]]] *)

D[g[x], x, x]

(* ==> d[d[g[x]]] *)

D[d[g[x]], x]

(* ==> d[d[g[x]]] *)

D[d[x], x]

(* ==> d[d[x]] *)

D[Conjugate[g[x]], x]

(* ==> Conjugate[d[g[x]]] *)

D[Conjugate[g[x]], x, x]

(* ==> Conjugate[d[d[g[x]]]] *)

Now the remaining issue is to replace the repeated application of d by formatting of the type d^2 g[x] for d[d[g[x]]]. I'll wait to see if this is really desired before doing it.

This can be done by directly defining the outcome of Derivative when applied to g in the two combinations that you seem to be interested in:

Derivative[1][g][x_] := d[g[x]]

Derivative[1][Conjugate][g[x_]] := d[Conjugate[g[x]]]/d[g[x]]

On the second line, I used the fact that g is a generic function whose derivative under a Conjugate by default invokes the chain rule. All I do then is to reverse the chain rule by dividing by the factor d[g[x]] that the chain rule will produce. This leaves only the factor I want, and I then replace that by the desired outcome d[Conjugate[g[x]]].

Here is the test:

D[g[x], x]

(* ==> d[g[x]] *)

D[Conjugate[g[x]], x]

(* ==> d[Conjugate[g[x]]] *)

Edited because the goal was changed in the comment:

This can be done by directly defining the outcome of Derivative when applied to g in the two combinations that you seem to be interested in:

Derivative[1][g][x_] := d[g[x]]

Derivative[1][Conjugate][g[x_]] := Conjugate[d[g[x]]]/d[g[x]];
Derivative[1][Conjugate][d[x_]] := Conjugate[d[d[x]]]/d[d[x]]

Derivative[1][d][x_] := d[d[x]]/d[x];
Derivative[1][d][x_Symbol] := d[d[x]]

On the second line, I used the fact that g is a generic function whose derivative under a Conjugate by default invokes the chain rule. All I do then is to reverse the chain rule by dividing by the factor d[g[x]] that the chain rule will produce. This leaves only the factor I want, and I then replace that by the desired outcome d[Conjugate[g[x]]].

The analogous thing is done for d to allow higher derivatives. The exception is when d[x] is encountered where x is the differentiation variable (which isn't in the question, but I expect may happen). Then there is no chain rule needed, and I therefore specify a separate rule for it with the pattern x_Symbol.

Here is the test:

D[g[x], x]

(* ==> d[g[x]] *)

D[Conjugate[g[x]], x]

(* ==> d[Conjugate[g[x]]] *)

D[g[x], x, x]

(* ==> d[d[g[x]]] *)

D[d[g[x]], x]

(* ==> d[d[g[x]]] *)

D[d[x], x]

(* ==> d[d[x]] *)

D[Conjugate[g[x]], x]

(* ==> Conjugate[d[g[x]]] *)

D[Conjugate[g[x]], x, x]

(* ==> Conjugate[d[d[g[x]]]] *)

Now the remaining issue is to replace the repeated application of d by formatting of the type d^2 g[x] for d[d[g[x]]]. I'll wait to see if this is really desired before doing it.

Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

This can be done by directly defining the outcome of Derivative when applied to g in the two combinations that you seem to be interested in:

Derivative[1][g][x_] := d[g[x]]

Derivative[1][Conjugate][g[x_]] := d[Conjugate[g[x]]]/d[g[x]]

On the second line, I used the fact that g is a generic function whose derivative under a Conjugate by default invokes the chain rule. All I do then is to reverse the chain rule by dividing by the factor d[g[x]] that the chain rule will produce. This leaves only the factor I want, and I then replace that by the desired outcome d[Conjugate[g[x]]].

Here is the test:

D[g[x], x]

(* ==> d[g[x]] *)

D[Conjugate[g[x]], x]

(* ==> d[Conjugate[g[x]]] *)