def _expon_solve_lam_from_mu(mu, b):
    """
    For the expon_uptrunc, given mu and b, return lam.
    Similar to geom_uptrunc
    """

    def lam_eq(lam, mu, b):
        # Small offset added to denominator to avoid 0/0 erors
        lam, mu, b = Decimal(lam), Decimal(mu), Decimal(b)
        return ( (1 - (lam*b + 1) * np.exp(-lam*b)) /
                 (lam - lam * np.exp(-lam*b) + Decimal(1e-32)) - mu )

    return optim.brentq(lam_eq, -100, 100, args=(mu, b), disp=True)
def _expon_solve_lam_from_mu ( mu , b ) : def lam_eq ( lam , mu , b ) : lam , mu , b = Decimal ( lam ) , Decimal ( mu ) , Decimal ( b ) return ( ( 1 - ( lam * b + 1 ) * np . exp ( - lam * b ) ) / ( lam - lam * np . exp ( - lam * b ) + Decimal ( 1e-32 ) ) - mu ) return optim . brentq ( lam_eq , - 100 , 100 , args = ( mu , b ) , disp = True )
For the expon_uptrunc, given mu and b, return lam.
    Similar to geom_uptrunc