def chi2p(x2, df=1, tail=UPPER):
 return gammai((df * 0.5), (x2 * 0.5), tail)

def chi2p ( x2 , df = 1 , tail = UPPER ) : return gammai ( ( df * 0.5 ) , ( x2 * 0.5 ) , tail )
returns p-value for given x2 and degrees of freedom .