/* $Id: gcd.rr,v 1.1 2001/01/21 07:33:49 taka Exp $ */ def in(F) { D = deg(F,x); C = coef(F,D,x); return( C*x^D); } def division(F,G) { Q = 0; R = F; while ((R != 0) && (deg(R,x) >= deg(G,x))) { D = red(in(R)/in(G)); Q = Q+D; R = R-D*G; } return([Q,R]); } def g_c_d(F,G) { if (deg(F,x) > deg(G,x)) { S = F; T = G; }else { S = G; T = F; } while (T != 0) { R = division(S,T)[1]; S = T; T = R; } return(S); } def variety1(F,G) { R = g_c_d(F,G); if (deg(R,x) == 0) { print("No solution.(variety is empty.)"); return([]); }else{ Ans = pari(roots,R); print("The number of solutions is ",0); print(size(Ans)[0]); print("The variety consists of : ",0); print(Ans); return(Ans); } } end$