Further Examples

Load xTensor`:

In[1]:=

Needs["xAct`xTensor`"]

--------------------------------------------------------------------------------

Package xAct`xCore`  version 0.4.0,  {2007, 11, 6}

CopyRight (C) 2007, Jose M. Martin-Garcia, under the General Public License.

--------------------------------------------------------------------------------

Package ExpressionManipulation`

CopyRight (C) 1999-2007, David J. M. Park and Ted Ersek

--------------------------------------------------------------------------------

Package xAct`xPerm`  version 0.7.0,  {2007, 11, 6}

CopyRight (C) 2003-2007, Jose M. Martin-Garcia, under the General Public License.

Connecting to external linux executable...

Connection established.

--------------------------------------------------------------------------------

Package xAct`xTensor`  version 0.9.3,  {2007, 11, 6}

CopyRight (C) 2002-2007, Jose M. Martin-Garcia, under the General Public License.

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Define a manifold (and its associated tangent bundle) and a tensor:

In[2]:=

DefManifold[M, 4, IndexRange[a, p], z]

** DefManifold: Defining manifold M.

** DefVBundle: Defining vbundle TangentM.

In[3]:=

DefTensor[T[a, b, c], M]

** DefTensor: Defining tensor T[a, b, c] .

The basic operation of tracing is as follows, replacing a dummy pair by different possibilities, adding up the results:

In[4]:=

TraceDummy[T[a, b, c] T[-a, -b], a→IndexList[d, e, f]]

Out[4]=

T_db^   T_   ^dbc + T_eb^   T_   ^ebc + T_fb^   T_   ^fbc

Several indices can be splitted at the same time:

In[5]:=

TraceDummy[T[a, b, c] T[-a, -b], {a→IndexList[d, e, f], b→IndexList[g, h]}]

Out[5]=

T_dg^   T_   ^dgc + T_dh^   T_   ^dhc + T_eg^   T_   ^egc + T_eh^   T_   ^ehc + T_fg^   T_   ^fgc + T_fh^   T_   ^fhc

If a dummy is not present then it is not traced:

In[6]:=

TraceDummy[T[a, b, c] T[-a, -b], c→IndexList[d, e, f]]

Out[6]=

T_ab^   T_   ^abc

It is possible to use more powerful rules, with patterns on the LHS and delayed index generation on the RHS:

In[7]:=

TraceDummy[T[a, b, A, c] T[-a, -b, -A], _ ? TangentM`Q:→IndexList[DummyIn[TangentM], DummyIn[TangentM]]]

Out[7]=

T_p$79p$81A^          T_          ^p$79p$81Ac + T_p$79p$82A^          T_          ^p$79p$82Ac + T_p$80p$81A^          T_          ^p$80p$81Ac + T_p$80p$82A^          T_          ^p$80p$82Ac

The function TraceDummy is rather efficient. This is an example tracing 6 dummy pairs in 6 dimensions (final expression with 6^6=46656 components):

In[8]:=

Length[ TraceDummy[T[a, b, c, d, e, f, -a, -b, -c, -d, -e, -f], _→IndexList[g, h, i, j, k, l]] ] //AbsoluteTiming

Out[8]=

{1.546675 Second, 46656}

Verbose log message can be turned on:

In[9]:=

$TraceDummyVerbose = True

Out[9]=

True

It is possible to mark the expanded terms using a third argument:

In[10]:=

T[a, b, c] T[-b, -c] + 5Sin[T[b] T[-b]] (3T[a] + T[d] T[a, -d])

Out[10]=

5 Sin[T_b^  T_ ^b] (3 T_ ^a + T_ ^d T_ ( d)^a ) + T_bc^   T_   ^abc

In[11]:=

TraceDummy[%, _→IndexList[A, B], Expanded]

Tracing indices  {b}  in T_b^  T_ ^b

Tracing indices  {d}  in T_ ^d T_ ( d)^a

Tracing indices  {b, c}  in T_bc^   T_   ^abc

Out[11]=

Expanded[T_AA^   T_   ^aAA + T_AB^   T_   ^aAB + T_BA^   T_   ^aBA + T_BB^   T_   ^aBB] + 5 Sin[Expanded[T_A^  T_ ^A + T_B^  T_ ^B]] (Expanded[T_ ^A T_ ( A)^a + T_ ^B T_ ( B)^a ] + 3 T_ ^a)

Tidy up:

In[12]:=

UndefTensor[T]

** Undefined tensor T

In[13]:=

UndefManifold[M]

** Undefined vector bundle TangentM

** Undefined manifold M


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