📜  SymPy | Python中的 Partition.RGS_unrank()

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

SymPy | Python中的 Partition.RGS_unrank()

Partition.RGS_unrank(rank, n) :RGS_unrank()是一个 sympy Python库函数,它为大小为 n 的超集提供未排序的受限增长字符串(其中 a[i] 是元素 i 出现的块的字符串)

限制增长的字符串——字符串中的每个字符, a i导致对应元素所属的块 (B i )。

代码 #1:RGS_unrank() 示例

# Python code explaining
# SymPy.RGS_unrank()
  
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import RGS_unrank
  
# Using from sympy.combinatorics.partitions.Partition.RGS_unrank() method 
rank = 10
n = 5
p = RGS_unrank(rank, n)
  
print ("unranked restricted growth string for super size 10 : \n", p)

输出 :

代码 #2:RGS_unrank() 示例

# Python code explaining
# SymPy.RGS_unrank()
  
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import RGS_unrank
  
# Using from sympy.combinatorics.partitions.Partition.RGS_unrank() method 
p = RGS_unrank(100, 10)
  
print ("unranked restricted growth string for super size 10 : \n", p)

输出 :