On Saturday, 28 October 2023 at 10:22:15 UTC-7 G. M.-S. wrote:
Thanks, Nils. My question was motivated by using SageMath in my teachings. Do you think it would be difficult/worthwhile taking care of this? I mean, ideals in euclidean rings (or at least in ZZ). Mathematically or algorithmically not difficult of course. I'd expect that to make it play nice with the category framework you'll need to do a lot of work. By the looks of ZZ.categories(), there is a category of "euclidean domains". The parent of ideals in ZZ, however, looks rather generic. I don't think the euclidean properties are propagated to the monoid of ideals at all at the moment. The "appropriate" level of generality would be there. However, there's not much to be gained from ideals in euclidean domains: we already have lcm and gcd! So I suspect that's why it's not implemented at the moment. I can see how having such ideals may seem instructive for teaching. I think that's a matter of philosophy / opinion. I happen to not believe that teaching students formalisms in computer algebra packages without real benefit/content (beyond lcm and gcd that they'll learn anyway) helps them much, so I wouldn't think it's worthwhile. Perhaps for having facilities for ideals universally available, it could be useful if ideals in ZZ have "intersection" implemented, but I have trouble seeing where that would come up. There are rings with ZZ as a subring for which intersection works on ideals proper, since we have groebner bases over ZZ, apparently: sage: R.<x,y>=ZZ['x','y'] sage: I=R.ideal(15) sage: J=R.ideal(35) sage: I.intersection(J) So you could use that ... or if you manage to define a multivariate polynomial ring over ZZ in 0 variables, you'd be good to go too. Free ZZ-modules of rank 1 would also get you the right behaviour. Guillermo On Sat, 28 Oct 2023 at 18:44, Nils Bruin <nbr...@sfu.ca> wrote: I'm sure its omission is just an oversight. For fractional ideals in number fields it is defined: sage: K.<r>=QuadraticField(7) sage: I=K.fractional_ideal(5) sage: J=K.fractional_ideal(3) sage: I.intersection(J) Fractional ideal (15) I doubt that just knowing a ring is a PID makes computing intersections of ideals easy. So the omission may be because there doesn't seem to be ZZ-specific (or euclidean ring-specific) ideal code. And with lcm around, the need for it has been low, I expect. On Saturday, 28 October 2023 at 02:36:51 UTC-7 G. M.-S. wrote: I wonder why SageMath cannot compute the intersection of 2 ideals in ZZ. Is this due to the fact that ZZ would "only" be a PID? Guillermo ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 10.1, Release Date: 2023-08-20 │ │ Using Python 3.11.1. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: n1,n2=720,756 sage: d,m=gcd(n1,n2),lcm(n1,n2) sage: n1,n2,d,m (720, 756, 36, 15120) sage: I1,I2=ZZ.ideal(n1),ZZ.ideal(n2) sage: I1,I2 (Principal ideal (720) of Integer Ring, Principal ideal (756) of Integer Ring) sage: I1+I2 Principal ideal (36) of Integer Ring sage: I1.intersection(I2) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In [7], line 1 ----> 1 I1.intersection(I2) File /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:488, in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4846)() * 486* AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah' * 487* """ --> 488 return self.getattr_from_category(name) * 489* * 490* cdef getattr_from_category(self, name): File /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:501, in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4958)() * 499* else: * 500* cls = P._abstract_element_class --> 501 return getattr_from_other_class(self, cls, name) * 502* * 503* def __dir__(self): File /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/cpython/getattr.pyx:362, in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2773)() * 360* dummy_error_message.cls = type(self) * 361* dummy_error_message.name = name --> 362 raise AttributeError(dummy_error_message) * 363* attribute = <object>attr * 364* # Check for a descriptor (__get__ in Python) AttributeError: 'Ideal_pid' object has no attribute 'intersection' sage: -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/14167921-8b40-4572-8d20-379b76463a7fn%40googlegroups.com.