Python | sympy.expand_func() method
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:
# import sympy from sympy import * x = symbols('x') expr = gamma(x + 3) print("Expression = {}".format(expr)) # Use sympy.expand_func() method expand_expr = expand_func(expr) print("Expanded Expression : {}".format(expand_expr)) |
chevron_right
filter_none
Output:
Expression = gamma(x + 3) Expanded Expression : x*(x + 1)*(x + 2)*gamma(x)
Example #2:
# import sympy from sympy import * x = symbols('x') expr = binomial(x, 3) print("Expression = {}".format(expr)) # Use sympy.expand_func() method expand_expr = expand_func(expr) print("Expanded Expression : {}".format(expand_expr)) |
chevron_right
filter_none
Output:
Expression = binomial(x, 3) Expanded Expression : x*(x - 2)*(x - 1)/6
Recommended Posts:
- class method vs static method in Python
- Python | os.dup() method
- Python | set() method
- Python | next() method
- Python | os.getpid() method
- Python | sympy.ff() method
- Python | sympy.rf() method
- Python | os.getlogin() method
- Python PIL | eval() method
- Python | os.ftruncate() method
- Python | os.setgroups() method
- Python | sympy RGS method
- Python | sympy.crt() method
- Python PIL | getbands() method
- Python | os.getenv() method
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.



