-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Add test if quaternion order is maximal #37111
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ | |
from sage.misc.cachefunc import cached_method | ||
|
||
from sage.categories.algebras import Algebras | ||
from sage.categories.number_fields import NumberFields | ||
|
||
######################################################## | ||
# Constructor | ||
|
@@ -1758,9 +1759,48 @@ def discriminant(self): | |
|
||
return (MatrixSpace(QQ, 4, 4)(L)).determinant().sqrt() | ||
|
||
def is_maximal(self): | ||
r""" | ||
Return ``True`` if the order is maximal in the ambient quaternion algebra, ``False`` otherwise | ||
Only works in quaternion algebras over number fields | ||
|
||
OUTPUT: Boolean | ||
|
||
EXAMPLES:: | ||
|
||
sage: p = 11 | ||
sage: B = QuaternionAlgebra(QQ,-1,-p) | ||
sage: i,j,k = B.gens() | ||
sage: O0_basis = (1,i,(i+j)/2, (1+i*j)/2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix spacing (after each comma there should be a space except in some specific cases) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried, hopefully I did not miss any comma and never met such a specific case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main example is in one-element tuples, such as |
||
sage: O0 = B.quaternion_order(O0_basis) | ||
sage: O0.is_maximal() | ||
True | ||
sage: O1 = B.quaternion_order([1,i,j,i*j]) | ||
sage: O1.is_maximal() | ||
False | ||
|
||
TESTS:: | ||
|
||
sage: B = QuaternionAlgebra(GF(13),-1,-11) | ||
sage: i,j,k = B.gens() | ||
sage: O0_basis = (1,i,j, k) | ||
sage: O0 = B.quaternion_order(O0_basis) | ||
sage: try: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The recommended way to write doctests for error messages is
|
||
....: O0.is_maximal() | ||
....: print("This should fail") | ||
....: except NotImplementedError: | ||
....: print("ok") | ||
....: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without object now since the test was completely rewritten following @pjbruin's remarks. |
||
ok | ||
""" | ||
if not(self.quaternion_algebra().base_ring() in NumberFields()): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to use "X not in Y". Furthermore, we don't start error messages with capital letters and the dot at the end is not needed. - if not(self.quaternion_algebra().base_ring() in NumberFields()):
- raise NotImplementedError("Check for maximality is only implemented for quaternion algebras over number fields).")
- return(self.discriminant() == self.quaternion_algebra().discriminant())
+ if self.quaternion_algebra().base_ring() not in NumberFields():
+ raise NotImplementedError("check for maximality is only implemented for "
+ "quaternion algebras over number fields")
+ return self.discriminant() == self.quaternion_algebra().discriminant() |
||
raise NotImplementedError("Check for maximality is only implemented for quaternion algebras over number fields).") | ||
return(self.discriminant() == self.quaternion_algebra().discriminant()) | ||
|
||
def left_ideal(self, gens, check=True, *, is_basis=False): | ||
r""" | ||
Return the left ideal of this order generated by the given generators. | ||
Only works in quaternion algebras over number fields. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add an empty line after the first sentence of the docstring (see dcoudert's comment above). |
||
|
||
INPUT: | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first line should be short and usually we start such description with
Check whether...