Python中的SymPy Partition.RGS_rank()
Partition.RGS_rank(rank, n) 。RGS_rank()是一个sympy Python库函数,它给出了一个限制性增长字符串的等级(字符串中a[i]是元素i出现的块)。
限制性增长字符串–字符串中的每个字符,a i导致相应元素所属的块(B i)。
语法 : sympy.combinatorics.partitions.Partition.RGS_rank()
返回:限制性增长字符串的等级。
代码 #1 : RGS_rank() 示例
# Python code explaining
# SymPy.RGS_rank()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import RGS_rank
# Using from sympy.combinatorics.partitions.Partition.RGS_rank() method
p = RGS_rank([0, 0, 1, 1, 2])
print ("rank for restricted growth string : \n", p)
输出 :
rank for restricted growth string :
10
代码 #2 :RGS_rank()示例
# Python code explaining
# SymPy.RGS_rank()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import RGS_rank
# Using from sympy.combinatorics.partitions.Partition.RGS_rank() method
p = RGS_rank( [0, 0, 0, 0, 0, 1, 1, 1, 0, 1])
print ("rank for restricted growth string : \n", p)
输出 :
rank for restricted growth string :
100