On Sep 8, 2:57 am, Cary Cherng <cche...@gmail.com> wrote: > I am not familiar with algebraic geometry or its terminology and new > to sage. > > p_1,...p_n and q are elements of Z[x_1,...,x_n]. In my context I have > some evidence that q can be written as something like q = p_1*p_2 > + ... + p_5*p_6. In other words q is a degree 2 polynomial in the > p_i's. Can Sage find out if q can be written in terms of the p_i's?
Is this the question you are asking? Let p_1,...,p_r and q be elements of Z[x_1,...,x_n]. How does one (use Sage to) determine if q is in the subring generated by the p's (and to represent q in terms of the p's, if this is possible)? One can solve instances of this kind of problem with Groebner-basis calculations. For any cases that are not tiny, however, these calculations may not be feasible. (One could then try the linear- algebra techniques already discussed.) I am not certain if Sage (via Singular) is currently equipped to handle cases with Z coefficients, but here is how things would look, if one were using Q coefficients: I will show the case where n = r = 2 with p_1 = x_1*x_2, p_2 = x_1+x_2, and q = x_1^2 + x_2^2. sage: R.<x1, x2, p1, p2> = PolynomialRing(QQ, 4, order = 'lex') sage: q = x1^2 + x2^2 sage: I = R.ideal(p1 - x1*x2, p2 - (x1 + x2)) sage: q.reduce(I) -2*p1 + p2^2 It is important to note that when one sets up the polynomial ring, the variables to be eliminated (x1 and x2) come before the variables representing the p's (p1 and p2). In order to get the Groebner-basis algorithm to solve the problem, one must order the variables this way and include the "order = 'lex'" bit in the definition of the polynomial ring. When one uses these orders, one finds that if q were not in the subring generated by the p's, the output after "q.reduce(I)" would still have some x's in it. Regards, James Parson -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org