2
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

You could use TensorReduce:

TensorReduce[
    p[i].p[j] - p[j].p[i],
    Assumptions -> (p[i] | p[j]) ∈ Vectors[d]
]

0

$\endgroup$
  • $\begingroup$ I like the look of that. Could you explain why it works? Could I not assume vectors in the original dot product somehow? $\endgroup$ – Brad Nov 28 '18 at 18:01
0
$\begingroup$

I guess I threw a few people off by saying that I didn't want a replacement rule, but what I was really trying to avoid was a simplistic version, i.e

//.{p[b_].p[a_]:> p[a].[b]}

I managed to avert this by using a conditional rule, so that it only replaces the terms which are out of canonical order. I am satisfied with:

p[a_].p[b_]/;Signature[p[a].p[b]]==-1:>p[b].p[a]

somewhere in a replacement rule sequence. Thank you to Carl for his suggestion; it put me on the right track of assumptions!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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