Python | sympy as_ferrers() method
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.
# import sympy and IntegerPartition from sympy.combinatorics.partitions import IntegerPartition from sympy import * # Using sympy.combinatorics.partitions.IntegerPartition().as_ferrers() method gfg = IntegerPartition([ 1 ] + [ 2 , 3 ]).as_ferrers() print (gfg) |
Output :
###
##
#
Example #2 :
# import sympy and IntegerPartition from sympy.combinatorics.partitions import IntegerPartition from sympy import * # Using sympy.combinatorics.partitions.IntegerPartition().as_ferrers() method gfg = IntegerPartition([ 1 ] + [ 2 , 3 ] + [ 4 ] + [ 5 ]).as_ferrers(char = '$' ) print (gfg) |
Output :
$$$$$
$$$$
$$$
$$
$
Contact Us