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]:=

IndexCoefficient[T[a, b], T[c, d]]

Out[978]=

δ_ ( c)^a  δ_ ( d)^b

Metrics and symmetries must be taken into account:

In[979]:=

IndexCoefficient[T[-a, -b], T[c, d]]

Out[979]=

g_ac^   g_bd^  

In[980]:=

IndexCoefficient[metricg[-a, -b], metricg[-c, -d]]

Out[980]=

1/2 (δ_a ^( d) δ_b ^( c) + δ_a ^( c) δ_b ^( d))

In[981]:=

IndexCoefficient[T[a, b] v[-a] v[-b], v[-c]]//Simplification

Out[981]=

1/2 (T_  ^ac + T_  ^ca) v_a^

In[982]:=

IndexCoefficient[T[a, b] v[-a] v[-b], v[-c] v[-d]]

Out[982]=

T_  ^cd/2 + T_  ^dc/2

Imitating Coefficient, dependencies must be explicit:

In[983]:=

IndexCoefficient[T[a, b], metricg[a, b]]

Out[983]=

0

Frequently we need further manipulation of the result:

In[984]:=

IndexCoefficient[T[a, b] v[-b] v[c] + T[d, -d] v[a] v[c], v[e]]

Out[984]=

1/2 (δ_ ( e)^c  T_  ^ab v_b^ + g_be^   T_  ^ab v_ ^c) + 1/2 (δ_ ( e)^c  T_ ( b)^b  v_ ^a + δ_ ( e)^a  T_ ( b)^b  v_ ^c)

In[985]:=

%//ContractMetric//Simplification

Out[985]=

1/2 (δ_ ( e)^c  (T_ ( b)^b  v_ ^a + T_  ^ab v_b^ ) + (T_ ( e)^a + δ_ ( e)^a  T_ ( b)^b ) v_ ^c)

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]:=

expr = T[a, b, -c] v[c] + U[a, b, c, d] v[-c] v[-d] + metricg[a, b]

Out[986]=

g_  ^ab + T_ (  c)^ab  v_ ^c + U_    ^abcd v_c^  v_d^

In[987]:=

IndexCollect[expr, {v[d], v[e]}, Simplification]

Out[987]=

g_  ^ab + v_ ^d (T_ (  d)^ab + 1/2 (U_ (  de)^ab   + U_ (  ed)^ab  ) v_ ^e)


Created by Mathematica  (May 16, 2008) Valid XHTML 1.1!