SymPy | Python中的 Partition.RGS_generalized()
Partition.RGS_generalized() :RGS_generalized()是一个 sympy Python库函数,它计算m + 1 个广义无限制增长字符串(字符串,其中 a[i] 是元素 i 出现的块) ,然后将其作为矩阵中的行返回。
限制增长的字符串——字符串中的每个字符, a i导致对应元素所属的块 (B i )。
Syntax : sympy.combinatorics.partitions.Partition.RGS_generalized()
Return : generalized unrestricted growth strings as row of matrix.
代码 #1:RGS_generalized() 示例
]
# Python code explaining
# SymPy.RGS_generalized()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import RGS_generalized
# Using from sympy.combinatorics.partitions.Partition.RGS_generalized() method
p = RGS_generalized(3)
print ("Row of Matrix : \n", p)
输出 :
Row of Matrix :
Matrix([[1, 1, 1, 1], [1, 2, 3, 0], [2, 5, 0, 0], [5, 0, 0, 0]])
代码 #2:RGS_generalized() 示例
]
# Python code explaining
# SymPy.RGS_generalized()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import RGS_generalized
# Using from sympy.combinatorics.partitions.Partition.RGS_generalized() method
p = RGS_generalized(-1)
print ("Row of Matrix : \n", p)
输出 :
Row of Matrix :
Matrix(0, 0, [])