SymPy | Python中的 Prufer.prev()
Prufer.prev() :prev()是一个 sympy Python库函数,它返回 Prufer 序列,它是当前序列之前的 delta。
Syntax :
sympy.combinatorics.Prufer.prufer.prev()
Return :
Prufer sequence that is delta before the current one
代码 #1:prev() 示例
# Python code explaining
# SymPy.Prufer.prev()
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
# Using from
# sympy.combinatorics.prufer.Prufer.prev()
# Creating Prufer
a = Prufer([1, 2, 3], [2, 4, 5])
# prev value
print ("Prufer a prev : ", a.prev(1))
输出 :
Prufer a prev : Prufer([1, 2, 4])
代码 #2:prev() 示例
# Python code explaining
# SymPy.Prufer.prev()
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.prufer import Prufer
# Using from
# sympy.combinatorics.prufer.Prufer.prev()
# Creating Prufer
b = Prufer([1, 2, 3, 2, 4, 5], [6, 7], [8])
# prev value
print ("Prufer b prev : ", b.prev(1))
输出 :
Prufer b prev : Prufer([1, 2, 3, 2, 4, 4])