ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 13 Nov 2018 12:29:21 -0600Gaussians as Euclidean Domainhttp://ask.sagemath.org/question/44271/gaussians-as-euclidean-domain/Follow up to [a comment](https://ask.sagemath.org/question/44251/making-a-quotient-with-gaussian-elements/?comment=44265#post-id-44265) by @nbruin in a previous question:
> One reason that Euclidean division isn't available by default on ZI is because as far as sage is concerned, it's a quadratic ring, and those generally are not euclidean rings. There are some quadratic rings that are, but most of them are only euclidean with rather obscure euclidean norms. The fact that Z[i] is euclidean with the "standard" norm is really quite anomalous among quadratic rings.
> If you're interested in studying euclidean rings you probably should write some utility functions yourself to help you with it (or search if such utilities are already available). You could even consider writing a new ring subclass for Euclidean rings. To illustrate that sage doesn't know that ZI is a euclidean domain:
sage: ZI in EuclideanDomains()
False
context: `ZI = QuadraticField(-1, 'I').ring_of_integers()`
My question is: Is there a built in way in SageMath to work with Gaussian integers as an Euclidean domain?Tue, 13 Nov 2018 10:48:43 -0600http://ask.sagemath.org/question/44271/gaussians-as-euclidean-domain/Answer by tmonteil for <p>Follow up to <a href="https://ask.sagemath.org/question/44251/making-a-quotient-with-gaussian-elements/?comment=44265#post-id-44265">a comment</a> by <a href="/users/62/nbruin/">@nbruin</a> in a previous question:</p>
<blockquote>
<p>One reason that Euclidean division isn't available by default on ZI is because as far as sage is concerned, it's a quadratic ring, and those generally are not euclidean rings. There are some quadratic rings that are, but most of them are only euclidean with rather obscure euclidean norms. The fact that Z[i] is euclidean with the "standard" norm is really quite anomalous among quadratic rings.</p>
<p>If you're interested in studying euclidean rings you probably should write some utility functions yourself to help you with it (or search if such utilities are already available). You could even consider writing a new ring subclass for Euclidean rings. To illustrate that sage doesn't know that ZI is a euclidean domain:</p>
</blockquote>
<pre><code>sage: ZI in EuclideanDomains()
False
</code></pre>
<p>context: <code>ZI = QuadraticField(-1, 'I').ring_of_integers()</code></p>
<p>My question is: Is there a built in way in SageMath to work with Gaussian integers as an Euclidean domain?</p>
http://ask.sagemath.org/question/44271/gaussians-as-euclidean-domain/?answer=44272#post-id-44272This is an ongoing process, see [trac ticket 23971](https://trac.sagemath.org/ticket/23971).
If you are used with Sage development, you can try to apply the changes on your version of Sage and recompile. Otherwise, you can define your own class that inherits from Sage's one and overwrite the `_floordiv_` method.Tue, 13 Nov 2018 12:29:21 -0600http://ask.sagemath.org/question/44271/gaussians-as-euclidean-domain/?answer=44272#post-id-44272