def RC(a,b):
    """
    Compute Carlson's integral RC(a, b).

                1  /\oo       dx
    RC(a, b) =  -  |   -----------------
                2  |          1/2
                  \/0  (x + a)   (x + b)

    The parameters a and b may be complex numbers.
    """
    A, B = a, b
    for k in range(4):
        gms = 2*(A**0.5)*(B**0.5) + B
        A, B = (A+gms)/4, (B+gms)/4
    avg0, avg = (a + 2*b)/3., (A + 2*B)/3
    s = (b - avg0)/(avg * 4**4)
    return avg**-0.5 * (1 + s*s*(0.3 + s*(1/7. + s*
                                 (0.375 + s*(9/22. + s*(159/208. + s*9/8.))))))