NonCommutativeMultiply
- To: mathgroup at yoda.physics.unc.edu
- Subject: NonCommutativeMultiply
- From: barenco at eldp.epfl.ch (ADRI)
- Date: Thu, 22 Apr 1993 09:19:20 +0200
Hi, I have the following problem with Mathematica : I am trying to work with objects that do not commute under a certain operation (call it multiplication). The objects have the following form fermi[a_,b_,c_] i.e. their Head is "fermi".I want Mma to reorder product of "fermi"s automatically according to specific commutation rules. I have redefined the function NonCommutativeMultiply and implemented the various commutation rules these object have to follow. It works fine, but it has a big drawback : it gets incredibly slow when the products are made up of more than 7 or 8 "fermi"s. I guess this is due to the fact that NonCommutativeMultiply is not optimized. Thus I tried to modify the Times function by removing the attribute Orderless, I had then to redefine the commutativity for all the Object whose head is NOT "fermi". I tried to do this, it worked fine for expression involving only "fermis" (quick and correct), but I never managed to re-implement completely the commutativity for objects other than "fermis". For instance, with compund expression (i.e. expression which are not pure products of "fermis") Mma returned these weird results : In[1]:= 2 fermi[1,1,1]; In[2]:= 2 fermi[1,1,1]; In[3]:= %1-%2 Out[3]= 4 fermi[1,1,1] !!!!!!!!! Recently, I also tried the package NonCommutativeAlgebra, but it uses the NonCommutativeMultiply function, and therefore it should be to slow for my needs. Does anyone have an idea of a way of implementing this problem properly ? Any help or advice would be appreciated Adriano Barenco Dept. of Physics Swiss Fed. Inst. of Technology ( email: Barenco at eldpa.epfl.ch )