#include using namespace GiNaC; using namespace std; int main () { idx nu(symbol("nu"),2); ex e=clifford(dynallocate(), nu, indexed(matrix(2,2,lst{0,numeric(1,2),numeric(1,2),0}), idx(symbol("i"),2), idx(symbol("j"),2)), 0,+1); // +1 tells to use commutators instead of anti-commutators ex a=e.subs(nu==0), ap=e.subs(nu==1); cout << canonicalize_clifford(a*ap) << endl; // -> e.1*e.0+ONE cout << canonicalize_clifford(ap*a) << endl; // -> e.1*e.0 cout << canonicalize_clifford(a*ap-ap*a) << endl; // -> ONE cout << canonicalize_clifford(a*ap*ap-ap*ap*a) << endl; // -> 2*e.1 return 0; }