MathGroup Archive 2004

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

Search the Archive

Re: Re: Question about Hold

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48851] Re: [mg48820] Re: Question about Hold
  • From: Oleksandr Pavlyk <pavlyk at phys.psu.edu>
  • Date: Sat, 19 Jun 2004 04:30:52 -0400 (EDT)
  • Organization: Penn State University; Department of Physics
  • References: <carjrn$r76$1@smc.vnet.net> <200406180612.CAA10634@smc.vnet.net>
  • Reply-to: pavlyk at phys.psu.edu
  • Sender: owner-wri-mathgroup at wolfram.com

Jens-Peer Kuska wrote:

> Hi,
> 
> Commute[a, b] := c
> Commute[a^n_, b] := Commute[a^(n - 1), Commute[a, b]]

Jens, this gives plain wrong answer.

   Commute[a^2, b] = Commute[a,c]

while it must be   a*c + c*a

Hence one must use NonCommutativeMultiply. Below is the code
I use to define algebraic properties of commutator over the
ring of quantum operators.

Commute[(a_)*(b_), c_] :=  a*Commute[b, c] + Commute[a, c]*b;
Commute[a_, (b_)*(c_)] :=  b*Commute[a, c] + Commute[a, b]*c;
Commute[(a_)?NumericQ, b_] := 0;
Commute[a_, a_] := 0;
Commute[a_, (b_)?NumericQ] := 0;
Commute[a_, b_Plus] := Module[{LinTMP},
    Distribute[LinTMP[a, b], Plus, LinTMP, Plus, Commute]];
Commute[a_Plus, b_] := Module[{LinTMP},
     Distribute[LinTMP[a, b], Plus, LinTMP, Plus, Commute]];
JacobiIdentity[a_, b_, c_] := Expand[
       Commute[a, Commute[b, c]] +
       Commute[b, Commute[c, a]] +
       Commute[c, Commute[a, b]]
];
Commute[(a_)**(b_), c_] := a**Commute[b, c] + Commute[a, c]**b;
Commute[c_, (a_)**(b_)] := a**Commute[c, b] + Commute[c, a]**b;

Unprotect[ NonCommutativeMultiply];
(a___)**((b_)?NumericQ*(c_))**(d___) :=
    b*NonCommutativeMultiply[Sequence[a, c, d]];
(a___)**0**(b___) := 0;
(a___)**(b_Plus)**(c___) :=
    Module[{LinTMP},
     Distribute[LinTMP[a, b,c], Plus, LinTMP, Plus,
      NonCommutativeMultiply]];
Protect[ NonCommutativeMultiply];

After this is defined, let us define Heisenberg algebra

Commute[ A, B ] = 1;

Commute[ A**A, B ] gives  2 A as expected

Regards,
Sasha


> 
> Regards
>   Jens

> 
> Daohua Song wrote:
> 
>>Hi,evryone,
>>    I define a commute relation for quantum operators,i fact i learn this
>>from the forum.Here is the problem.
>>    Commute[A,B]=C.
>>    Commute[A^2,B], i try to use Hold[A*A] instead of A^2, then mathematica
>>even won't evaluate it.!
>>    Any suggestion to work on the power commutation?
>>    Thanks
>>Daohua


  • Prev by Date: Re: Announcement: Calculus with Mathematica
  • Next by Date: Re: Using NDSolve in NonlinearFit
  • Previous by thread: Re: Question about Hold
  • Next by thread: Re: Question about Hold