Skip to content

Commit

Permalink
sagemathgh-37107: Added is_isomorphic() for rational quaternion algebras
Browse files Browse the repository at this point in the history
Added `QuaternionAlgebra_ab.is_isomorphic()` to conveniently check
whether two rational quaternion algebras are isomorphic.

TODO (future work):
- [] Extend isomorphism check to quaternion algebras over number fields.

#sd123

URL: sagemath#37107
Reported by: Sebastian Spindler
Reviewer(s): Peter Bruin
  • Loading branch information
Release Manager committed Jan 21, 2024
2 parents 507c389 + e3e69c2 commit 919b021
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=1041fee1d3ed5dc9c6c428668a895fb7109a48e5
md5=e254e55345074cd0959cb21c8e4716ca
cksum=1271538328
sha1=16fe5aaba9a760dd8a2e66736a117cea46ee6e91
md5=375511ae93e27dce742292d0c7557d75
cksum=2150430088
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c6bf497a0fd0f29c721481b52afaf49969c0cef8
ab5b59acc27408b89ef07ab0e6c654364fceafe6
25 changes: 25 additions & 0 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,31 @@ def ramified_primes(self):
# TODO: more examples
return [f[0] for f in factor(self.discriminant())]

def is_isomorphic(self, A) -> bool:
r"""
Return ``True`` if ``self`` and ``A`` are isomorphic quaternion algebras over Q.
INPUT:
- ``A`` -- a quaternion algebra defined over the rationals Q
EXAMPLES::
sage: B = QuaternionAlgebra(-46, -87)
sage: A = QuaternionAlgebra(-58, -69)
sage: B.is_isomorphic(A)
True
sage: A == B
False
"""
if not isinstance(A, QuaternionAlgebra_ab):
raise TypeError("A must be a quaternion algebra of the form (a,b)_K")

if self.base_ring() != QQ or A.base_ring() != QQ:
raise NotImplementedError("isomorphism check only implemented for rational quaternion algebras")

return self.discriminant() == A.discriminant()

def _magma_init_(self, magma):
"""
Return Magma version of this quaternion algebra.
Expand Down

0 comments on commit 919b021

Please sign in to comment.