Re: Defining anti-symmetric operation. New ideas requested.
- To: mathgroup at smc.vnet.net
- Subject: [mg47266] Re: Defining anti-symmetric operation. New ideas requested.
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 2 Apr 2004 03:30:09 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <c4gdno$t3k$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, you need a *orderung relation* so that Mathematica can collect common factors and has a canonic form for the Commute[] function. Something like Commute[a_, b_] /; ! OrderedQ[{a, b}] := -Commute[b, a] will do that. Regards Jens Oleksandr Pavlyk wrote: > > 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