From: Christian Bauer Date: Fri, 30 Mar 2001 18:14:32 +0000 (+0000) Subject: - added Clifford contractions: X-Git-Tag: release_0-8-1~37 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=0376c72554e3892589cb554311ed28bcb77c7dda - added Clifford contractions: gamma~mu*gamma~alpha*gamma~beta*gamma.mu gamma~mu*gamma~alpha*gamma~beta*gamma~delta*gamma.mu - detection of free indices of the complete product in simplify_indexed_product() could go wrong if contractions resulted in composite expressions --- diff --git a/ginac/clifford.cpp b/ginac/clifford.cpp index 94f434a7..c1c069dc 100644 --- a/ginac/clifford.cpp +++ b/ginac/clifford.cpp @@ -117,15 +117,40 @@ bool diracgamma::contract_with(exvector::iterator self, exvector::iterator other if (is_ex_of_type(other->op(0), diracgamma)) { + ex dim = ex_to_idx(self->op(1)).get_dim(); + // gamma~mu*gamma.mu = dim*ONE if (other - self == 1) { - *self = ex_to_idx(self->op(1)).get_dim(); + *self = dim; *other = dirac_one(); return true; // gamma~mu*gamma~alpha*gamma.mu = (2-dim)*gamma~alpha - } else if (other - self == 2) { - *self = 2 - ex_to_idx(self->op(1)).get_dim(); + } else if (other - self == 2 + && is_ex_of_type(self[1], clifford)) { + *self = 2 - dim; + *other = _ex1(); + return true; + + // gamma~mu*gamma~alpha*gamma~beta*gamma.mu = 4*g~alpha~beta+(dim-4)*gamam~alpha*gamma~beta + } else if (other - self == 3 + && is_ex_of_type(self[1], clifford) + && is_ex_of_type(self[2], clifford)) { + *self = 4 * metric_tensor(self[1].op(1), self[2].op(1)) * dirac_one() + (dim - 4) * self[1] * self[2]; + self[1] = _ex1(); + self[2] = _ex1(); + *other = _ex1(); + return true; + + // gamma~mu*gamma~alpha*gamma~beta*gamma~delta*gamma.mu = -2*gamma~delta*gamma~beta*gamma~alpha+(4-dim)*gamma~alpha*gamma~beta*gamma~delta + } else if (other - self == 4 + && is_ex_of_type(self[1], clifford) + && is_ex_of_type(self[2], clifford) + && is_ex_of_type(self[3], clifford)) { + *self = -2 * self[3] * self[2] * self[1] + (4 - dim) * self[1] * self[2] * self[3]; + self[1] = _ex1(); + self[2] = _ex1(); + self[3] = _ex1(); *other = _ex1(); return true; } diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index 255fed53..e27a7f62 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -653,10 +653,8 @@ try_again: exvector un, dummy_indices; it1 = v.begin(); itend = v.end(); while (it1 != itend) { - if (is_ex_of_type(*it1, indexed)) { - const indexed & o = ex_to_indexed(*it1); - un.insert(un.end(), o.seq.begin() + 1, o.seq.end()); - } + exvector free_indices_of_factor = it1->get_free_indices(); + un.insert(un.end(), free_indices_of_factor.begin(), free_indices_of_factor.end()); it1++; } find_free_and_dummy(un, free_indices, dummy_indices);