# Differential not returning the answer

I have the following set of rules for differentiation.

 SetAttributes[δ, Orderless]
δ /: δ[a_, b_] h_[former___, b_, latter___] :=
h[former, a, latter]
δ[a_, a_] = 2*M;

Format[δ[a_, b_]] := Subscript[δ, a, b]
Format[x[a_, b_]] := Subscript[x, a, b]
\$Assumptions =
x ∈ Matrices[{2*M, 2*M}, Reals, Antisymmetric[{1, 2}]]
x[arg__] /; ! OrderedQ@{arg} := Signature@{arg} x @@ Sort@{arg}
Format[x[arg__]] := Subscript[x, arg]

myD[-a_, o_] := -myD[a, o];
myD[a_, -o_] := -myD[a, o];

myD[a_ + n_, o_] := myD[a, o] + myD[n, o];
myD[a_ b_, o_] := b myD[a, o] + a myD[b, o];
myD[x_[k_, l_],
x_[v_, g_]] := δ[k, v] δ[l, g] - δ[k,
g] δ[l, v];
myD[_?NumericQ, _] = 0;

myD[I*δ[k_, l_], x_[d_, r_]] := 0;
myD[δ[k_, l_], x_[s_, n_]] := 0;
myD[δ[k_, l_], -x_[β_, α_]] := 0;

myD[δ[k_, l_]*δ[k_, l_], x[s_, n_]] := 0;
myD[Exp[P_], x_[d_, r_]] := Exp[P]*myD[P, x[d, r]];


To Evaluate:

FT = (x[j, i]*x[j,i])
WeiS = Exp[-FT]

myD[WeiS, x[u,n]]


It's not returning the answer. What I am expecting is:

• Think carefully about why the following "doesn't work": a^2 /. a_ b_ :> 1 May 7, 2021 at 5:37
• @xzczd I didn't understand what you meant. Can you explain May 7, 2021 at 5:43
• …Do you know what is /.? If not, please check the document by pressing F1. May 7, 2021 at 5:47
• @xzczd yup Replace all I didn't understand why a^2 /. a_ b_ :> 1 used here May 7, 2021 at 5:51
• Remember what's FT in your code? May 7, 2021 at 5:52

myD[a_^2, o_] := 2*a myD[a, o]