def _compute_mean(C, g, ctx):
    """
    Compute mean according to equation 8a, page 773.
    """
    mag = ctx.mag
    dis = ctx.rrup

    # computing r02 parameter and the average distance to the fault surface
    ro2 = 1.4447e-5 * np.exp(2.3026 * mag)
    avg = np.sqrt(dis ** 2 + ro2)

    # computing fourth term of Eq. 8a, page 773.
    trm4 = (exp1(C['c4'] * dis) - exp1(C['c4'] * avg)) / ro2

    # computing the mean
    mean = C['c1'] + C['c2'] * mag + C['c3'] * np.log(trm4)

    # convert from cm/s**2 to 'g'
    mean = np.log(np.exp(mean) * 1e-2 / g)
    return mean