Skip to content

Commit

Permalink
Fix doctests for 'make pari_bnf() deterministic'
Browse files Browse the repository at this point in the history
  • Loading branch information
tornaria committed Dec 24, 2024
1 parent bcb9c3d commit a5c65e1
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ def conjugate(self, M, adjugate=False, new_ideal=None):
sage: # needs sage.rings.number_field
sage: ideal = A.ideal(5).factor()[1][0]; ideal
Fractional ideal (-a + 2)
Fractional ideal (-2*a - 1)
sage: g = f.conjugate(conj, new_ideal=ideal)
sage: g.domain().ideal()
Fractional ideal (-a + 2)
Fractional ideal (-2*a - 1)
"""
if self.domain().is_padic_base():
return DynamicalSystem_Berkovich(self._system.conjugate(M, adjugate=adjugate))
Expand Down
12 changes: 6 additions & 6 deletions src/sage/rings/finite_rings/residue_field.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ class ResidueField_generic(Field):
sage: # needs sage.rings.number_field
sage: I = QQ[i].factor(2)[0][0]; I
Fractional ideal (-I - 1)
Fractional ideal (I - 1)
sage: k = I.residue_field(); k
Residue field of Fractional ideal (-I - 1)
Residue field of Fractional ideal (I - 1)
sage: type(k)
<class 'sage.rings.finite_rings.residue_field.ResidueFiniteField_prime_modn_with_category'>
Expand Down Expand Up @@ -1007,7 +1007,7 @@ cdef class ReductionMap(Map):
sage: cr
Partially defined reduction map:
From: Number Field in a with defining polynomial x^2 + 1
To: Residue field of Fractional ideal (-a + 1)
To: Residue field of Fractional ideal (a - 1)
sage: cr == r # not implemented
True
sage: r(2 + a) == cr(2 + a)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ cdef class ReductionMap(Map):
sage: cr
Partially defined reduction map:
From: Number Field in a with defining polynomial x^2 + 1
To: Residue field of Fractional ideal (-a + 1)
To: Residue field of Fractional ideal (a - 1)
sage: cr == r # not implemented
True
sage: r(2 + a) == cr(2 + a)
Expand Down Expand Up @@ -1070,7 +1070,7 @@ cdef class ReductionMap(Map):
sage: r = F.reduction_map(); r
Partially defined reduction map:
From: Number Field in a with defining polynomial x^2 + 1
To: Residue field of Fractional ideal (-a + 1)
To: Residue field of Fractional ideal (a - 1)
We test that calling the function also works after copying::
Expand All @@ -1082,7 +1082,7 @@ cdef class ReductionMap(Map):
Traceback (most recent call last):
...
ZeroDivisionError: Cannot reduce field element 1/2*a
modulo Fractional ideal (-a + 1): it has negative valuation
modulo Fractional ideal (a - 1): it has negative valuation
sage: # needs sage.rings.finite_rings
sage: R.<t> = GF(2)[]; h = t^5 + t^2 + 1
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/integer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5585,7 +5585,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
sage: 5.is_norm(K)
False
sage: n.is_norm(K, element=True)
(True, 4*beta + 6)
(True, -4*beta + 6)
sage: n.is_norm(K, element=True)[1].norm()
4
sage: n = 5
Expand Down
36 changes: 18 additions & 18 deletions src/sage/rings/number_field/S_unit_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ def defining_polynomial_for_Kp(prime, prec=106):
sage: from sage.rings.number_field.S_unit_solver import defining_polynomial_for_Kp
sage: K.<a> = QuadraticField(2)
sage: p2 = K.prime_above(7); p2
Fractional ideal (-2*a + 1)
Fractional ideal (2*a - 1)
sage: defining_polynomial_for_Kp(p2, 10)
x + 266983762
Expand Down Expand Up @@ -2170,23 +2170,23 @@ def construct_complement_dictionaries(split_primes_list, SUK, verbose=False):
sage: SUK = K.S_unit_group(S=K.primes_above(H))
sage: split_primes_list = [3, 7]
sage: actual = construct_complement_dictionaries(split_primes_list, SUK)
sage: expected = {3: {(1, 1, 0): [(1, 0, 0), (1, 1, 0)],
....: (1, 0, 0): [(1, 0, 0), (1, 1, 0)]},
....: 7: {(1, 1, 0): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
....: (1, 3, 2): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
....: (1, 5, 4): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
....: (1, 0, 4): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
....: (1, 2, 0): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
....: (1, 4, 2): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
....: (1, 1, 2): [(1, 1, 2), (1, 3, 4), (1, 5, 0)],
....: (1, 3, 4): [(1, 1, 2), (1, 3, 4), (1, 5, 0)],
....: (1, 5, 0): [(1, 1, 2), (1, 3, 4), (1, 5, 0)],
....: (1, 0, 2): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
....: (1, 2, 4): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
....: (1, 4, 0): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
....: (1, 0, 0): [(1, 5, 4), (1, 3, 2), (1, 1, 0)],
....: (1, 2, 2): [(1, 5, 4), (1, 3, 2), (1, 1, 0)],
....: (1, 4, 4): [(1, 5, 4), (1, 3, 2), (1, 1, 0)]}}
sage: expected = {3: {(0, 1, 0): [(0, 1, 0), (1, 0, 0)],
....: (1, 0, 0): [(0, 1, 0), (1, 0, 0)]},
....: 7: {(0, 1, 0): [(1, 0, 0), (1, 2, 2), (1, 4, 4)],
....: (0, 1, 2): [(0, 1, 2), (0, 3, 4), (0, 5, 0)],
....: (0, 3, 2): [(1, 0, 0), (1, 2, 2), (1, 4, 4)],
....: (0, 3, 4): [(0, 1, 2), (0, 3, 4), (0, 5, 0)],
....: (0, 5, 0): [(0, 1, 2), (0, 3, 4), (0, 5, 0)],
....: (0, 5, 4): [(1, 0, 0), (1, 2, 2), (1, 4, 4)],
....: (1, 0, 0): [(0, 1, 0), (0, 3, 2), (0, 5, 4)],
....: (1, 0, 2): [(1, 0, 4), (1, 2, 0), (1, 4, 2)],
....: (1, 0, 4): [(1, 0, 2), (1, 2, 4), (1, 4, 0)],
....: (1, 2, 0): [(1, 0, 2), (1, 2, 4), (1, 4, 0)],
....: (1, 2, 2): [(0, 1, 0), (0, 3, 2), (0, 5, 4)],
....: (1, 2, 4): [(1, 0, 4), (1, 2, 0), (1, 4, 2)],
....: (1, 4, 0): [(1, 0, 4), (1, 2, 0), (1, 4, 2)],
....: (1, 4, 2): [(1, 0, 2), (1, 2, 4), (1, 4, 0)],
....: (1, 4, 4): [(0, 1, 0), (0, 3, 2), (0, 5, 4)]}}
sage: all(set(actual[p][vec]) == set(expected[p][vec])
....: for p in [3, 7] for vec in expected[p])
True
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/number_field/class_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ def gens_ideals(self):
Class group of order 68 with structure C34 x C2 of Number Field
in a with defining polynomial x^2 + x + 23899
sage: C.gens()
(Fractional ideal class (7, a + 5), Fractional ideal class (5, a + 3))
(Fractional ideal class (83, a + 21), Fractional ideal class (15, a + 8))
sage: C.gens_ideals()
(Fractional ideal (7, a + 5), Fractional ideal (5, a + 3))
(Fractional ideal (83, a + 21), Fractional ideal (15, a + 8))
"""
return self.gens_values()

Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/number_field/number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -7136,7 +7136,7 @@ def units(self, proof=None):
sage: K.<a> = NumberField(1/2*x^2 - 1/6)
sage: K.units()
(-3*a + 2,)
(3*a + 2,)
"""
proof = proof_flag(proof)

Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/number_field/number_field_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ cdef class NumberFieldElement(NumberFieldElement_base):
sage: x = polygen(ZZ, 'x')
sage: K.<i> = NumberField(x^2 + 1)
sage: (6*i + 6).factor()
(i) * (-i - 1)^3 * 3
(i - 1)^3 * 3
In the following example, the class number is 2. If a factorization
in prime elements exists, we will find it::
Expand Down Expand Up @@ -2043,7 +2043,7 @@ cdef class NumberFieldElement(NumberFieldElement_base):
0
sage: R = K.maximal_order()
sage: R(i+1).gcd(2)
i + 1
i - 1
sage: R = K.order(2*i)
sage: R(1).gcd(R(4*i))
1
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/number_field/number_field_ideal_rel.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def absolute_ideal(self, names='a'):
sage: J.absolute_norm()
2
sage: J.ideal_below()
Fractional ideal (b)
Fractional ideal (-b)
sage: J.ideal_below().norm()
2
"""
Expand Down Expand Up @@ -385,7 +385,7 @@ def relative_norm(self):
sage: K.<a> = NumberField(x^2 + 6)
sage: L.<b> = K.extension(K['x'].gen()^4 + a)
sage: N = L.ideal(b).relative_norm(); N
Fractional ideal (a)
Fractional ideal (-a)
sage: N.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 6
sage: N.ring()
Expand Down Expand Up @@ -916,7 +916,7 @@ def is_NumberFieldFractionalIdeal_rel(x):
sage: is_NumberFieldFractionalIdeal_rel(I)
True
sage: N = I.relative_norm(); N
Fractional ideal (a)
Fractional ideal (-a)
sage: is_NumberFieldFractionalIdeal_rel(N)
False
"""
Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/number_field/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def fractional_ideal(self, *args, **kwds):
sage: K.<a> = NumberField(x^2 + 2)
sage: R = K.maximal_order()
sage: R.fractional_ideal(2/3 + 7*a, a)
Fractional ideal (-1/3*a)
Fractional ideal (1/3*a)
"""
return self.number_field().fractional_ideal(*args, **kwds)

Expand Down Expand Up @@ -570,7 +570,7 @@ def __mul__(self, right):
sage: k.<a> = NumberField(x^2 + 5077); G = k.class_group(); G
Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077
sage: G.0 ^ -9
Fractional ideal class (67, a + 45)
Fractional ideal class (43, a + 13)
sage: Ok = k.maximal_order(); Ok
Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077
sage: Ok * (11, a + 7)
Expand Down Expand Up @@ -2933,7 +2933,7 @@ def GaussianIntegers(names='I', latex_name='i'):
sage: ZZI
Gaussian Integers generated by I in Number Field in I with defining polynomial x^2 + 1 with I = 1*I
sage: factor(3 + I)
(-I) * (I - 2) * (-I + 1)
(-2*I - 1) * (I - 1)
sage: CC(I)
1.00000000000000*I
sage: I.minpoly()
Expand Down Expand Up @@ -2964,7 +2964,7 @@ def EisensteinIntegers(names='omega'):
with defining polynomial x^2 + x + 1
with omega = -0.50000000000000000? + 0.866025403784439?*I
sage: factor(3 + omega)
(omega + 1) * (-2*omega + 1)
(omega) * (-3*omega - 2)
sage: CC(omega)
-0.500000000000000 + 0.866025403784439*I
sage: omega.minpoly()
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/number_field/selmer_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ def pSelmerGroup(K, S, p, proof=None, debug=False):
sage: [K.ideal(g).factor() for g in gens]
[(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)),
Fractional ideal (a),
(Fractional ideal (2, a + 1))^2,
1]
Fractional ideal (-a),
(Fractional ideal (2, a + 1))^2,
1]
sage: toKS2(10)
(0, 0, 1, 1)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/polynomial/polynomial_quotient_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ def selmer_generators(self, S, m, proof=True):
sage: D.selmer_generators([K.ideal(2, -a + 1),
....: K.ideal(3, a + 1),
....: K.ideal(a)], 3)
[2, a + 1, -a]
[2, a + 1, a]
"""
fields, isos, iso_classes = self._S_decomposition(tuple(S))
n = len(fields)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/rational.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ cdef class Rational(sage.structure.element.FieldElement):
sage: 0.is_norm(K)
True
sage: (1/7).is_norm(K, element=True)
(True, -3/7*beta + 5/7)
(True, 1/7*beta + 3/7)
sage: (1/10).is_norm(K, element=True)
(False, None)
sage: (1/691).is_norm(QQ, element=True)
Expand Down Expand Up @@ -1558,7 +1558,7 @@ cdef class Rational(sage.structure.element.FieldElement):
EXAMPLES::
sage: QQ(2)._bnfisnorm(QuadraticField(-1, 'i')) # needs sage.rings.number_field
(-i + 1, 1)
(i - 1, 1)
sage: x = polygen(QQ, 'x')
sage: 7._bnfisnorm(NumberField(x^3 - 2, 'b')) # needs sage.rings.number_field
(1, 7)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/berkovich/berkovich_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def ideal(self):
sage: ideal = A.prime_above(5)
sage: B = Berkovich_Cp_Projective(A, ideal)
sage: B.ideal()
Fractional ideal (-a - 2)
Fractional ideal (2*a - 1)
::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/plane_conics/con_number_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def has_rational_point(self, point=False, obstruction=False,
sage: K.<i> = QuadraticField(-1)
sage: C = Conic(K, [1, 3, -5])
sage: C.has_rational_point(point=True, obstruction=True)
(False, Fractional ideal (i + 2))
(False, Fractional ideal (2*i - 1))
sage: C.has_rational_point(algorithm='rnfisnorm')
False
sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True,
Expand Down

0 comments on commit a5c65e1

Please sign in to comment.