Defining pairwise commuting operators

95 views
Skip to first unread message

Vincent Russo

unread,
Oct 4, 2015, 12:37:25 PM10/4/15
to sympy
Hello, 

I'd like to see if there is a way to define operators that do not commute with themselves, but do commute with elements from a different set. 

For instance, 

from sympy import *
from sympy.physics.quantum.operator import HermitianOperator, Operator

A0
= HermitianOperator('A0')
A1
= HermitianOperator('A1')

B0
= HermitianOperator('B0')
B1
= HermitianOperator('B1')


Here, the variables are noncommutative. However, I do want the "A" variables to commute with the "B" variables. Specifically, I would like it so that [Ax,By] = 0 for all "x" and "y".

Is there a way to do that using the Operator package? Or if not, then just the symbol one? Thanks!

Aaron Meurer

unread,
Oct 4, 2015, 9:39:44 PM10/4/15
to sy...@googlegroups.com
I think just normal Symbol('A', commutative=False) behaves like you
want. commutative=False symbols do not commute with each other but
they do commute with commutative=True symbols (which is the default).

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/60336e86-7b4f-454d-aaa3-f4c603cc110f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages