2.1. IndicesOf

In xTensor`, the main user level function to find indices in an expression was IndicesOf[selectors][expression],  

In[124]:=

DefTensor[TT[-a, -b, c, d, -e], M3]

DefTensor[U[-a, -b, c, d], M3]

DefTensor[S[-A, B], M3, Dagger→Complex]

** DefTensor: Defining tensor TT[-a, -b, c, d, -e] .

** DefTensor: Defining tensor U[-a, -b, c, d] .

** DefTensor: Defining tensor S[-A, B] .

** DefTensor: Defining tensor S†[-A†, B†] .

In[127]:=

Out[127]=

e_ ( 1)^a  TT_ (1b  a)^(  2c ) + e_ ( 1)^a  e_ ( e)^c  e_d ^( 2) S_B ^( A) S_A ^( B) U_ab  ^(  de)

In[128]:=

IndicesOf[Free][expr]

Out[128]=

{-b, c}

In[129]:=

IndicesOf[TangentM3][expr]

Out[129]=

{a, {1, -polar}, -b, {2, cartesian}, c, -a, {-e, -polar}, -d, d, {e, polar}}

In[130]:=

IndicesOf[InnerC][expr]

Out[130]=

{-B, {A, comp}, {-A, -comp}, B}

In[131]:=

IndicesOf[U, Free][expr]

Out[131]=

{-a, -b, d, {e, polar}}

In[132]:=

IndicesOf[Free, U][expr]

Out[132]=

{-b}

In[133]:=

IndicesOf[{U, Free}][expr]

Out[133]=

{-a, -b, d, {e, polar}, -b, c}

(See xTensorDoc.nb, section 9.1). xCoba` adds more possibilities. We can now use the types BIndex and CIndex as selectors, or search for a particular basis

In[134]:=

IndicesOf[{BIndex, CIndex}][expr]

Out[134]=

{{-e, -polar}, {A, comp}, {-A, -comp}, {e, polar}, {1, -polar}, {2, cartesian}}

In[135]:=

IndicesOf[polar][expr]

Out[135]=

{{1, -polar}, {-e, -polar}, {e, polar}}

Consider now the following example

In[136]:=

IndicesOf[Basis, polar][expr]

Out[136]=

{{1, -polar}, {-e, -polar}}

In[137]:=

IndicesOf[Basis[polar]][expr]

Out[137]=

{a, c, {1, -polar}, {-e, -polar}}

The first selects all the indices appearing in Basis objects and then selects from those only the ones that belong to polar. The second selects only those indices that belong to a Basis object of the polar basis, but returns the pair, not only the BCIndex.

In[138]:=

IndicesOf[Basis[polar]][Basis[{a, polar}, {-b, -cartesian}]]

Out[138]=

{{a, polar}, {-b, -cartesian}}

This function will be used heavily to control the behaviour of ContractBasis and SeparateBasis.


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