ReplaceLVector

ReplaceLVector[expr, P→Q ]
returns expr with Lorentz vector P replaced by Q .
ReplaceLVector[expr, patt →Q ]
returns expr with all Lorentz vectors that match pattern patt replaced by Q .
ReplaceLVector[expr, patt⧴replacement ]
returns expr with all Lorentz vectors that match pattern patt replaced by replacement . patt can have named patterns inside and replacement can use variables matched by those named patterns.
ReplaceLVector[expr, {P→Q , patt⧴replacement, ...}]
returns expr with replacement using all given rules.
ReplaceLVector[expr, {{P1→Q1, ...}, {P2→Q2, ...}, ...}]
returns a List, each element of this list is a result of replacement using subsequent list of rules.
  • ReplaceLVector behaves similar to built-in ReplaceAll function but replaces only expressions that are found in places where they can be interpreted as objects proportional to four-vector. So e.g. label inside spinor chain (representing slashed matrix) can be replaced, but label at the end of spinor chain (representing spinor - an object that scales as square root of four-vector) will never be replaced.
Occurrences of replaced label that represent object that scales as integer power of four-vector are replaced:
Occurrences of replaced label that scale as non-integer power of four-vector (e.g. spinor which scales as square root) are not replaced:
Labels representing massless objects can be used, but only occurrences representing objects scaling as integer power of four-vector will be replaced:
Occurrences of replaced label that represent object that scales as integer power of four-vector are replaced:
In[1]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
Out[3]=
In[4]:=
Click for copyable input
Out[4]=
Out[4]=
 
Occurrences of replaced label that scale as non-integer power of four-vector (e.g. spinor which scales as square root) are not replaced:
In[1]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
Out[3]=
 
Labels representing massless objects can be used, but only occurrences representing objects scaling as integer power of four-vector will be replaced:
In[1]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=
Out[3]=
Rule with patterns can be used:
Note that 1 at the beginning of spinor chain was not replaced.
RuleDelayed with named patterns can be used:
List of rules can be used:
List of lists of rules can be used, ReplaceLVector will return list or results:
Any expression can be replaced by any other expression only requirement is that expression occurs inside symbol in which it can be interpreted as linear in four-momentum: