Now that we have the incomplete gamma function, gamma, and the complete gamma function, Gamma_Half, we can compute the CDF values. This value shows us the odds of a given value being random or having some possible correlation.
The function itself is quite small:
def cdf(x: Union[Fraction, float], k: int) -> Fraction: """X² cumulative distribution function. :param x: X² value, sum (obs[i]-exp[i])**2/exp[i] for parallel sequences of observed and expected values. :param k: degrees of freedom >= 1; often len(data)-1 """ return ( 1 - gamma(Fraction(k, 2), Fraction(x/2)) / Gamma_Half(Fraction(k, ...