Python | SymPy Permutation.commutator() method Last Updated : 26 Aug, 2019 Comments Improve Suggest changes Like Article Like Report Permutation.commutator() : commutator() is a sympy Python library function that returns the commutator of the partition. 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. Syntax : sympy.combinatorics.permutations.Permutation.commutator() Return : commutator of the partition Code #1 : commutator() Example Python3 1=1 # Python code explaining # SymPy.Permutation.commutator() # importing SymPy libraries from sympy.combinatorics.partitions import Partition from sympy.combinatorics.permutations import Permutation # Using from sympy.combinatorics.permutations.Permutation.commutator() method # creating Permutation a = Permutation([2, 0, 3, 1, 5, 4]) b = Permutation([1, 3, 5, 4, 2, 0]) print ("Permutation a - commutator form : ", a.commutator(b)) print ("Permutation b - commutator form : ", b.commutator(a)) Output : Permutation a - commutator form : Permutation([3, 1, 2, 5, 4, 0]) Permutation b - commutator form : Permutation([5, 1, 2, 0, 4, 3]) Code #2 : commutator() Example - Self Commutator Python3 1=1 # Python code explaining # SymPy.Permutation.commutator() # importing SymPy libraries from sympy.combinatorics.partitions import Partition from sympy.combinatorics.permutations import Permutation # Using from sympy.combinatorics.permutations.Permutation.commutator() method # creating Permutation a = Permutation([[2, 4, 0], [3, 1, 2], [1, 5, 6]]) # SELF COMMUTATING print ("Permutation a - commutator form : ", a.commutator(a)) Output : Permutation a - commutator form : Permutation([], size=7) Comment More infoAdvertise with us Next Article Python | SymPy Permutation.commutator() method N noobestars101 Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | SymPy Permutation.atoms() method Permutation.atoms() : atoms() is a sympy Python library function that returns all the elements that are present in the permutation. Syntax : sympy.combinatorics.permutations.Permutation.atoms() Return : elements of the argumented permutation. Code #1 : atoms() Example Python3 1=1 # Python code expla 1 min read 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 if a and b commute, i.e. ab == ba. Syntax : sympy.combinatorics.permutation 2 min read Python | SymPy Permutation.ascents() method Permutation.ascents() : ascents() is a sympy Python library function that returns the position of ascents in the permutation. Ascents are the elements where a[i] < a[i+1] Syntax : sympy.combinatorics.permutations.Permutation.ascents() Return : position of ascents in the permutation Code #1 : asce 1 min read Python | SymPy Permutation.array_form() method Permutation.array_form() : array_form() is a sympy Python library function that returns the 1 D copy of the augmented array. Syntax : sympy.combinatorics.permutations.Permutation.array_form() Return : copy of the Permutation in argument. Code #1 : array_form() Example Python3 # Python code explaini 1 min read Python | SymPy Permutation.descents() method Permutation.descents() : descents() is a sympy Python library function that returns the position of descents in the permutation. Descents are the elements where a[i] > a[i+1] Syntax : sympy.combinatorics.permutations.Permutation.descents() Return : position of descents in the permutation Code #1 1 min read Like