Friday, October 10, 2025
HomeLanguagesSymPy | Partition.RGS_generalized() in Python

SymPy | Partition.RGS_generalized() in Python

Partition.RGS_generalized() : RGS_generalized() is a sympy Python library function that calculates the m + 1 generalized unrestricted growth strings (string where a[i] is the block in which element i occurs) and then return it as rows in matrix.

Restricted growth strings – string in which each character, ai results in the Block (Bi) in which the corresponding element belongs.

Syntax : sympy.combinatorics.partitions.Partition.RGS_generalized()

Return : generalized unrestricted growth strings as row of matrix.

Code #1 : RGS_generalized() Example




]
  
# 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)


Output :

Row of Matrix :
Matrix([[1, 1, 1, 1], [1, 2, 3, 0], [2, 5, 0, 0], [5, 0, 0, 0]])

Code #2 : RGS_generalized() Example




]
  
# 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)


Output :

Row of Matrix :
Matrix(0, 0, [])

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32349 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6792 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS