/* * coeflist(P,T,N) outputs the list of coefficients of terms in polynomial P * with T-degree greater than N. */ def coeflist(P,T,N) { L=[]; D=deg(P,T); while(D!=N-1){ C=coef(P,D,T); if(C!=0) L=cons(C,L); D=D-1; } return(reverse(L)); } /* * eliminate_list(PL,VL) outputs the list of new polynomials eliminated * variables VL from the polynomial system PL. */ def eliminate_list(PL,VL){ T=find_linear(PL,VL); CP=T[0]; PL=T[1]; CP=subst_tmp(CP,VL); return list_subst_list(PL,CP); } /* * eliminate(PL,V) outputs the list of new polynomials eliminated V * from the polynomial system PL. */ def eliminate(PL,V){ N=coef_1(PL,V); if(N==length(PL)) return(-1);/* fail */ P=PL[N]; PL=omit_n(PL,N); return list_ptozp(list_subst_list(PL,[[V,-(P-1*coef(P,1,V)*V)/coef(P,1,V)]])); } /* Find linear polynomials for variables VL */ def find_linear(PL,VL){ Ex=[]; while(VL!=[]){ V=car(VL); for(I=0;I