6.1. ComponentArray and TableOfComponents

ComponentArray            Generate a list of components
TableOfComponents        Generate a list of components, with many more options

Arrays of components

The commands described in this subsection essentially generate lists of c-indices from free b-indices (or free a-indices through ToBasis). The basic command is ComponentArray,

In[273]:=

ComponentArray[v[{a, polar}]]

Out[273]=

{v_ ^0, v_ ^1, v_ ^2}

NOTE: Up to version 0.6, the role of ComponentArray was played by a different function, called Components.

If the object to expand is a tensor (and only in this case), we can use a shorter notation

In[274]:=

ComponentArray[T, {-polar, -polar}]

Out[274]=

We can mix bases

In[275]:=

ComponentArray[T, {-polar, -cartesian}]

Out[275]=

Component indices are not expanded

In[276]:=

ComponentArray[T[{-a, -polar}, {1, -polar}]]

Out[276]=

{T_ (01)^  , T_ (11)^  , T_ (21)^  }

We can specify which indices to expand

In[277]:=

ComponentArray[T[-{a, polar}, -{b, polar}] v[{c, cartesian}], IndexList[{-a, -polar}, {c, cartesian}]]

Out[277]=

In[278]:=

ComponentArray[T[-{a, polar}, -{b, polar}] v[{c, cartesian}], IndicesOf[T]]

Out[278]=

but c-indices are never expanded

In[279]:=

ComponentArray[v[{1, polar}], IndexList[{1, polar}]]

Out[279]=

v_ ^1

The order of indices matters:

In[280]:=

ComponentArray[v[{a, polar}, {b, polar}]]

Out[280]=

In[281]:=

ComponentArray[v[{b, polar}, {a, polar}]]

Out[281]=

ComponentArray avoids clashes with dummy indices (notice the use of Scalar):

In[282]:=

ComponentArray[Scalar[v[{a, polar}] v[{-a, -polar}]] v[{-a, -polar}]]

Out[282]=

{Scalar[v_a^  v_ ^a] v_0^ , Scalar[v_a^  v_ ^a] v_1^ , Scalar[v_a^  v_ ^a] v_2^ }

If we want more flexibility, we can use TableOfComponents. This function, whose syntax mimics that of the standard Mathematica Table, is much more flexible, but also slower. The reason for this is that TableOfComponents uses ToBasis internally, which performs many checks.  Now we specifiy `iterators' on basis indices as additional arguments. If the specified index {a, basis} was already in the expression, this just tells the function when to expand it (i.e. in what order with respect to the remaining indices). If it was not present but a appeared as an abstract index, the system first turns it into a basis index and then expands it:

In[283]:=

TableOfComponents[T[-{a, polar}, -{b, polar}], -{a, polar}, -{b, polar}]

Out[283]=

In[284]:=

TableOfComponents[T[-a, -b], -{a, polar}, -{b, polar}]

Out[284]=

Notice how basis indices mimic the behaviour of Mathematica iterators. We have been able to expand an expression which contained only abstract indices. This is equivalent to doing

In[285]:=

ToBasis[polar][T[-a, -b]]

Out[285]=

T_ (ab)^  

In[286]:=

ComponentArray[%]

Out[286]=

However, we cannot change the basis of a BIndex already in the expression

In[287]:=

TableOfComponents[T[{-a, -polar}, -b], {-a, -cartesian}]

Out[287]=

T_ (ab)^  

If we do not specify any index, the argument is returned unchanged (compare with ComponentArray):

In[288]:=

TableOfComponents[v[{a, polar}] ]

Out[288]=

v_ ^a

In[289]:=

 ComponentArray[v[{a, polar}]]

Out[289]=

{v_ ^0, v_ ^1, v_ ^2}

The order is again important

In[290]:=

TableOfComponents[T[a, b], {a, polar}, {b, polar}]

Out[290]=

In[291]:=

TableOfComponents[T[a, b], {b, polar}, {a, polar}]

Out[291]=

As ToBasis is able to handle derivatives, we can include them in the arguments of TableOfComponents

In[292]:=

TableOfComponents[PD[-a][v[b]], -{a, polar}, {b, cartesian}]//MatrixForm

Out[292]//MatrixForm=

In[293]:=

TraceBasisDummy[%]

Out[293]=

If we wanted to obtain this result from ∂_a v^b using ComponentArray, we would have to be much more careful.

Several vbundles

In[294]:=

TableOfComponents[v[a] u[A], {A, comp}, {a, cartesian}]

Out[294]=

{{u_ ^(-1) v_ ^0, u_ ^(-1) v_ ^1, u_ ^(-1) v_ ^2}, {u_ ^1 v_ ^0, u_ ^1 v_ ^1, u_ ^1 v_ ^2}}

These functions do not take the symmetries into account automatically, but we can simplfy

In[295]:=

ComponentArray[T[{a, polar}, {b, polar}]]//ToCanonical//MatrixForm

Out[295]//MatrixForm=

Currently there is no function to construct a single component, because the notation must be nearly as long as the direct construction itself! Coba (see section 6.2) can be used to do that, in case the same component must be constructed for several different tensors.


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