$Assumptions =
x \[Element] Matrices[{2*M, 2*M}, Reals, Antisymmetric[{1, 2}]]
x[arg__] /; ! OrderedQ@{arg} := Signature@{arg} x @@ Sort@{arg}
Format[x[arg__]] := Subscript[x, arg]
p[arg__] /; ! OrderedQ@{arg} := Signature@{arg} p @@ Sort@{arg}
p[___, j_, j_, ___] = 0;
Format[p[arg__]] := Subscript[p, arg]
test1 = (4 *p[4, i, k, l] *x[2, i] *x[k, 2] *x[l, 3]) + (4*
p[1, j, k, l] *x[2, j]* x[k, 2]* x[l, 2]) + (p[1, 2, 3, i]*
x[1, i])
I want to implement the above in such a way that repeated indices only summed up just as in Einstein summation convention. Any way to do this? When I perform summation as:
Sum[test1, {i, 4}] // Expand
I am getting:
Subscript[p, 1, 2, 3, 4] Subscript[x, 1, 4] +
16 Subscript[p, 1, j, k, l] Subscript[x, 2, j] Subscript[x, 2, k]
Subscript[x, 2, l] +
4 Subscript[p, 1, 4, k, l] Subscript[x, 1, 2] Subscript[x, 2, k]
Subscript[x, 3, l] -
4 Subscript[p, 3, 4, k, l] Subscript[x, 2, 3] Subscript[x, 2, k]
Subscript[x, 3, l]
But I want to use Einstein summation convention in which only repeated indices sums up. Is there a way that Mathematica to perform summation only for repeated indices only,not for constants.
Iin the last term oftest1(which I'm guessing should be lowercase?) – thorimur Jul 13 '21 at 05:48