symbolic Pauli matrix expansions



Using the patched version of commutators.mac,
I use some tellsimpafter rules to further process
an expanded expression produced by  the 
defrule code in comm_simp defined in
commutators.mac.

In the file pauli1.mac (see below)
I am using the properties of the pauli matrices, such as
sig1 . sig2  = %i*sig3,  sig1 . sig1 = 1, 
comm (sig1, sig2) = 2*%i*sig3,  etc.

For a trial I again used the commutator form 
[b^3,  c^5], and  the results look ok 
until %o7 below:

----------------------------------------
(%i1) load(pauli1);
(%o1) "c:/work5/pauli1.mac"
(%i2) pauli_simp ( comm (sig2^^3,sig3^^5));
(%o2) 2*%i*sig1
(%i3) pauli_simp ( comm (sig3^^3,sig1^^5));
(%o3) 2*%i*sig2
(%i4) pauli_simp ( comm (sig1^^3,sig2^^5));
(%o4) 2*%i*sig3
(%i5) pauli_simp ( comm (sig3^^3,sig2^^5));
(%o5) -2*%i*sig1
(%i6) pauli_simp ( comm (sig1^^3,sig3^^5));
(%o6) -2*%i*sig2
(%i7) pauli_simp ( comm (sig2^^3,sig1^^5));
(%o7) -6*%i*sig2
-------------------------------
That last output should have been  -2*%i*sig3
which is the correct value for the commutator
 [ sig2, sig1 ].

So it looks like, again, the tellsimpafter method is
having a problem.

Is there a defrule approach to this final processing?

Here is the file pauli1.mac:
----------------------------------

/* file pauli1.mac
   symbolic expansion of products of
   pauli matrices */
   
   
load (commutators);

remove (comm, antisymmetric); 

declare ([s1, s2, s3, s4], scalar);

declare ([sig1,sig2,sig3], nonscalar)$

tellsimpafter (comm (sig1,sig2), 2*%i*sig3)$

tellsimpafter (comm (sig2,sig1), -2*%i*sig2)$

tellsimpafter (comm (sig2,sig3), 2*%i*sig1)$

tellsimpafter (comm (sig3,sig2), -2*%i*sig1)$

tellsimpafter (comm (sig3,sig1), 2*%i*sig2)$

tellsimpafter (comm (sig1,sig3), -2*%i*sig2)$

tellsimpafter (sig1 . sig1, 1)$

tellsimpafter (sig2 . sig2, 1)$

tellsimpafter (sig3 . sig3, 1)$

tellsimpafter (sig1 . sig2, %i*sig3)$

tellsimpafter (sig2 . sig1, -%i*sig3)$

tellsimpafter (sig2 . sig3, %i*sig1)$

tellsimpafter (sig3 . sig2, -%i*sig1)$

tellsimpafter (sig3 . sig1, %i*sig2)$

tellsimpafter (sig1 . sig3, -%i*sig2)$


pauli_simp (e) := (comm_simp (e), ev(%%, infeval))$

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

Ted Woollett