Hi Andrew! On 10 Okt., 19:25, andrew ewart <[email protected]> wrote: > i tried to take this into consideration > giving the following code > > P.<x,y,z> = PolynomialRing(QQ,order='neglex') > I = Ideal(x^5 + y^4 +z^3, x^3 + y^2 + z^2 -1) > print I > gb=I.groebner_basis() > rgb=Ideal(gb).interreduced_basis() > bgr=Ideal(rgb) > ir=Ideal(f.Im() for f in bgr)
The first problem is ``f in bgr``: > TypeError: 'MPolynomialIdeal' object is not iterable ... and if something is not iterable, ``f in ...`` won't work. sage: type(bgr) <class 'sage.rings.polynomial.multi_polynomial_ideal.MPolynomialIdeal'> Asking ``f in bgr`` means to ask for a list of *all* elements of the ideal (infinitely many). But in fact, you seem to be interested only in the given list of generators of the ideal. By construction, the list of generators of bgr is rgb, and that's a list: sage: type(rgb) <type 'list'> The second problem is that you also have a typo. You wrote ``f.Im()``, which is ``capital i lowercase em``. You should write ``f.lm()``, which is ``lowercase ell lowercase em``, and is an abbreviation for ``Leading Monomial``. Both of the following would work: sage: ir1=Ideal(f.lm() for f in rgb) sage: ir2=Ideal(f.lm() for f in bgr.gens()) sage: ir1 Ideal (1) of Multivariate Polynomial Ring in x, y, z over Rational Field sage: ir2 Ideal (1) of Multivariate Polynomial Ring in x, y, z over Rational Field Cheers, Simon -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
