ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 21 Feb 2022 23:05:08 +0100Factoring an integer inside a ring of integers different from $\mathbb{Z}$https://ask.sagemath.org/question/61241/factoring-an-integer-inside-a-ring-of-integers-different-from-mathbbz/ I am trying to find divisors of an element in the ring of integers of a Cyclotomic Field. My code is
K=CyclotomicField(23)
L=K.ring_of_integers()
L.factor(2)
It gives an error:
'AbsoluteOrder_with_category' object has no attribute 'factor'
I guess the problem is L is defined as an "order" here instead of a ring. But I need that to be a ring. How can I fix this problem?Sun, 20 Feb 2022 17:53:24 +0100https://ask.sagemath.org/question/61241/factoring-an-integer-inside-a-ring-of-integers-different-from-mathbbz/Comment by slelievre for <p>I am trying to find divisors of an element in the ring of integers of a Cyclotomic Field. My code is</p>
<pre><code>K=CyclotomicField(23)
L=K.ring_of_integers()
L.factor(2)
</code></pre>
<p>It gives an error:</p>
<pre><code>'AbsoluteOrder_with_category' object has no attribute 'factor'
</code></pre>
<p>I guess the problem is L is defined as an "order" here instead of a ring. But I need that to be a ring. How can I fix this problem?</p>
https://ask.sagemath.org/question/61241/factoring-an-integer-inside-a-ring-of-integers-different-from-mathbbz/?comment=61247#post-id-61247Welcome to Ask Sage! Thank you for your question!Mon, 21 Feb 2022 22:48:12 +0100https://ask.sagemath.org/question/61241/factoring-an-integer-inside-a-ring-of-integers-different-from-mathbbz/?comment=61247#post-id-61247Answer by slelievre for <p>I am trying to find divisors of an element in the ring of integers of a Cyclotomic Field. My code is</p>
<pre><code>K=CyclotomicField(23)
L=K.ring_of_integers()
L.factor(2)
</code></pre>
<p>It gives an error:</p>
<pre><code>'AbsoluteOrder_with_category' object has no attribute 'factor'
</code></pre>
<p>I guess the problem is L is defined as an "order" here instead of a ring. But I need that to be a ring. How can I fix this problem?</p>
https://ask.sagemath.org/question/61241/factoring-an-integer-inside-a-ring-of-integers-different-from-mathbbz/?answer=61248#post-id-61248The ring of integers of the 23rd cyclotomic field is famously
not a unique factorisation domain.
Once you have defined the cyclotomic field and its ring of integers,
sage: K = CyclotomicField(23)
sage: L = K.ring_of_integers()
the ring of integers does not have a `factor` method, as you noticed.
Its elements however do have such a method,
but trying to factor `L(2)` hangs:
sage: L(2).factor()
and you have to interrupt it with `Ctrl` `C`.
One thing you can do is factor the ideal generated by 2.
sage: two = L.ideal(2)
sage: two.factor()
(Fractional ideal (2, zeta23^11 + zeta23^9 + zeta23^7 + zeta23^6 + zeta23^5 + zeta23 + 1)) * (Fractional ideal (2, zeta23^11 + zeta23^10 + zeta23^6 + zeta23^5 + zeta23^4 + zeta23^2 + 1))Mon, 21 Feb 2022 23:05:08 +0100https://ask.sagemath.org/question/61241/factoring-an-integer-inside-a-ring-of-integers-different-from-mathbbz/?answer=61248#post-id-61248