MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Defining anti-symmetric operation. New ideas requested.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47251] Re: Defining anti-symmetric operation. New ideas requested.
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Thu, 1 Apr 2004 00:03:37 -0500 (EST)
  • References: <200403310758.CAA20995@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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
> 

I'm not entirely sure the code below will always elude infinite 
recursion but give it a try and see if it works for you.

Clear[Commute]
Commute[a_,a_] := 0
Commute[a_,b_] /; Not[OrderedQ[{a,b}]] := -Commute[b,a]

Clear[makeCommutator]
makeCommutator[a_,b_,c_] := With[
   {lhs=Commute[Apply[Sequence,Sort[{a,b}]]], rhs=Order[a,b]*c},
   Apply[SetDelayed, {lhs,rhs}]
   ]

For your example:

makeCommutator[H[], X[], y[]]
makeCommutator[X[], Y[], H[]]
makeCommutator[Y[], H[], X[]]

We do a quick sanity check.

In[58]:= ??Commute
Global`Commute

Commute[H[], X[]] := y[]

Commute[H[], Y[]] := -X[]

Commute[X[], Y[]] := H[]

Commute[a_, a_] := 0

Commute[a_, b_] /;  !OrderedQ[{a, b}] := -Commute[b, a]

In[59]:= Commute[Y[],X[]]
Out[59]= -H[]


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Re: Constant function Integrate Assumption
  • Next by Date: RE: Re: Constant function Integrate Assumption
  • Previous by thread: RE: Re: Constant function Integrate Assumption
  • Next by thread: Re: Defining anti-symmetric operation. New ideas requested.