SymPy | Python中的 Partition.as_ferrers()
Partition.as_ferrers() : as_ferrers()是一个 sympy Python库函数,它根据提到的字符返回分区的 ferrer 图。
Syntax : sympy.combinatorics.partitions.Partition.as_ferrers(char)
Return : ferrer diagram of a partition
代码 #1:as_ferrers() 示例
# Python code explaining
# SymPy.as_ferrers()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import IntegerPartition
# Using from sympy.combinatorics.partitions.Partition.as_ferrers() method
print(IntegerPartition([5, 2, 5]).as_ferrers())
输出 :
#####
#####
##
代码 #2:as_ferrers(char = '*') 示例
# Python code explaining
# SymPy.as_ferrers()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import IntegerPartition
# Using from sympy.combinatorics.partitions.Partition.as_ferrers() method
print(IntegerPartition([1, 2, 3, 4]).as_ferrers(char = '*'))
输出 :
****
***
**
*