def plexp_inv(P, xmin, alpha, guess=<NUM_LIT:1.>):
def equation(x,prob):<EOL><INDENT>return plexp_cdf(x, xmin, alpha)-prob<EOL><DEDENT>def solver(y, x0=guess):<EOL><INDENT>return scipy.optimize.fsolve(equation, guess, args=(y,))<EOL><DEDENT>f = np.vectorize(solver)<EOL>return f(P)<EOL>
Inverse CDF for a piecewise PDF as defined in eqn. 3.10
of Clauset et al.

(previous version was incorrect and lead to weird discontinuities in the
distribution function)