I am trying to solve physic problem on operators which are not commute. However, I am not good at coding, so I am having some problem with Mathematica code.
Let's define my list such that
b[0] a[1] a[0] a[0]
The rules are that b and a are commute, same elements are commute(a[0] and a[0]), but a[1] and a[0] or b[1] and b[0] are not commute.
a[0] a[1] = a[1] a[0] + 1
b[0] b[1] = b[1] b[0] + 1
My goal is place b at the end, and place element with [1] at the end.
b[0]a[1]a[0]a[0] -> b[0] (a[0]a[1] + 1) a[0] -> b[0]a[0]a[1]a[0] + b[0]a[0]
-> b[0]a[0] (a[0]a[1] + 1) + b[0]a[0] -> b[0]a[0]a[0]a[1] + 2 b[0]a[0]
-> a[0]a[0]a[1]b[0] + 2 a[0]b[0]
I thought it might be good for me to use list-manipulation.
{b[0], a[1], a[0], a[0] } -> { a[0], a[0], a[1], b[0] } + 2 { a[0] , b[0] }
Similarly
{b[1], b[0], a[0], a[0]} -> { a[0], a[0], b[0], b[1] } +{a[0] a[0]}
{b[1], b[1], b[0], a[0]} -> { a[0], b[0], b[1], b[1] } + 2 {a[0] b[1]}
{a[1], a[1], a[1], a[0]} -> { a[0], a[1], a[1], a[1]} +3 {a[1],a[1]}
{a[1], a[1], a[0], a[0]} -> { a[0], a[0], a[1], a[1]} +2 {a[1],a[0]} +2 {a[0]+a[1]}
->{ a[0], a[0], a[1], a[1]} + 4{a[0]+a[1]} + 2
Anyone can suggest me what command shall I use? I think I can use If[], MemberQ[] and Select[]. However, I am not sure where to start.
Thank you
NonCommutativeMultiply
and the many questions about boson algebra on this site. For instance, this one and this one. $\endgroup$