示例#1
0
def z_high(x):
    """Returns right-hand tail of z distribution (0 to x). 
    
    x ranges from -infinity to +infinity; result ranges from 0 to 1
    
    See Cephes docs for details."""
    y = x * SQRTH
    z = abs(y)
    if z < SQRTH:
        return 0.5 - 0.5 * erf(y)
    else:
        if x < 0:
            return 1 - 0.5 * erfc(z)
        else:
            return 0.5 * erfc(z)
示例#2
0
def z_low(x):
    """Returns left-hand tail of z distribution (0 to x). 
    
    x ranges from -infinity to +infinity; result ranges from 0 to 1
    
    See Cephes docs for details."""
    y = x * SQRTH
    z = abs(y) #distribution is symmetric
    if z < SQRTH:
        return 0.5 + 0.5 * erf(y)
    else:
        if y > 0:
            return 1 - 0.5 * erfc(z)
        else:
            return 0.5 * erfc(z)