I agree that this is a bug; are you able to open a ticket? The problem is that ideals in Z[x] use the generic ideal code, which defines equality based on just comparing ordered lists of generators. I think the right thing to do is to change that definition to the normal definition of equality of ideals, which we can implement by just checking that each generator is contained in the other ideal. We'll also need to improve ideals in ZZ['x'] a bit, since non-principal ideals don't implement containment checking:
sage: R.<x> = ZZ[] sage: I = R.ideal([x^2+1,x^2+x+1]) sage: J = R.unit_ideal() sage: I == J False sage: type(I) <class 'sage.rings.ideal.Ideal_generic'> sage: type(J) <class 'sage.rings.ideal.Ideal_principal'> sage: all(g in J for g in I.gens()) True sage: all(g in I for g in J.gens()) Traceback (most recent call last): ... NotImplementedError David On Sat, Mar 9, 2019 at 3:54 AM Xiaofeng bei <shuori2...@gmail.com> wrote: > I calculate whether the ideals in ZZ[x] are coprime. I find a bug in > function "is_trival()" from 'SageMath version 8.5, Release Date: 2018-12-22' > > Following, I will show you a example: > > sage: R > Univariate Polynomial Ring in x over Integer Ring > sage: m1 > x^2 + 1 > sage: m2 > x^2 + x + 1 > sage: (1+x)*m1+(-x)*m2 > 1 > sage: I=R.ideal([m1,m2]) > sage: I.is_trivial() > False > sage: version() > 'SageMath version 8.5, Release Date: 2018-12-22' > > > In above example, the "I.is_trival()" should return the "True" instedad > of "False" > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.