Python | sympy as_ferrers() method
Last Updated :
26 Aug, 2019
With the help of sympy.combinatorics.IntegerPartition().as_ferrers()
method, we can get the ferrer diagram of partition values by using sympy.combinatorics.IntegerPartition().as_ferrers()
method.
Syntax : sympy.combinatorics.IntegerPartition().as_ferrers()
Return : Return the ferrer diagram.
Example #1 :
In this example we can see that by using sympy.combinatorics.IntegerPartition().as_ferrers()
method, we are able to get the ferrer diagram.
from sympy.combinatorics.partitions import IntegerPartition
from sympy import *
gfg = IntegerPartition([ 1 ] + [ 2 , 3 ]).as_ferrers()
print (gfg)
|
Output :
###
##
#
Example #2 :
from sympy.combinatorics.partitions import IntegerPartition
from sympy import *
gfg = IntegerPartition([ 1 ] + [ 2 , 3 ] + [ 4 ] + [ 5 ]).as_ferrers(char = '$' )
print (gfg)
|
Output :
$$$$$
$$$$
$$$
$$
$
Share your thoughts in the comments
Please Login to comment...