Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added .is_isomorphic for rational quaternion algebras #37107

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
# 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")

Check warning on line 1095 in src/sage/algebras/quatalg/quaternion_algebra.py

View check run for this annotation

Codecov / codecov/patch

src/sage/algebras/quatalg/quaternion_algebra.py#L1095

Added line #L1095 was not covered by tests

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

Check warning on line 1098 in src/sage/algebras/quatalg/quaternion_algebra.py

View check run for this annotation

Codecov / codecov/patch

src/sage/algebras/quatalg/quaternion_algebra.py#L1098

Added line #L1098 was not covered by tests

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

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