Python | sympy.expand_func() method
Last Updated :
07 Jul, 2019
With the help of sympy.expand_func() method, we can expand special functions in terms of some mathematical identities.
Syntax: expand_func(expression)
Parameter:
expression – It is mathematical expression which is to expanded.
Returns: Returns a mathematical expression corresponding to the input in terms of some mathematical identities.
Example #1:
from sympy import *
x = symbols( 'x' )
expr = gamma(x + 3 )
print ( "Expression = {}" . format (expr))
expand_expr = expand_func(expr)
print ( "Expanded Expression : {}" . format (expand_expr))
|
Output:
Expression = gamma(x + 3)
Expanded Expression : x*(x + 1)*(x + 2)*gamma(x)
Example #2:
from sympy import *
x = symbols( 'x' )
expr = binomial(x, 3 )
print ( "Expression = {}" . format (expr))
expand_expr = expand_func(expr)
print ( "Expanded Expression : {}" . format (expand_expr))
|
Output:
Expression = binomial(x, 3)
Expanded Expression : x*(x - 2)*(x - 1)/6
Share your thoughts in the comments
Please Login to comment...