Python|同情 as_ferrers() 方法
借助sympy.combinatorics.IntegerPartition().as_ferrers()
方法,我们可以使用sympy.combinatorics.IntegerPartition().as_ferrers()
方法得到分区值的费勒图。
Syntax : sympy.combinatorics.IntegerPartition().as_ferrers()
Return : Return the ferrer diagram.
示例 #1:
在这个例子中,我们可以看到通过使用sympy.combinatorics.IntegerPartition().as_ferrers()
方法,我们可以得到 ferrer 图。
# 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)
输出 :
###
##
#
示例 #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)
输出 :
$$$$$
$$$$
$$$
$$
$