Python | sympy.rf() method

With the help of sympy.rf() method, we can find the Rising factorial. Rising factorial is defined by –

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

where x can be arbitrary expression and k is an integer.

Syntax: rf(x, k)



Parameter:
x – It denotes any arbitrary expression.
k – It denotes an integer.

Returns: Returns rising factorial corresponding to the given inputs.

Example #1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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))  

chevron_right


Output:

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

Example #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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))  

chevron_right


Output:

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


My Personal Notes arrow_drop_up

Coder Machine Learner Social Activist Vocalist

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.