ReplaceASpinor

ReplaceASpinor[expr, xr]
returns expr with massless or massive A spinors, labeled by x, replaced by r, r can be linear combination of massless or massive spinors.
ReplaceASpinor[expr, x→{a, b}]
replaces massless or massive A spinor x at beginning of spinor chain with difference of A spinor a and B spinor b . A spinor x at end of spinor chain will be replaced by sum of A spinor a and B spinor b . b can be linear combinations of labels they will be interpreted as linear combinations of B spinors, analogously a can be linear combinations of labels and they will be interpreted as linear combinations of A spinors.
ReplaceASpinor[expr, pattr]
returns expr with all massless or massive A spinors that match pattern patt replaced by r.
ReplaceASpinor[expr, patt→{a, b}]
returns expr with all massless or massive A spinors, at beginning of spinor chain, that match pattern patt replaced by difference of A spinor a and B spinor b . A spinors at end of spinor chain, that match pattern patt, will be replaced by sum of A spinor a and B spinor b .
ReplaceASpinor[expr, pattreplacement ]
returns expr with all massless or massive A spinors that match pattern patt replaced by replacement . patt can have named patterns inside and replacement can use variables matched by those named patterns.
ReplaceASpinor[expr, patt⧴{replacementA , replacementB }]
replaces A spinors, that match pattern patt, with difference of A spinor replacementA and B spinor replacementB . A spinors at end of spinor chain, that match pattern patt, will be replaced by sum of A spinor replacementA and B spinor replacementB . replacementB and replacementA can use variables matched by named patterns in patt.
ReplaceASpinor[expr, {x→{a, b}, pattreplacement , ...}]
returns expr with replacement using all given rules.
ReplaceASpinor[expr, {{x1r1, ...}, {x2→{a2, b2}, ...}, ...]
returns a List, each element of this list is a result of replacement using subsequent list of rules.
  • ReplaceASpinor behaves as built-in ReplaceAll function but replaces only expressions that are found in places where they can be interpreted as massless or massive A spinors.
A spinors are replaced:
B spinors are not replaced:
Occurrences of replaced label that don't scale as square root of four-vector are not changed:
Massive A spinors can be replaced by linear combination of B and A spinors:
Rule with patterns can be used:
RuleDelayed with named patterns can be used:
Change u A spinors to v A spinors and vice versa:
Change all massive A spinors to linear combination of A and B spinors with coefficients depending on replaced spinor properties:
List of rules can be used:
List of lists of rules can be used, ReplaceASpinor will return list or results:
Any expression can be replaced by any other expression only requirement is that expression is inside symbol in which it can be interpreted as massless or massive A spinor: