From 16535d33c1c24c558f132982c411a73c13492eea Mon Sep 17 00:00:00 2001 From: Sebastian Spindler Date: Wed, 6 Mar 2024 17:30:37 +0100 Subject: [PATCH 1/3] Modified quaternion algebra documentation - Gave more details on the reference [Voi2021] - Modified some docstrings --- src/doc/en/reference/references/index.rst | 3 +- .../algebras/quatalg/quaternion_algebra.py | 32 ++++++++----------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/doc/en/reference/references/index.rst b/src/doc/en/reference/references/index.rst index 09b78514e1c..b0194d1eef7 100644 --- a/src/doc/en/reference/references/index.rst +++ b/src/doc/en/reference/references/index.rst @@ -6360,7 +6360,8 @@ REFERENCES: .. [Voi2012] \J. Voight. Identifying the matrix ring: algorithms for quaternion algebras and quadratic forms, to appear. -.. [Voi2021] \J. Voight. Quaternion algebras, Springer Nature (2021). +.. [Voi2021] \J. Voight. Quaternion Algebras. Graduate Texts in + Mathematics 288. Springer Cham, 2021. .. [VS06] \G.D. Villa Salvador. Topics in the Theory of Algebraic Function Fields. Birkh\"auser, 2006. diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index e85cf86846f..585312851d1 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -1809,13 +1809,12 @@ def discriminant(self): return (MatrixSpace(QQ, 4, 4)(L)).determinant().sqrt() - def is_maximal(self): + def is_maximal(self) -> bool: r""" Check whether the order of ``self`` is maximal in the ambient quaternion algebra. - Only works in quaternion algebras over number fields - - OUTPUT: Boolean + Only implemented for quaternion algebras over number fields; for reference, + see Theorem 15.5.5 in [Voi2021]_. EXAMPLES:: @@ -3277,14 +3276,12 @@ def cyclic_right_subideals(self, p, alpha=None): ans.append(J) return ans - def is_integral(self): + def is_integral(self) -> bool: r""" - Check if a quaternion fractional ideal is integral. An ideal in a quaternion algebra is - said integral if it is contained in its left order. If the left order is already defined it just - check the definition, otherwise it uses one of the alternative definition of Lemma 16.2.8 of - [Voi2021]_. - - OUTPUT: a boolean. + Check whether a quaternion fractional ideal is integral. An ideal in a quaternion algebra + is integral if and only if it is contained in its left order. If the left order is already + defined this method just checks this definition, otherwise it uses one of the alternative + definitions from Lemma 16.2.8 of [Voi2021]_. EXAMPLES:: @@ -3313,7 +3310,8 @@ def primitive_decomposition(self): Let `I` = ``self``. If `I` is an integral left `\mathcal{O}`-ideal return its decomposition as an equivalent primitive ideal and an integer such that their product is the initial ideal. - OUTPUTS: and quivalent primitive ideal to `I`, i.e. equivalent ideal not contained in `n\mathcal{O}` for any `n>0`, and the smallest integer such that `I \subset g\mathcal{O}`. + OUTPUTS: A primitive ideal equivalent to `I`, i.e. an equivalent ideal not contained + in `n\mathcal{O}` for any `n>0`, and the smallest integer `g` such that `I \subset g\mathcal{O}`. EXAMPLES:: @@ -3330,7 +3328,7 @@ def primitive_decomposition(self): TESTS: - Checks on random crafted ideals that they decompose as expected:: + Check that randomly generated ideals decompose as expected:: sage: for d in ( m for m in range(400, 750) if is_squarefree(m) ): ....: A = QuaternionAlgebra(d) @@ -3362,13 +3360,11 @@ def primitive_decomposition(self): return J, g - def is_primitive(self): + def is_primitive(self) -> bool: r""" Check if the quaternion fractional ideal is primitive. An integral left - $O$-ideal for some order $O$ is said primitive if for all integers $n > 1$ - $I$ is not contained in $nO$. - - OUTPUT: a boolean. + `\mathcal{O}`-ideal for some order `\mathcal{O}` is called primitive if + for all integers `n > 1` it is not contained in `n\mathcal{O}` EXAMPLES:: From 98abf2b4031fb02cc026cad24b8d2e399d057380 Mon Sep 17 00:00:00 2001 From: Sebastian Spindler Date: Thu, 7 Mar 2024 22:34:07 +0100 Subject: [PATCH 2/3] Implemented reviewer feedback Amend: Missed a period. --- .../algebras/quatalg/quaternion_algebra.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 585312851d1..c4ef097601a 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -3278,10 +3278,12 @@ def cyclic_right_subideals(self, p, alpha=None): def is_integral(self) -> bool: r""" - Check whether a quaternion fractional ideal is integral. An ideal in a quaternion algebra - is integral if and only if it is contained in its left order. If the left order is already - defined this method just checks this definition, otherwise it uses one of the alternative - definitions from Lemma 16.2.8 of [Voi2021]_. + Check whether the quaternion fractional ideal ``self`` is integral. + + An ideal in a quaternion algebra is integral if and only if it is + contained in its left order. If the left order is already defined + this method just checks this definition, otherwise it uses one + of the alternative definitions from Lemma 16.2.8 of [Voi2021]_. EXAMPLES:: @@ -3362,9 +3364,11 @@ def primitive_decomposition(self): def is_primitive(self) -> bool: r""" - Check if the quaternion fractional ideal is primitive. An integral left - `\mathcal{O}`-ideal for some order `\mathcal{O}` is called primitive if - for all integers `n > 1` it is not contained in `n\mathcal{O}` + Check whether the quaternion fractional ideal ``self`` is primitive. + + An integral left `\mathcal{O}`-ideal for some order `\mathcal{O}` + is called primitive if for all integers `n > 1` it is not + contained in `n\mathcal{O}`. EXAMPLES:: From e5bea05ce6ca55811bd06c5d97abcbf72fe83a63 Mon Sep 17 00:00:00 2001 From: Sebastian Spindler Date: Fri, 8 Mar 2024 20:17:27 +0100 Subject: [PATCH 3/3] Cleaned up `.random_element()`-doctest --- src/sage/algebras/quatalg/quaternion_algebra.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index c4ef097601a..5e42d9b1c11 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -2551,8 +2551,7 @@ def random_element(self, *args, **kwds): sage: B. = QuaternionAlgebra(211) sage: I = B.ideal([1, 1/4*j, 20*(i+k), 2/3*i]) - sage: x = I.random_element() # random - sage: x in I + sage: I.random_element() in I True """ return sum(ZZ.random_element(*args, **kwds) * g for g in self.gens())