def _geom_solve_p_from_mu(mu, b):
def p_eq(x, mu, b):<EOL><INDENT>x, mu, b = Decimal(x), Decimal(mu), Decimal(b)<EOL>return ( (x / (<NUM_LIT:1> - x)) - ((b + <NUM_LIT:1>) / (x**-b - <NUM_LIT:1>)) - mu )<EOL><DEDENT>return <NUM_LIT:1> - optim.brentq(p_eq, <NUM_LIT>, <NUM_LIT:100>, args=(mu, b), disp=True)<EOL>
For the geom_uptrunc, given mu and b, return p.
Ref: Harte 2011, Oxford U Press. Eq. 7.50.