📜  SymPy | Python中的 Partition.conjugate()

📅  最后修改于: 2022-05-13 01:55:13.933000             🧑  作者: Mango

SymPy | Python中的 Partition.conjugate()

Partition.conjugate() : conjugate()是一个 sympy Python库函数,它返回参数分区的共轭分区。

代码 #1:conjugate() 示例

# Python code explaining
# SymPy.conjugate()
  
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import IntegerPartition
  
# Using from sympy.combinatorics.partitions.Partition.conjugate() method 
p = IntegerPartition([312, 14, 23])
print ('Conjugate : ', p.conjugate)

输出 :

代码 #2:conjugate() 示例 – 显示 ValueError。

# Python code explaining
# SymPy.conjugate()
  
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import IntegerPartition
  
# Using from sympy.combinatorics.partitions.Partition.conjugate() method 
  
# Only positive elements are required 
# so this will generate error
p = IntegerPartition([312, 14, -10, 23, -1])
print ('Conjugate : ', p.conjugate)

输出 :