]> www.ginac.de Git - ginac.git/blobdiff - check/exam_clifford.cpp
Added complex conjugation methods and GiNaC function "conjugate".
[ginac.git] / check / exam_clifford.cpp
index ec305c65aeeda710fc4e1a0c0eec6c7cef9ff0ec..aef55cbcac285e9c35799cfd93a7f8188d20d449 100644 (file)
@@ -3,7 +3,7 @@
  *  Here we test GiNaC's Clifford algebra objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ static unsigned check_equal_simplify(const ex &e1, const ex &e2)
        return 0;
 }
 
-static unsigned clifford_check1(void)
+static unsigned clifford_check1()
 {
        // checks general identities and contractions
 
@@ -80,7 +80,7 @@ static unsigned clifford_check1(void)
        return result;
 }
 
-static unsigned clifford_check2(void)
+static unsigned clifford_check2()
 {
        // checks identities relating to gamma5
 
@@ -99,7 +99,7 @@ static unsigned clifford_check2(void)
        return result;
 }
 
-static unsigned clifford_check3(void)
+static unsigned clifford_check3()
 {
        // checks traces
 
@@ -107,7 +107,7 @@ static unsigned clifford_check3(void)
 
        symbol dim("D"), m("m"), q("q"), l("l"), ldotq("ldotq");
        varidx mu(symbol("mu"), dim), nu(symbol("nu"), dim), rho(symbol("rho"), dim),
-              sig(symbol("sig"), dim), kap(symbol("kap"), dim), lam(symbol("lam"), 4);
+              sig(symbol("sig"), dim), kap(symbol("kap"), dim), lam(symbol("lam"), dim);
        ex e;
 
        e = dirac_gamma(mu);
@@ -154,29 +154,40 @@ static unsigned clifford_check3(void)
        // non-cyclicity of order D-4 of gamma5 * S_6
        e = dirac_gamma5() * dirac_gamma(mu) * dirac_gamma(nu) * dirac_gamma(rho) * dirac_gamma(sig) * dirac_gamma(kap) * dirac_gamma(mu.toggle_variance())
          + dim * dirac_gamma5() * dirac_gamma(nu) * dirac_gamma(rho) * dirac_gamma(sig) * dirac_gamma(kap);
-       e = dirac_trace(e);
+       e = dirac_trace(e).simplify_indexed();
        e = (e / (dim - 4)).normal();
-       result += check_equal(e, 8 * eps0123(nu, rho, sig, kap));
+       result += check_equal(e, 8 * I * lorentz_eps(nu.replace_dim(4), rho.replace_dim(4), sig.replace_dim(4), kap.replace_dim(4)));
 
        // one-loop vacuum polarization in QED
        e = dirac_gamma(mu) *
-           (dirac_slash(l, dim) + dirac_slash(q, dim) + m * dirac_ONE()) *
+           (dirac_slash(l, dim) + dirac_slash(q, 4) + m * dirac_ONE()) *
            dirac_gamma(mu.toggle_variance()) *
            (dirac_slash(l, dim) + m * dirac_ONE());
        e = dirac_trace(e).simplify_indexed(sp);
        result += check_equal(e, 4*((2-dim)*l*l + (2-dim)*ldotq + dim*m*m).expand());
 
-       e = dirac_slash(q, dim) *
-           (dirac_slash(l, dim) + dirac_slash(q, dim) + m * dirac_ONE()) *
-           dirac_slash(q, dim) *
+       e = dirac_slash(q, 4) *
+           (dirac_slash(l, dim) + dirac_slash(q, 4) + m * dirac_ONE()) *
+           dirac_slash(q, 4) *
            (dirac_slash(l, dim) + m * dirac_ONE());
        e = dirac_trace(e).simplify_indexed(sp);
        result += check_equal(e, 4*(2*ldotq*ldotq + q*q*ldotq - q*q*l*l + q*q*m*m).expand());
 
+       // stuff that had problems in the past
+       ex prop = dirac_slash(q, dim) - m * dirac_ONE();
+       e = dirac_slash(l, dim) * dirac_gamma5() * dirac_slash(l, dim) * prop;
+       e = dirac_trace(dirac_slash(q, dim) * e) - dirac_trace(m * e)
+         - dirac_trace(prop * e);
+       result += check_equal(e, 0);
+
+       e = (dirac_gamma5() + dirac_ONE()) * dirac_gamma5();
+       e = dirac_trace(e);
+       result += check_equal(e, 4);
+
        return result;
 }
 
-static unsigned clifford_check4(void)
+static unsigned clifford_check4()
 {
        // simplify_indexed()/dirac_trace() cross-checks
 
@@ -210,7 +221,35 @@ static unsigned clifford_check4(void)
        return result;
 }
 
-unsigned exam_clifford(void)
+static unsigned clifford_check5()
+{
+       // canonicalize_clifford() checks
+
+       unsigned result = 0;
+
+       symbol dim("D");
+       varidx mu(symbol("mu"), dim), nu(symbol("nu"), dim), lam(symbol("lam"), dim);
+       ex e;
+
+       e = dirac_gamma(mu) * dirac_gamma(nu) + dirac_gamma(nu) * dirac_gamma(mu);
+       result += check_equal(canonicalize_clifford(e), 2*lorentz_g(mu, nu));
+
+       e = (dirac_gamma(mu) * dirac_gamma(nu) * dirac_gamma(lam)
+          + dirac_gamma(nu) * dirac_gamma(lam) * dirac_gamma(mu)
+          + dirac_gamma(lam) * dirac_gamma(mu) * dirac_gamma(nu)
+          - dirac_gamma(nu) * dirac_gamma(mu) * dirac_gamma(lam)
+          - dirac_gamma(lam) * dirac_gamma(nu) * dirac_gamma(mu)
+          - dirac_gamma(mu) * dirac_gamma(lam) * dirac_gamma(nu)) / 6
+         + lorentz_g(mu, nu) * dirac_gamma(lam)
+         - lorentz_g(mu, lam) * dirac_gamma(nu)
+         + lorentz_g(nu, lam) * dirac_gamma(mu)
+         - dirac_gamma(mu) * dirac_gamma(nu) * dirac_gamma(lam);
+       result += check_equal(canonicalize_clifford(e), 0);
+
+       return result;
+}
+
+unsigned exam_clifford()
 {
        unsigned result = 0;
        
@@ -221,7 +260,8 @@ unsigned exam_clifford(void)
        result += clifford_check2();  cout << '.' << flush;
        result += clifford_check3();  cout << '.' << flush;
        result += clifford_check4();  cout << '.' << flush;
-       
+       result += clifford_check5();  cout << '.' << flush;
+
        if (!result) {
                cout << " passed " << endl;
                clog << "(no output)" << endl;