當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python sympy as_ferrers()用法及代碼示例

借助sympy.combinatorics.IntegerPartition().as_ferrers()方法,我們可以通過使用來獲得分區值的ferrer圖sympy.combinatorics.IntegerPartition().as_ferrers()方法。

用法: sympy.combinatorics.IntegerPartition().as_ferrers()

返回:返回費雷爾圖。


範例1:
在這個例子中,我們可以通過使用sympy.combinatorics.IntegerPartition().as_ferrers()方法,我們可以得到費雷爾圖。

# 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)

輸出:

$$$$$
$$$$
$$$
$$
$



相關用法


注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy as_ferrers() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。