def _LC(f):
 ring = f.ring
 k = ring.ngens
 yring = ring.clone(symbols=ring.symbols[(k - 1)])
 y = yring.gens[0]
 degf = _deg(f)
 lcf = yring.zero
 for (monom, coeff) in f.iterterms():
  if (monom[:(-1)] == degf):
   lcf += (coeff * (y ** monom[(-1)]))
 return lcf

def _LC ( f ) : ring = f . ring k = ring . ngens yring = ring . clone ( symbols = ring . symbols [ ( k - 1 ) ] ) y = yring . gens [ 0 ] degf = _deg ( f ) lcf = yring . zero for ( monom , coeff ) in f . iterterms ( ) : if ( monom [ : ( - 1 ) ] == degf ) : lcf += ( coeff * ( y ** monom [ ( - 1 ) ] ) ) return lcf
compute the leading coefficient of a multivariate polynomial f in k[x_0 .