简体   繁体   中英

Is there a Python function equivalent to Gamma[a, z] in Mathematica?

I believe the incomplete Gamma function implemented in Mathematica is equivalent to an unregularized version of the upper gamma function.. The Gamma incomplete function as implemented in scipy is a regularized lower gamma function.. However, I may be wrong as my knowledge in this area is zero. I need to compute an equivalent of the incomplete gamma function from Mathematica in Python

Thank you in advance for all the help!

The scipy.special module contains an implementation of both the lower incomplete gamma function scipy.special.gammainc and the upper incomplete gamma function scipy.special.gammaincc (note the second c at the end)

scipy gives a scaled version of Mathematicas equivalent. If a>0 in Gamma[a, x] you should be able to use:

from scipy.special import gamma, gammaincc
gamma(0.01)*(gammaincc(0.01, 1))
# 0.22036593781812577

for the equivalent of Gamma[0.01, 1] in Mathematica.

在此处输入图像描述

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