/* Based on Tabes solution... */ /* This function assumes F, G are homogeneous polynomials in x, y, z with the same type of coefficients There is no telling what will happen if you feed it something else The function returns 1 if there is a component in common and 0 else */ component_in_common(F, G) = { local(H); if(gcd(F, G) == 1, return(0), H = gcd(F, G); /* PARI returns gcd(2*x, 2*y) = 2 but the lines 2*x = 0 and 2*y = 0 do not have a component in common. Thus we have to check the gcd is a polynomial. I do not know a good way to do this besides checking for the degree in x, y, z to be > 0. */ if(poldegree(H, x) + poldegree(H, y) + poldegree(H, z), return(1), return(0) ) ) } /* This function assumes F, G are homogeneous polynomials in x, y, z with the same type of coefficients There is no telling what will happen if you feed it something else This function uses the check_hom function from exercise 16 The function returns 1 if F = 0 is contained in G = 0 and 0 else */ contained_in(F, G) = { local(a, b, c); a = check_hom(F); b = check_hom(G); c = check_hom(gcd(F, G)); if(a == -1 || b == -1 || c == -1, error("wrong inputs in contained_in")); if(c == a, return(1), return(0) ) }