Partition.prev_lex():prev_lex()是一个sympy Python库函数,按字典顺序返回前一个整数分区n。如果分区为[1,…,1],则此顺序环绕[n]。
用法: sympy.combinatorics.partitions.Partition.prev_lex()
返回:前一个整数分区,按字母顺序排列n
代码1:prev_lex()示例
]
# Python code explaining
# SymPy.prev_lex()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import IntegerPartition
# Using from sympy.combinatorics.partitions.Partition.prev_lex() method
p = IntegerPartition([312, 121, 14, 5])
print('p : ', p)
print('\nPrevious Integrer : ', p.prev_lex())
输出:
p : [312, 121, 14, 5]
Previous Integrer : [312, 121, 14, 4, 1]
代码2:prev_lex()示例
]
# Python code explaining
# SymPy.prev_lex()
# importing SymPy libraries
from sympy.combinatorics.partitions import Partition
from sympy.combinatorics.partitions import IntegerPartition
# Using from sympy.combinatorics.partitions.Partition.prev_lex() method
p = IntegerPartition([1, 312, 121, 14,
34, 56, 32])
print('p : ', p)
print('\nPrevious Integrer : ', p.prev_lex())
输出:
p : [312, 121, 56, 34, 32, 14, 1]
Previous Integrer : [312, 121, 56, 34, 32, 13, 2]
相关用法
- Python sympy.gcd()用法及代码示例
- Python sympy.nP()用法及代码示例
- Python sympy.Mul()用法及代码示例
- Python sympy.nC()用法及代码示例
- Python sympy.Add()用法及代码示例
- Python sympy.cot()用法及代码示例
- Python sympy RGS用法及代码示例
- Python sympy.ones()用法及代码示例
- Python sympy.div()用法及代码示例
- Python sympy.sec()用法及代码示例
- Python Sympy Permutation.max()用法及代码示例
- Python sympy.csc()用法及代码示例
- Python sympy.crt()用法及代码示例
- Python sympy.det()用法及代码示例
- Python sympy.cos()用法及代码示例
注:本文由纯净天空筛选整理自noobestars101大神的英文原创作品 SymPy | Partition.prev_lex() in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。