# Python | sympy RGS method

With the help of `sympy.combinatorics.Partition().RGS` method, we are able to get the index value of members of subarray in the way that it is passed in the `Partition()` method by using `sympy.combinatorics.Partition().RGS` method.

Syntax : `sympy.combinatorics.Partition().RGS`

Return : Return tuple of index values.

Example #1 :
In this example we can see that by using `sympy.combinatorics.Partition().RGS` method, we can get the index values of members of subarray in one tuple.

 `# import sympy and Relational ` `from` `sympy.combinatorics.partitions ``import` `Partition ` `from` `sympy ``import` `*`  ` `  `x, y ``=` `symbols(``'x y'``) ` ` `  `# Using from sympy.combinatorics.partitions.Partition() method ` `gfg ``=` `Partition([``1``, ``2``], [``4``, ``5``, ``6``], [``-``12``, ``-``11``]) ` ` `  `print``(gfg.RGS) `

Output :

(0, 0, 1, 1, 2, 2, 2)

Example #2 :

 `# import sympy and Relational ` `from` `sympy.combinatorics.partitions ``import` `Partition ` `from` `sympy ``import` `*`  ` `  `x, y ``=` `symbols(``'x y'``) ` ` `  `# Using from sympy.combinatorics.partitions.Partition() method ` `gfg ``=` `Partition([``3``], [``1``, ``91``], [``2``], [``6``]) ` ` `  `print``(gfg.RGS) `

Output :

(0, 1, 2, 3, 0)

My Personal Notes arrow_drop_up

## Recommended Posts:

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.