def compute_b(sigma, q, lmbd, verbose=False):
    (mu0, _, mu) = distributions(sigma, q)
    b_lambda_fn = (lambda z: (mu0(z) * np.power(cropped_ratio(mu0(z), mu(z)), lmbd)))
    b_lambda = integral_inf(b_lambda_fn)
    m = ((sigma ** 2) * (np.log(((2.0 - q) / (1.0 - q))) + (1.0 / (2 * (sigma ** 2)))))
    b_fn = (lambda z: (np.power((mu0(z) / mu(z)), lmbd) - np.power((mu((- z)) / mu0(z)), lmbd)))
    if verbose:
        print('M =', m)
        print('f(-M) = {} f(M) = {}'.format(b_fn((- m)), b_fn(m)))
        assert ((b_fn((- m)) < 0) and (b_fn(m) < 0))
    b_lambda_int1_fn = (lambda z: (mu0(z) * np.power(cropped_ratio(mu0(z), mu(z)), lmbd)))
    b_lambda_int2_fn = (lambda z: (mu0(z) * np.power(cropped_ratio(mu(z), mu0(z)), lmbd)))
    b_int1 = integral_bounded(b_lambda_int1_fn, (- m), m)
    b_int2 = integral_bounded(b_lambda_int2_fn, (- m), m)
    a_lambda_m1 = compute_a(sigma, q, (lmbd - 1))
    b_bound = ((a_lambda_m1 + b_int1) - b_int2)
    if verbose:
        print('B: by numerical integration', b_lambda)
        print('B must be no more than     ', b_bound)
    print(b_lambda, b_bound)
    return _to_np_float64(b_lambda)
def compute_b(sigma, q, lmbd, verbose=False):
    (mu0, _, mu) = distributions(sigma, q)
    b_lambda_fn = (lambda z: (mu0(z) * np.power(cropped_ratio(mu0(z), mu(z)), lmbd)))
    b_lambda = integral_inf(b_lambda_fn)
    m = ((sigma ** 2) * (np.log(((2.0 - q) / (1.0 - q))) + (1.0 / (2 * (sigma ** 2)))))
    b_fn = (lambda z: (np.power((mu0(z) / mu(z)), lmbd) - np.power((mu((- z)) / mu0(z)), lmbd)))
    if verbose:
        print('M =', m)
        print('f(-M) = {} f(M) = {}'.format(b_fn((- m)), b_fn(m)))
        assert ((b_fn((- m)) < 0) and (b_fn(m) < 0))
    b_lambda_int1_fn = (lambda z: (mu0(z) * np.power(cropped_ratio(mu0(z), mu(z)), lmbd)))
    b_lambda_int2_fn = (lambda z: (mu0(z) * np.power(cropped_ratio(mu(z), mu0(z)), lmbd)))
    b_int1 = integral_bounded(b_lambda_int1_fn, (- m), m)
    b_int2 = integral_bounded(b_lambda_int2_fn, (- m), m)
    a_lambda_m1 = compute_a(sigma, q, (lmbd - 1))
    b_bound = ((a_lambda_m1 + b_int1) - b_int2)
    if verbose:
        print('B: by numerical integration', b_lambda)
        print('B must be no more than     ', b_bound)
    print(b_lambda, b_bound)
    return _to_np_float64(b_lambda)