def l2_gram_schmidt(list, lim):
 r = []
 for a in list:
  if (r == []):
   v = a
  else:
   v = (a - l2_projection(a, r, lim))
  v_norm = l2_norm(v, lim)
  if (v_norm == 0):
   raise ValueError('The sequence is not linearly independent.')
  r.append((v / v_norm))
 return r

def l2_gram_schmidt ( list , lim ) : r = [ ] for a in list : if ( r == [ ] ) : v = a else : v = ( a - l2_projection ( a , r , lim ) ) v_norm = l2_norm ( v , lim ) if ( v_norm == 0 ) : raise ValueError ( 'The sequence is not linearly independent.' ) r . append ( ( v / v_norm ) ) return r
orthonormalizes the "list" of functions using the gram-schmidt process .