Defining anti-symmetric operation. New ideas requested.

*To*: mathgroup at smc.vnet.net*Subject*: [mg47223] Defining anti-symmetric operation. New ideas requested.*From*: Oleksandr Pavlyk <pavlyk at phys.psu.edu>*Date*: Wed, 31 Mar 2004 02:58:00 -0500 (EST)*Organization*: Penn State University; Department of Physics*Reply-to*: pavlyk at phys.psu.edu*Sender*: owner-wri-mathgroup at wolfram.com

Dear MathGroup, In order to explain the problem I would need to say few words about what I am trying to accomplish. So please bear with me. I am often define bare bones of a Lie algebra, and check its consistency by Mathematica. To that end I have some generators, and I define their commutation relation. As an example let us take SU(2) with 3 generators H[], X[], Y[] To define the algebra I write Commute[ H[], X[] ] = Y[] Commute[ X[], Y[] ] = H[] Commute[ Y[], H[] ] = X[] now because of properties of Commute, Commute[ OperatorA, OperatorB ] = - Commute[OperatorB, OperatorA] So far I am realizing this property by defining Commute[ X[], H[] ] := -Commute[ H[], X[] ] Commute[ Y[], X[] ] := -Commute[ X[], Y[] ] Commute[ H[], Y[] ] := -Commute[ Y[], H[] ] So I come to my question. I would like Mathematica to define automatically Commute[OperatorB, OperatorA] every time I define Commute[OperatorA, OperatorB]. I tried to approach the problem by examining DownValues of Commute. (* This is evaluated if no direct definition was matched *) Commute[a_, b_]:=Module[{res}, res = HoldComplete[Commute[b,a]]/.DownValues[Commute]; If[ res === HoldComplete[Commute[b,a]], (* If nothing in DownValues *) Return[0] (* we declare everything else commuting *) , Return[ -ReleaseHold[res] ] ] ] This definition indeed gives Commute[ X[], H[] ] = -Y[], but if I try it on some undefined generators Commute[ J[], H[] ] I get infinite recursion, which is there because the very definition of trick solving part of Commute is also in DownValues, and hence we get res = HoldComplete[ Module[{},.... ] ] Any ideas on how to encode anti-symmetric properties of Commute would be very appreciated. I am sorry for slightly long post. The Mathematica notebook with the code is posted at http://www.pavlyk.com/SU(2).nb Thank you, Sasha