Skip to content

Commit

Permalink
Added is_isomorphic
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
  • Loading branch information
S17A05 committed Jan 19, 2024
1 parent 439065e commit d3173af
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 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,28 @@ 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 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 d3173af

Please sign in to comment.