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). 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/CANnG18_Mj3vkO62hj%2B2-oO%2BiV4mcx5vtzukRJSNYrU5evPgZOg%40mail.gmail.com.