The following code represents obtaining the commutator of the square of the angular momentum vector and the down-ladder operator both associated with the H-atom electronic energy level quantum mechanics. It is a simple example of using the non-commutative algebra parts of Maxima to do computations.
reset() + kill(all);
dotscrules:true$
Lxsq:Lx.Lx$
Lysq: Ly.Ly$
Lzsq: Lz.Lz$
Lsq: Lxsq+Lysq+Lzsq$
Aminus:(Ax-%i*Ay);
AminusLsq : Aminus.Lsq$
LsqAminus : Lsq.Aminus$
print ("expanded initial form")$
comm:(AminusLsq-LsqAminus),expand;
comm: substitute(Lx.Lx.Ax =Lx.Ax.Lx,comm)$
comm: substitute(Ly.Ly.Ay =Ly.Ay.Ly,comm)$
comm: substitute(Lz.Lz.Az =Lz.Az.Lz,comm)$
comm: substitute(Ax.Lx.Lx =Lx.Ax.Lx,comm)$
comm: substitute(Ay.Ly.Ly =Ly.Ay.Ly,comm)$
print ("expanded after i,i exchanged form")$
comm: substitute(Az.Lz.Lz =Lz.Az.Lz,comm);
/*AyLz−LzAy=i hbarAx*/
print("1 z-y LzAyLz" )$
comm: substitute(%i*Lz.(Lz.Ay) =%i*(Lz.(Ay.Lz)-%i*%hbar*Lz.Ax),comm),expand;
comm: substitute(%i*Ay.(Lz^^2) =%i*(Lz.(Ay.Lz)+%i*%hbar*Ax.Lz),comm),expand;
/*AyLx−LxAy=−i hbarAz*/
print ("2 x-y *Lx(Lx.Ay) ")$
comm: substitute(Lx.Lx.Ay =(Lx.(Ay.Lx)+%i*%hbar*Lx.Az),comm),expand;
comm: substitute(%i*Ay.Lx^^2 =%i*(Lx.Ay.Lx-%i*%hbar*Az.Lx),comm),expand;
/*AxLy−LyAx=i hbarAz*/
print ("3 x-y *Ly(Ly.Ax) ")$
comm:substitute(Ax.Ly^^2=Ly.Ax.Ly+%i*%hbar*Az.Ly,comm),expand;
comm:substitute((Ly^^2).Ax=Ly.Ax.Ly-%i*%hbar*Ly.Az,comm),expand;
/*AxLz−LzAx=−i hbarAy*/
print("4 x-z Lz.(Lz.Ax) : ")$
comm: substitute(((Lz^^2).Ax) =Lz.(Ax.Lz)+%i*%hbar*Lz.Ay,comm),expand;
comm: substitute((Ax.Lz^^2) =Lz.Ax.Lz-%i*%hbar*Ay.Lz,comm),expand;
comm:comm/%hbar$
comm:expand(comm);
tex(%);