import math


def calc_big_a_b_values(shape_k):
    """

    Args:
        shape_k: parameter k of GEV III (JHD)
        CDF(x) = exp{-[1-k(x-u)/a]**(1/k)}

        m = u + a*A, s = a * B
        where m: mean, s: std, u: location factor, a:scale factor
        A = (1/k)[1-Gamma(1+k)]
        B = (1/k)*sqrt[Gamma(1+2k)-Gamma(1+k)^2]

    Returns: A, B

    """
    assert 0.0 < shape_k < 0.5
    big_a = (1.0 - math.gamma(1.0 + shape_k)) / shape_k
    big_b = math.sqrt(math.gamma(1.0 + 2 * shape_k) - math.gamma(1.0 + shape_k) ** 2) / shape_k

    return big_a, big_b