]> www.ginac.de Git - ginac.git/blobdiff - doc/tutorial/ginac.texi
- mentioned dummy index renaming
[ginac.git] / doc / tutorial / ginac.texi
index 5117d4ae2b7abe72c9e8dcbf23fc1913e32b7983..4dc99450d87be363df121f494df03edf52e7719c 100644 (file)
@@ -1605,6 +1605,8 @@ that performs some more expensive operations:
 @itemize
 @item it checks the consistency of free indices in sums in the same way
   @code{get_free_indices()} does
+@item it tries to give dumy indices that appear in different terms of a sum
+  the same name to allow simplifications like @math{a_i*b_i-a_j*b_j=0}
 @item it (symbolically) calculates all possible dummy index summations/contractions
   with the predefined tensors (this will be explained in more detail in the
   next section)
@@ -1643,7 +1645,7 @@ taken, and the expression to replace it with. After @code{sp.add(A, B, 0)},
 @code{simplify_indexed()} will replace all scalar products of indexed
 objects that have the symbols @code{A} and @code{B} as base expressions
 with the single value 0. The number, type and dimension of the indices
-doesn't matter; @samp{A~mu~nu*B.mu.nu} would also be replaced by 0.
+don't matter; @samp{A~mu~nu*B.mu.nu} would also be replaced by 0.
 
 @cindex @code{expand()}
 The example above also illustrates a feature of the @code{expand()} method:
@@ -1783,7 +1785,7 @@ It is output as @samp{eps}:
 @}
 @end example
 
-The matrix representation of the spinor metric is @code{[[ [[ 0, 1 ]], [[ -1, 0 ]]}.
+The matrix representation of the spinor metric is @code{[[ [[ 0, 1 ]], [[ -1, 0 ]] ]]}.
 
 @cindex @code{epsilon_tensor()}
 @cindex @code{lorentz_eps()}
@@ -2026,8 +2028,10 @@ ex dirac_slash(const ex & e, const ex & dim, unsigned char rl = 0);
 creates a term of the form @samp{e.mu gamma~mu} with a new and unique index
 whose dimension is given by the @code{dim} argument.
 
-The @code{simplify_indexed()} function performs contractions in gamma strings
-if possible, for example
+In products of dirac gammas, superfluous unity elements are automatically
+removed, squares are replaced by their values and @samp{gamma5} is
+anticommuted to the front. The @code{simplify_indexed()} function performs
+contractions in gamma strings, for example
 
 @example
 @{
@@ -2053,16 +2057,18 @@ To calculate the trace of an expression containing strings of Dirac gammas
 you use the function
 
 @example
-ex dirac_trace(const ex & e, unsigned char rl = 0);
+ex dirac_trace(const ex & e, unsigned char rl = 0, const ex & trONE = 4);
 @end example
 
 This function takes the trace of all gammas with the specified representation
-label; gammas with other labels are left standing. The @code{dirac_trace()}
-function is a linear functional that is equal to the usual trace only in
-@math{D = 4} dimensions. In particular, the functional is not cyclic in
-@math{D != 4} dimensions when acting on expressions containing @samp{gamma5},
-so it's not a proper trace. This @samp{gamma5} scheme is described in greater
-detail in @cite{The Role of gamma5 in Dimensional Regularization}.
+label; gammas with other labels are left standing. The last argument to
+@code{dirac_trace()} is the value to be returned for the trace of the unity
+element, which defaults to 4. The @code{dirac_trace()} function is a linear
+functional that is equal to the usual trace only in @math{D = 4} dimensions.
+In particular, the functional is not cyclic in @math{D != 4} dimensions when
+acting on expressions containing @samp{gamma5}, so it's not a proper trace.
+This @samp{gamma5} scheme is described in greater detail in
+@cite{The Role of gamma5 in Dimensional Regularization}.
 
 The value of the trace itself is also usually different in 4 and in
 @math{D != 4} dimensions:
@@ -2112,6 +2118,23 @@ QED:
 @}
 @end example
 
+The @code{canonicalize_clifford()} function reorders all gamma products that
+appear in an expression to a canonical (but not necessarily simple) form.
+You can use this to compare two expressions or for further simplifications:
+
+@example
+@{
+    varidx mu(symbol("mu"), 4), nu(symbol("nu"), 4);
+    ex e = dirac_gamma(mu) * dirac_gamma(nu) + dirac_gamma(nu) * dirac_gamma(mu);
+    cout << e << endl;
+     // -> gamma~mu*gamma~nu+gamma~nu*gamma~mu
+
+    e = canonicalize_clifford(e);
+    cout << e << endl;
+     // -> 2*eta~mu~nu
+@}
+@end example
+
 
 @cindex @code{color} (class)
 @subsection Color algebra
@@ -2185,6 +2208,14 @@ expressions containing color objects:
     cout << e.simplify_indexed() << endl;
      // -> -32/3
 
+    e = color_h(a, b, c) * color_T(b) * color_T(c);
+    cout << e.simplify_indexed() << endl;
+     // -> -2/3*T.a
+
+    e = color_h(a, b, c) * color_T(a) * color_T(b) * color_T(c);
+    cout << e.simplify_indexed() << endl;
+     // -> -8/9*ONE
+
     e = color_T(k) * color_T(a) * color_T(b) * color_T(k);
     cout << e.simplify_indexed() << endl;
      // -> 1/4*delta.b.a*ONE-1/6*T.a*T.b