📜  Python| sympy.rf() 方法

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

Python| sympy.rf() 方法

sympy.rf()方法的帮助下,我们可以找到上升阶乘。上升阶乘定义为 –

 rf(x, k) = x \cdot (x+1) \cdots (x+k-1)

其中x可以是任意表达式, k是整数。

示例 #1:

# import sympy 
from sympy import * 
  
x = symbols('x')
k = 5
print("Value of x = {} and k = {}".format(x, k))
   
# Use sympy.rf() method 
rf_x_k = rf(x, k)  
      
print("Rising factorial rf(x, k) : {}".format(rf_x_k))  

输出:

Value of x = x and k = 5
Rising factorial rf(x, k) : x*(x + 1)*(x + 2)*(x + 3)*(x + 4)

示例 #2:

# import sympy 
from sympy import * 
  
x = 7
k = 5
print("Value of x = {} and k = {}".format(x, k))
   
# Use sympy.rf() method 
rf_x_k = rf(x, k)  
      
print("Rising factorial rf(x, k) : {}".format(rf_x_k))  

输出:

Value of x = 7 and k = 5
Rising factorial rf(x, k) : 55440