简体   繁体   中英

Simplification of expression for factorial by SymPy

Can you please tell me if there is a command in SymPy to simplify the factorial? For example, Maxima has such a function, but I can't find it in SymPy. n!/(n+1)! = 1/(n+1)

There is a function gammasimp for this: https://docs.sympy.org/latest/tutorial/simplification.html#gammasimp

This is used internaly by simplify so you can also use that (using gammsimp directly is faster):

In [1]: simplify(factorial(n)/factorial(n + 1))
Out[1]: 
  1  
─────
n + 1

In [2]: gammasimp(factorial(n)/factorial(n + 1))
Out[2]: 
  1  
─────
n + 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM