@@ -1031,7 +1031,8 @@ def inner_product_matrix(self):
1031
1031
@cached_method
1032
1032
def discriminant (self ):
1033
1033
"""
1034
- Return the discriminant of this quaternion algebra, i.e. the product of the ramified primes in it.
1034
+ Return the discriminant of this quaternion algebra, i.e. the product of the finite
1035
+ primes it ramifies at.
1035
1036
1036
1037
EXAMPLES::
1037
1038
@@ -1058,46 +1059,34 @@ def discriminant(self):
1058
1059
else :
1059
1060
return prod (self .ramified_primes ())
1060
1061
1061
- def ramified_primes (self , sorted = False ):
1062
+ @cached_method
1063
+ def ramified_primes (self ):
1062
1064
"""
1063
1065
Return the (finite) primes that ramify in this rational quaternion algebra.
1064
1066
1065
- INPUT:
1066
-
1067
- - ``sorted`` -- (default: ``False``)
1068
-
1069
1067
OUTPUT:
1070
1068
1071
1069
The list of prime numbers at which ``self`` ramifies (given as integers), sorted by their
1072
- magnitude (small to large) if ``sorted`` is set to ``True`` .
1070
+ magnitude (small to large).
1073
1071
1074
1072
EXAMPLES::
1075
1073
1076
1074
sage: QuaternionAlgebra(QQ, -1, -1).ramified_primes()
1077
1075
[2]
1078
1076
1079
1077
sage: QuaternionAlgebra(QQ, -58, -69).ramified_primes()
1080
- [3, 29, 23]
1081
-
1082
- sage: QuaternionAlgebra(QQ, -58, -69).ramified_primes(sorted=True)
1083
1078
[3, 23, 29]
1084
1079
"""
1085
1080
if not is_RationalField (self .base_ring ()):
1086
1081
raise ValueError ("base field must be the rational numbers" )
1087
1082
1088
- if not sorted :
1089
- return [p for p in set ([2 ]).union (prime_divisors (self ._a .numerator ()),
1090
- prime_divisors (self ._a .denominator ()), prime_divisors (self ._b .numerator ()),
1091
- prime_divisors (self ._b .denominator ())) if hilbert_symbol (self ._a , self ._b , p ) == - 1 ]
1092
-
1093
- else :
1094
- return sorted ([p for p in set ([2 ]).union (prime_divisors (self ._a .numerator ()),
1083
+ return sorted ([p for p in set ([2 ]).union (prime_divisors (self ._a .numerator ()),
1095
1084
prime_divisors (self ._a .denominator ()), prime_divisors (self ._b .numerator ()),
1096
1085
prime_divisors (self ._b .denominator ())) if hilbert_symbol (self ._a , self ._b , p ) == - 1 ])
1097
1086
1098
1087
def is_isomorphic (self , A ) -> bool :
1099
1088
"""
1100
- Return ``True`` if ``self`` and ``A`` are isomorphic quaternion algebras over Q.
1089
+ Return ``True`` if (and only if) ``self`` and ``A`` are isomorphic quaternion algebras over Q.
1101
1090
1102
1091
INPUT:
1103
1092
@@ -1118,7 +1107,7 @@ def is_isomorphic(self, A) -> bool:
1118
1107
if self .base_ring () != QQ or A .base_ring () != QQ :
1119
1108
raise NotImplementedError ("isomorphism check only implemented for rational quaternion algebras" )
1120
1109
1121
- return set ( self .ramified_primes ()) == set ( A .ramified_primes () )
1110
+ return self .ramified_primes () == A .ramified_primes ()
1122
1111
1123
1112
def _magma_init_ (self , magma ):
1124
1113
"""
0 commit comments