ReplaceBSpinor

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