Skip to content

Commit d3173af

Browse files
committed
Added is_isomorphic
Added `QuaternionAlgebra_ab.is_isomorphic()` to conveniently check whether two rational quaternion algebras are isomorphic
1 parent 439065e commit d3173af

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/sage/algebras/quatalg/quaternion_algebra.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,28 @@ def ramified_primes(self):
10741074
# TODO: more examples
10751075
return [f[0] for f in factor(self.discriminant())]
10761076

1077+
def is_isomorphic(self, A) -> bool:
1078+
r"""
1079+
Return ``True`` if ``self`` and ``A`` are isomorphic quaternion algebras over Q.
1080+
1081+
INPUT:
1082+
1083+
- ``A`` -- a quaternion algebra defined over the rationals Q
1084+
1085+
EXAMPLES::
1086+
1087+
sage: B = QuaternionAlgebra(-46, -87)
1088+
sage: A = QuaternionAlgebra(-58, -69)
1089+
sage: B.is_isomorphic(A)
1090+
True
1091+
sage: A == B
1092+
False
1093+
"""
1094+
if self.base_ring() != QQ or A.base_ring() != QQ:
1095+
raise NotImplementedError("isomorphism check only implemented for rational quaternion algebras")
1096+
1097+
return self.discriminant() == A.discriminant()
1098+
10771099
def _magma_init_(self, magma):
10781100
"""
10791101
Return Magma version of this quaternion algebra.

0 commit comments

Comments
 (0)