1
$\begingroup$

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: dd

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

1 Answer 1

1
$\begingroup$

With the help of @xzczd, I figured out that the issue was caused by an external package.

By adding

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

we can sort the issue.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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