Factorial and Gamma Functions in Python - math.factorial(), math.gamma(), scipy.special.gamma()

Опубликовано: 20 Март 2026
на канале: MCC Py Tutorials
1,796
22

Tutorial on the factorial and gamma functions in Python, including how to use math.factorial(), how math.gamma() can be used to take "factorials" of non-integers and other numbers, and how scipy.special.gamma() can fill in some of the limitations found in math.gamma(). Time stamps are below.

Explanation of factorials for positive integers - 0:40
math.factorial() - 2:00
Explanation of the gamma function - 5:52
Using math.gamma(x+1) to find "factorials" - 9:37
Using math.gamma(x+1) to find "factorials" of negative non-integers - 11:27
Using math.gamma(x+1) to find "factorials" of negative integers? - 12:00
Using scipy.special.gamma(x+1) to fill in the gaps - 13:04
--installing scipy - 13:37
--importing the gamma function from scipy.special - 14:25
--scipy.special.gamma() in action - 15:03
--visualizing scipy.special.gamma() on a graph - 17:03

For more information on math.factorial() and math.gamma(), visit https://docs.python.org/3/library/mat...

For more information on scipy.special.gamma(), visit https://docs.scipy.org/doc/scipy/refe...

For more information on SciPy, including further instructions on installation, visit https://www.scipy.org/

The graphs in this video were made with matplotlib. For more information on matplotlib, visit: https://matplotlib.org/

This tutorial uses Python 3.8.3. To download the current version of Python, visit: https://www.python.org/. It also uses PyCharm (Community Edition). To download PyCharm, visit: https://www.jetbrains.com/pycharm/.