Python中的SymPy Partition.RGS_generalized()
Partition.RGS_generalized() 。RGS_generalized()是一个sympy Python库函数,计算m+1个广义无限制增长字符串(字符串中a[i]是元素i出现的区块),然后作为矩阵中的行返回。
限制性增长字符串–字符串中的每个字符,a i都会导致相应元素所属的块(B i)。
语法 : sympy.combinatorics.partitions.Partition.RGS_generalized()
返回:广义非限制性增长字符串作为矩阵的一行。
代码 #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, [])