Python | SymPy Permutation.commutes_with() method
Permutation.commutes_with() : commutes_with() is a sympy Python library function that checks whether the two permutations are commuting. Suppose ‘a’ and ‘b’ are part of ‘C’, then the commutator of a and b is the ‘C’ identity iff a and b commute, i.e. ab == ba.
checks whether the two permutations are commuting
Code #1 : commutes_with() Example
Permutation a – commutes_with form : False
Permutation b – commutes_with form : False
Code #2 : commutes_with() Example – Self Commutator
Permutation a – commutes_with form : True
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course