9.9. Coefficients
Given an expression, sometimes we need to get the (possibly indexed) coefficient multiplying a given tensor. When the objects have symmetries the coefficient might be more complicated than expected.
IndexCoefficient Find the coefficient of an indexed expression
Coefficients of indexed expressions.
The basic relation is this:
In[978]:=
Out[978]=
Metrics and symmetries must be taken into account:
In[979]:=
Out[979]=
In[980]:=
Out[980]=
In[981]:=
Out[981]=
In[982]:=
Out[982]=
Imitating Coefficient, dependencies must be explicit:
In[983]:=
Out[983]=
Frequently we need further manipulation of the result:
In[984]:=
Out[984]=
In[985]:=
Out[985]=
A closely related function is IndexCollect, which acts as a simple recursive driver for IndexCoefficient. This pair has been designed to follow closely the Mathematica pair Collect / Coefficient.
IndexCollect Collect terms in an indexed expression
Suppose an expression like this:
In[986]:=
Out[986]=
In[987]:=
Out[987]=
Created by Mathematica (May 16, 2008) | ![]() |