def is_orthonormal_cont(polys, lower, upper, rtol=0, atol=1e-08):
 for i in range(len(polys)):
  for j in range((i + 1)):
   p1 = polys[i]
   p2 = polys[j]
   innerprod = integrate.quad((lambda x: (p1(x) * p2(x))), lower, upper)[0]
   if (not np.allclose(innerprod, (i == j), rtol=rtol, atol=atol)):
    return False
 return True

def is_orthonormal_cont ( polys , lower , upper , rtol = 0 , atol = 1e-08 ) : for i in range ( len ( polys ) ) : for j in range ( ( i + 1 ) ) : p1 = polys [ i ] p2 = polys [ j ] innerprod = integrate . quad ( ( lambda x : ( p1 ( x ) * p2 ( x ) ) ) , lower , upper ) [ 0 ] if ( not np . allclose ( innerprod , ( i == j ) , rtol = rtol , atol = atol ) ) : return False return True
check whether functions are orthonormal parameters polys : list of polynomials or function returns is_orthonormal : bool is false if the innerproducts are not close to 0 or 1 notes this stops as soon as the first deviation from orthonormality is found .