DivAlg := proc(f,F::list,LT::procedure)
local p,r,s,a,divoccurred,i,g,q;
(p,r) := (f,0);
s := nops(F);
a := Array(1..s); # Arrays are automatically initialized to 0
while p <> 0 do
divoccurred := false;
for i from 1 to s while not divoccurred do
if divide(LT(p),LT(F[i])) then # if LT(F[i]) | LT(p) then
q := LT(p)/LT(F[i]);
p := expand( p - q*F[i] );
a[i] := a[i]+q;
divoccurred := true;
fi;
end do;
if not divoccurred then r := r+LT(p); p := p-LT(p); fi;
end do;
a,r;
end:f := x^3*y^2+x^3*y^2-y+1;
F := [x*y^2-x,x-y^2];X := x,y;
LTlex := proc(f) local c,m; c := lcoeff(f,order=plex(X),'m'); c*m; end:
LTlex(f);a,r := DivAlg( f, F, LTlex );expand( f-a[1]*F[1]-a[2]*F[2]-r );Groebner[NormalForm](f,F,plex(X));LTgrlex := proc(f) local c,m; c := lcoeff(f,order=grlex(X),'m'); c*m; end:DivAlg( f, F, LTgrlex );Groebner[NormalForm](f,F,grlex(X));TTdSMApJNVJUQUJMRV9TQVZFLzM1NjA0NTIwWColKWFueXRoaW5nRzYiRiVbZ2whISUhISEiIyIjLCgqJCUieEciIiNGKUYoRilGKSIiIkYmRiU=TTdSMApJNVJUQUJMRV9TQVZFLzM1NjAzNTY4WColKWFueXRoaW5nRzYiRiVbZ2whISUhISEiIyIjLCQqJCUieEciIiNGKSIiIUYl