Open In App

Python | sympy.gammasimp() method

Last Updated : 11 Jul, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of sympy.gammasimp() method, we can simplify expressions with gamma functions or combinatorial functions with non-integer argument

Syntax: gammasimp(expression)

Parameter:
expression – It is the mathematical expression which needs to be simplified.

Returns: Returns a simplified mathematical expression corresponding to the input.

Example #1:




# import sympy 
from sympy import * x = symbols('x')
expr = gamma(x)*gamma(1 - x)
print("Expression = {}".format(expr))
   
# Use sympy.gammasimp() method 
simple_expr = gammasimp(expr)  
      
print("Simplified Expression : {}".format(simple_expr))  


Output:

Expression = gamma(x)*gamma(1 - x)
Simplified Expression : pi/sin(pi*x)

Example #2:




# import sympy 
from sympy import * x = symbols('x')
expr = gamma(x + 1)/gamma(x - 1)
print("Expression = {}".format(expr))
   
# Use sympy.gammasimp() method 
simple_expr = gammasimp(expr)  
      
print("Simplified Expression : {}".format(simple_expr))  


Output:

Expression = gamma(x + 1)/gamma(x - 1)
Simplified Expression : x*(x - 1)

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads