quoexpoly(A,B,SQ):={ local da,db,va,vb,dq,vq,dva,dvb,dvq,Q,Ca,Cb; da:=degree(A); va:=valuation(A); dva:=da-va; db:=degree(B); vb:=valuation(B); dvb:=db-vb; if (A==0) then return 1,SQ;end_if; if ((da<db) or (va<vb)) then return 0;end_if; if ((dva==0) and (dvb>0)) then return 0;end_if; if ((dva>=0) and (dvb==0)) then return 1,normal(SQ+normal(A/B));end_if; Cb:=coeffs(B); if ((dva>0) and (dvb>0)) then dq:=da-db; vq:=va-vb; dvq:=dq-vq; if (dvq<0) then return 0;end_if; Ca:=coeffs(A); Q:=Ca[0]/Cb[0]*x^(dq); if (dvq==0) then A:=normal(A-B*Q); SQ:=normal(SQ+Q); else Q:=Q+Ca[dva]/Cb[dvb]*x^(vq); A:=normal(A-B*Q); SQ:=normal(SQ+Q); end_if; da:=degree(A); va:=valuation(A); end_if; return quoexpoly(A,B,SQ); }; estquopoly(A,B):=quoexpoly(A,B,0);On tape : A:=normal((x
^
4-x^
3+x^
2-1)*(x^
5-x^
3+x^
2-1)
^
4-x^
3+x^
2-1)
^
5-x^
3+x^
2-1