def pval_lf(Dmax, n):
 if (n > 100):
  Dmax *= ((n / 100.0) ** 0.49)
  n = 100
 pval = np.exp((((((((-7.01256) * (Dmax ** 2)) * (n + 2.78019)) + ((2.99587 * Dmax) * np.sqrt((n + 2.78019)))) - 0.122119) + (0.974598 / np.sqrt(n))) + (1.67997 / n)))
 return pval

def pval_lf ( Dmax , n ) : if ( n > 100 ) : Dmax *= ( ( n / 100.0 ) ** 0.49 ) n = 100 pval = np . exp ( ( ( ( ( ( ( ( - 7.01256 ) * ( Dmax ** 2 ) ) * ( n + 2.78019 ) ) + ( ( 2.99587 * Dmax ) * np . sqrt ( ( n + 2.78019 ) ) ) ) - 0.122119 ) + ( 0.974598 / np . sqrt ( n ) ) ) + ( 1.67997 / n ) ) ) return pval
approximate pvalues for lilliefors test of normality this is only valid for pvalues smaller than 0 .