Euclidean domains¶
AUTHORS:
Teresa Gomez-Diaz (2008): initial version
Julian Rueth (2013-09-13): added euclidean degree, quotient remainder, and their tests
- class sage.categories.euclidean_domains.EuclideanDomains[source]¶
Bases:
Category_singletonThe category of constructive euclidean domains, i.e., one can divide producing a quotient and a remainder where the remainder is either zero or its
ElementMethods.euclidean_degree()is smaller than the divisor.EXAMPLES:
sage: EuclideanDomains() Category of euclidean domains sage: EuclideanDomains().super_categories() [Category of principal ideal domains]
- class ElementMethods[source]¶
Bases:
object- euclidean_degree()[source]¶
Return the degree of this element as an element of a Euclidean domain, i.e., for elements
, the euclidean degree satisfies the usual properties:if
is not zero, then there are elements and such that with orif
are not zero, then
Note
The name
euclidean_degreewas chosen because the euclidean function has different names in different contexts, e.g., absolute value for integers, degree for polynomials.OUTPUT:
For nonzero elements, a natural number. For the zero element, this might raise an exception or produce some other output, depending on the implementation.
EXAMPLES:
sage: R.<x> = QQ[] sage: x.euclidean_degree() 1 sage: ZZ.one().euclidean_degree() 1
- class ParentMethods[source]¶
Bases:
object- gcd_free_basis(elts)[source]¶
Compute a set of coprime elements that can be used to express the elements of
elts.INPUT:
elts– a sequence of elements ofself
OUTPUT:
A GCD-free basis (also called a coprime base) of
elts; that is, a set of pairwise relatively prime elements ofselfsuch that any element ofeltscan be written as a product of elements of the set.ALGORITHM:
Naive implementation of the algorithm described in Section 4.8 of Bach & Shallit [BS1996].
EXAMPLES:
sage: ZZ.gcd_free_basis([1]) [] sage: ZZ.gcd_free_basis([4, 30, 14, 49]) [2, 15, 7] sage: Pol.<x> = QQ[] sage: sorted(Pol.gcd_free_basis([ ....: (x+1)^3*(x+2)^3*(x+3), (x+1)*(x+2)*(x+3), ....: (x+1)*(x+2)*(x+4)])) [x + 3, x + 4, x^2 + 3*x + 2]