The following
from scipy.special import gamma
gamma(x)
overflows for large x
. This is why scipy provides gammaln
, which is equivalent to np.log(gamma(x))
and allows us to work in log space and avoid overflow.
Is there anything like this for scipy's exp1
function? I'd like to have something that returns the same as below but without underflowing for large x
:
import numpy as np
from scipy.special import exp1
def exp1ln(x):
return np.log(exp1(x))
(My reasoning for thinking this would be similar to gammaln
is because exp1
is in the same family of functions, see here: Incomplete Gamma function in scipy .)
Thanks