Python | sympy IntegerPartition() method

With the help of sympy.combinatorics.partitions.IntegerPartition() method, we can get the elements in an array of subarrays that is passed as parameters in sympy.combinatorics.Partition().rank method.

Syntax : sympy.combinatorics.partitions.IntegerPartition()
Return : Return the partition of integer values.

Example #1 :
In this example we can see that by using sympy.combinatorics.partitions.IntegerPartition() method, we are able to get the partition of integer values.



filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy and IntegerPartition
from sympy.combinatorics.partitions import IntegerPartition
from sympy import *
   
# Using sympy.combinatorics.partitions.IntegerPartition() method
gfg = IntegerPartition([1] + [2, 3])
   
print(gfg)

chevron_right


Output :

[3, 2, 1]

Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy and IntegerPartition
from sympy.combinatorics.partitions import IntegerPartition
from sympy import *
   
# Using sympy.combinatorics.partitions.IntegerPartition() method
gfg = IntegerPartition([1] + [2, 3] + [4] + [5])
   
print(gfg)

chevron_right


Output :

[5, 4, 3, 2, 1]



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.