## 769 Reputation

17 years, 29 days

## MaplePrimes Activity

### These are answers submitted by itsme

so to fully answer my own question (hah!) in case someone else needs this... i think this does what i want:

restart:
with(Physics):
quantumOperators:={ap,am, sx, sy, sz}:
Setup(quantumoperators=quantumOperators):
Setup(Commutator(ap,sx)=0, Commutator(ap,sy)=0, Commutator(ap,sz)=0, Commutator(am,sx)=0, Commutator(am,sy)=0, Commutator(am,sz)=0):

now am, ap do not commute with eachother (likewise sx,sy,sz), but a and s "type" operators do commute.

i would still be interested to know how other people deal with this in maple.

## partial solution......

in the spirit of partly answering my own question...  it looks like the physics package may do this:

with(Physics):
Setup(noncommutativeprefix={a,x}):

expand((a1+a2)^2);
a1^2 + a1 a2 + a2 a1 + a2^2

expand((x1+x2)^2);
x1^2 + x1 x2 + x2 x1 + x2^2

... so that works.. but now:

expand((a1+x2)^2);

a1^2 + a1 x2 + x2 a1 x2^2

if i do

Setup(noncommutativeprefix=a, noncommutativeprefix=x):

then the non-commutative properties of a get overwritten.

## thanks for the suggestions...

thanks for the suggestions, although neither really works for me.

By the way in case I might not have been clear, by "sections" I literally mean maple sections (i.e. indented blocks that are created via insert->section).

Perhaps a simple way of comment/uncomment in the GUI editor is just not possible.... hmm.

## I have version 13. Ok - I...

I have version 13.

Ok - I do see what you mean.. this however for me only works when I want to comment out multiple lines wihtin the same execution block.

It still does not work when trying to comment out a whole sections

any other ideas?

thanks.