load("topoly");

to_poly_solve(e,vars) := block([listconstantvars : false, x, v, ineq : [], eq, eqs : [], sol, acc : [],gg],
  vars : if listp(vars) then vars else [vars],
  e : if listp(e) then e else [e],
  x : vars,
  v : setify(listofvars(e)),

  for ei in e do (
    eq : to_poly(ei,x),
    eqs : append(first(eq), eqs),
    ineq : append(second(eq), ineq)),

  x : listify(union(setify(x), setdifference(setify(listofvars(eqs)),v))),
  sol : algsys(eqs, x),
  block([prederror : false],
   for si in sol do (
     if every('identity, map('is, subst(si,ineq))) then 
        acc : cons(map("=", vars, subst(si, vars)), acc)),
  acc));


  
  