📜  SymPy | Python中的 Subset.rank_lexicographic()

📅  最后修改于: 2022-05-13 01:54:52.461000             🧑  作者: Mango

SymPy | Python中的 Subset.rank_lexicographic()

Subset.rank_lexicographic() : rank_lexicographic()是一个 sympy Python库函数,它返回子集的词典排序。

代码 #1:rank_lexicographic() 示例

# Python code explaining
# SymPy.Subset.rank_lexicographic()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.rank_lexicographic()
  
# Creating Subset
a = Subset(['c', 'd'], ['geek', 'for', 'c', 'd'])
  
# rank_lexicographic value
print ("Subset a rank_lexicographic : ", a.rank_lexicographic)

输出 :

代码 #2:rank_lexicographic() 示例

# Python code explaining
# SymPy.Subset.rank_lexicographic()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.subsets import Subset
  
# Using from 
# sympy.combinatorics.subset.Subsets.rank_lexicographic()
  
# Creating Subset
a = Subset([2, 3, 4], [1, 2, 3, 4, 5])
  
# rank_lexicographic value
print ("Subset a rank_lexicographic : ", a.rank_lexicographic)

输出 :