def eqs_to_matrix(eqs, ring):
 xs = ring.gens
 M = zeros(len(eqs), (len(xs) + 1), cls=RawMatrix)
 for (j, e_j) in enumerate(eqs):
  for (i, x_i) in enumerate(xs):
   M[(j, i)] = e_j.coeff(x_i)
  M[(j, (-1))] = (- e_j.coeff(1))
 return M

def eqs_to_matrix ( eqs , ring ) : xs = ring . gens M = zeros ( len ( eqs ) , ( len ( xs ) + 1 ) , cls = RawMatrix ) for ( j , e_j ) in enumerate ( eqs ) : for ( i , x_i ) in enumerate ( xs ) : M [ ( j , i ) ] = e_j . coeff ( x_i ) M [ ( j , ( - 1 ) ) ] = ( - e_j . coeff ( 1 ) ) return M
transform from equations to matrix form .