Seemingly an easy question, but I'm trying to avoid using a straight replacement rule.
As an example, I could take a term like
p[i].p[j]-p[j].p[i]
where this dot product is symmetric, and so should evaluate to zero.
I'm trying to avoid using a replacement rule, since I'm trying to generalise.
I have tried using Signature
and Sort
to try and automatically swap the latter term by canonical sorting, but to no avail.
Any suggestions would be welcome!
EDIT: I think I will extend my question to get the exact answer I am searching for. I'm using a recursion relation to generate a load of terms, which involve these dot products.
I am looking to basically express any dot product which is has a signature of -1 from canonical order as the reversed order, to lead to some nice cancellations:
For any choice of i,j
, I'm looking to get something like:
If[Signature[p[i_].p[j_]]==-1, Return[p[j].p[i]]]
Can this be easily achieved?
EDIT2:
I think the answer lies in ConditionalReplace
. Let me try muddling.