Python| sympy.ff() 方法
在sympy.ff()方法的帮助下,我们可以找到下降阶乘。下降阶乘定义为 –
其中x可以是任意表达式, k是整数。
Syntax: ff(x, k)
Parameter:
x – It denotes any arbitrary expression.
k – It denotes an integer.
Returns: Returns falling factorial corresponding to the given inputs.
示例 #1:
# import sympy
from sympy import *
x = symbols('x')
k = 5
print("Value of x = {} and k = {}".format(x, k))
# Use sympy.ff() method
ff_x_k = ff(x, k)
print("Falling factorial ff(x, k) : {}".format(ff_x_k))
输出:
Value of x = x and k = 5
Falling factorial ff(x, k) : x*(x - 4)*(x - 3)*(x - 2)*(x - 1)
示例 #2:
# import sympy
from sympy import * x = 7
k = 5
print("Value of x = {} and k = {}".format(x, k))
# Use sympy.ff() method
ff_x_k = ff(x, k)
print("Falling factorial ff(x, k) : {}".format(ff_x_k))
输出:
Value of x = 7 and k = 5
Falling factorial ff(x, k) : 2520