Skip to content

Commit

Permalink
Update tests output for pari 2.17
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-rojas committed Oct 5, 2024
1 parent 03ba663 commit f619b6f
Show file tree
Hide file tree
Showing 40 changed files with 336 additions and 334 deletions.
6 changes: 3 additions & 3 deletions src/sage/arith/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2693,7 +2693,7 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
sage: K.<i> = QuadraticField(-1) # needs sage.rings.number_field
sage: factor(122 - 454*i) # needs sage.rings.number_field
(-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4)
(-i - 2)^3 * (-i - 1)^3 * (3*i + 2) * (i + 4)
To access the data in a factorization::
Expand Down Expand Up @@ -2776,7 +2776,7 @@ def radical(n, *args, **kwds):
ArithmeticError: radical of 0 is not defined
sage: K.<i> = QuadraticField(-1) # needs sage.rings.number_field
sage: radical(K(2)) # needs sage.rings.number_field
i + 1
-i - 1
Tests with numpy and gmpy2 numbers::
Expand Down Expand Up @@ -3031,7 +3031,7 @@ def is_squarefree(n):
sage: is_squarefree(O(2))
False
sage: O(2).factor()
(-I) * (I + 1)^2
(-I) * (-I - 1)^2
This method fails on domains which are not Unique Factorization Domains::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/quotient_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def gcd(self, other):
sage: R = ZZ.extension(x^2 + 1, names='i')
sage: i = R.1
sage: gcd(5, 3 + 4*i)
-i - 2
2*i - 1
sage: P.<t> = R[]
sage: gcd(t, i)
Traceback (most recent call last):
Expand Down
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 (2*a + 1)
Fractional ideal (-a + 2)
sage: g = f.conjugate(conj, new_ideal=ideal)
sage: g.domain().ideal()
Fractional ideal (2*a + 1)
Fractional ideal (-a + 2)
"""
if self.domain().is_padic_base():
return DynamicalSystem_Berkovich(self._system.conjugate(M, adjugate=adjugate))
Expand Down
2 changes: 1 addition & 1 deletion src/sage/dynamics/arithmetic_dynamics/projective_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ def primes_of_bad_reduction(self, check=True):
sage: P.<x,y> = ProjectiveSpace(K,1)
sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2])
sage: f.primes_of_bad_reduction() # needs sage.rings.function_field
[Fractional ideal (a), Fractional ideal (3)]
[Fractional ideal (-a), Fractional ideal (3)]
This is an example where ``check=False`` returns extra primes::
Expand Down
8 changes: 4 additions & 4 deletions src/sage/libs/pari/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@
sage: pari(-104).quadclassunit()
[6, [6], [Qfb(5, -4, 6)], 1]
sage: pari(109).quadclassunit()
[1, [], [], 5.56453508676047]
[1, [], [], 5.56453508676047, -1]
sage: pari(10001).quadclassunit() # random generators
[16, [16], [Qfb(10, 99, -5, 0.E-38)], 5.29834236561059]
sage: pari(10001).quadclassunit()[0]
Expand Down Expand Up @@ -1749,13 +1749,13 @@
sage: y = QQ['yy'].0; _ = pari(y) # pari has variable ordering rules
sage: x = QQ['zz'].0; nf = pari(x^2 + 2).nfinit()
sage: nf.nfroots(y^2 + 2)
[Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)]
[Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)]~
sage: nf = pari(x^3 + 2).nfinit()
sage: nf.nfroots(y^3 + 2)
[Mod(zz, zz^3 + 2)]
[Mod(zz, zz^3 + 2)]~
sage: nf = pari(x^4 + 2).nfinit()
sage: nf.nfroots(y^4 + 2)
[Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)]
[Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)]~
sage: nf = pari('x^2 + 1').nfinit()
sage: nf.nfrootsof1()
Expand Down
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16583,7 +16583,7 @@ cdef class Matrix(Matrix1):
....: -2*a^2 + 4*a - 2, -2*a^2 + 1, 2*a, a^2 - 6, 3*a^2 - a ])
sage: r,s,p = m._echelon_form_PID()
sage: s[2]
(0, 0, -3*a^2 - 18*a + 34, -68*a^2 + 134*a - 53, -111*a^2 + 275*a - 90)
(0, 0, 3*a^2 + 18*a - 34, 68*a^2 - 134*a + 53, 111*a^2 - 275*a + 90)
sage: r * m == s and r.det() == 1
True

Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/cusps_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,9 +1184,9 @@ def NFCusps_ideal_reps_for_levelN(N, nlists=1):
sage: from sage.modular.cusps_nf import NFCusps_ideal_reps_for_levelN
sage: NFCusps_ideal_reps_for_levelN(N)
[(Fractional ideal (1),
Fractional ideal (67, a + 17),
Fractional ideal (127, a + 48),
Fractional ideal (157, a - 19))]
Fractional ideal (67, -4/7*a^3 + 13/7*a^2 + 39/7*a - 43),
Fractional ideal (127, -4/7*a^3 + 13/7*a^2 + 39/7*a - 42),
Fractional ideal (157, -4/7*a^3 + 13/7*a^2 + 39/7*a + 48))]
sage: L = NFCusps_ideal_reps_for_levelN(N, 5)
sage: all(len(L[i]) == k.class_number() for i in range(len(L)))
True
Expand Down Expand Up @@ -1244,7 +1244,7 @@ def units_mod_ideal(I):
sage: I = k.ideal(5, a + 1)
sage: units_mod_ideal(I)
[1,
-2*a^2 - 4*a + 1,
2*a^2 + 4*a - 1,
...]
::
Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/dirichlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,13 +2395,13 @@ class DirichletGroupFactory(UniqueFactory):
sage: parent(val)
Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2
sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val)
17
12
sage: r4_29_0(val) * GF(29)(3)
22
7
sage: r4_29_0(G.gens()[2].values_on_gens()[2]) * 3
22
7
sage: parent(r4_29_0(G.gens()[2].values_on_gens()[2]) * 3)
Residue field of Fractional ideal (-2*zeta4 + 5)
Residue field of Fractional ideal (-2*zeta4 - 5)
::
Expand Down
8 changes: 4 additions & 4 deletions src/sage/modular/modsym/p1list_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
sage: alpha = MSymbol(N, a + 2, 3*a^2)
sage: alpha.lift_to_sl2_Ok()
[-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3]
[-a - 1, 15*a^2 - 38*a + 86, a + 2, -a^2 + 9*a - 19]
sage: Ok = k.ring_of_integers()
sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok())
sage: det(M)
Expand Down Expand Up @@ -977,11 +977,11 @@ def apply_J_epsilon(self, i, e1, e2=1):
sage: N = k.ideal(5, a + 1)
sage: P = P1NFList(N)
sage: u = k.unit_group().gens_values(); u
[-1, -2*a^2 - 4*a + 1]
[-1, 2*a^2 + 4*a - 1]
sage: P.apply_J_epsilon(4, -1)
2
sage: P.apply_J_epsilon(4, u[0], u[1])
5
1
::
Expand Down Expand Up @@ -1122,7 +1122,7 @@ def lift_to_sl2_Ok(N, c, d):
sage: M = Matrix(Ok, 2, lift_to_sl2_Ok(N, 0, 7))
Traceback (most recent call last):
...
ValueError: <0> + <7> and the Fractional ideal (7, a) are not coprime.
ValueError: <0> + <7> and the Fractional ideal (7, -4/7*a^3 + 13/7*a^2 + 39/7*a - 19) are not coprime.
"""
k = N.number_field()
# check the input
Expand Down
8 changes: 4 additions & 4 deletions src/sage/quadratic_forms/binary_qf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ def solve_integer(self, n, *, algorithm='general', _flag=2):
sage: Q = BinaryQF([1, 0, 12345])
sage: n = 2^99 + 5273
sage: Q.solve_integer(n) # needs sage.libs.pari
(-67446480057659, 7139620553488)
(67446480057659, 7139620553488)
sage: Q.solve_integer(n, algorithm='cornacchia') # needs sage.libs.pari
(67446480057659, 7139620553488)
sage: timeit('Q.solve_integer(n)') # not tested
Expand All @@ -1661,7 +1661,7 @@ def solve_integer(self, n, *, algorithm='general', _flag=2):
sage: Qs
[x^2 + x*y + 6*y^2, 2*x^2 - x*y + 3*y^2, 2*x^2 + x*y + 3*y^2]
sage: [Q.solve_integer(3) for Q in Qs]
[None, (0, -1), (0, -1)]
[None, (0, 1), (0, 1)]
sage: [Q.solve_integer(5) for Q in Qs]
[None, None, None]
sage: [Q.solve_integer(6) for Q in Qs]
Expand Down Expand Up @@ -1741,11 +1741,11 @@ def solve_integer(self, n, *, algorithm='general', _flag=2):
sage: # needs sage.libs.pari
sage: Q = BinaryQF([1, 0, 5])
sage: Q.solve_integer(126, _flag=1)
[(11, -1), (-1, -5), (-1, 5), (-11, -1)]
[(-11, -1), (-1, -5), (-1, 5), (11, -1)]
sage: Q.solve_integer(126, _flag=2)
(11, -1)
sage: Q.solve_integer(126, _flag=3)
[(11, -1), (-1, -5), (-1, 5), (-11, -1), (-9, -3), (9, -3)]
[(-11, -1), (-9, -3), (-1, -5), (-1, 5), (9, -3), (11, -1)]
"""
if self.is_negative_definite(): # not supported by PARI
return (-self).solve_integer(-n)
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/finite_rings/finite_field_prime_modn.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def _coerce_map_from_(self, S):
sage: RF13 = K.residue_field(pp)
sage: RF13.hom([GF(13)(1)])
Ring morphism:
From: Residue field of Fractional ideal (-w - 18)
To: Finite Field of size 13
Defn: 1 |--> 1
From: Residue field of Fractional ideal (w + 18)
To: Finite Field of size 13
Defn: 1 |--> 1
Check that :issue:`19573` is resolved::
Expand Down
41 changes: 19 additions & 22 deletions src/sage/rings/finite_rings/residue_field.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ monogenic (i.e., 2 is an essential discriminant divisor)::
sage: # needs sage.rings.number_field
sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8)
sage: F = K.factor(2); F
(Fractional ideal (-1/2*a^2 + 1/2*a - 1)) * (Fractional ideal (-a^2 + 2*a - 3))
* (Fractional ideal (3/2*a^2 - 5/2*a + 4))
(Fractional ideal (-1/2*a^2 + 1/2*a - 1)) * (Fractional ideal (a^2 - 2*a + 3)) * (Fractional ideal (-3/2*a^2 + 5/2*a - 4))
sage: F[0][0].residue_field()
Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
sage: F[1][0].residue_field()
Residue field of Fractional ideal (-a^2 + 2*a - 3)
Residue field of Fractional ideal (a^2 - 2*a + 3)
sage: F[2][0].residue_field()
Residue field of Fractional ideal (3/2*a^2 - 5/2*a + 4)
Residue field of Fractional ideal (-3/2*a^2 + 5/2*a - 4)
We can also form residue fields from `\ZZ`::
Expand Down Expand Up @@ -126,10 +125,10 @@ First over a small non-prime field::
sage: I = ideal([ubar*X + Y]); I
Ideal (ubar*X + Y) of Multivariate Polynomial Ring in X, Y over
Residue field in ubar of Fractional ideal
(47, 517/55860*u^5 + 235/3724*u^4 + 9829/13965*u^3
+ 54106/13965*u^2 + 64517/27930*u + 755696/13965)
(47, 4841/93100*u^5 + 34451/139650*u^4 + 303697/69825*u^3
+ 297893/27930*u^2 + 1649764/23275*u + 2633506/69825)
sage: I.groebner_basis() # needs sage.libs.singular
[X + (-19*ubar^2 - 5*ubar - 17)*Y]
[X + (-15*ubar^2 + 3*ubar - 2)*Y]
And now over a large prime field::
Expand Down Expand Up @@ -496,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 @@ -1008,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 @@ -1039,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 @@ -1071,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 @@ -1083,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 All @@ -1105,11 +1104,11 @@ cdef class ReductionMap(Map):
sage: # needs sage.rings.number_field
sage: K.<i> = NumberField(x^2 + 1)
sage: P1, P2 = [g[0] for g in K.factor(5)]; P1, P2
(Fractional ideal (-i - 2), Fractional ideal (2*i + 1))
(Fractional ideal (2*i - 1), Fractional ideal (-2*i - 1))
sage: a = 1/(1+2*i)
sage: F1, F2 = [g.residue_field() for g in [P1,P2]]; F1, F2
(Residue field of Fractional ideal (-i - 2),
Residue field of Fractional ideal (2*i + 1))
(Residue field of Fractional ideal (2*i - 1),
Residue field of Fractional ideal (-2*i - 1))
sage: a.valuation(P1)
0
sage: F1(i/7)
Expand All @@ -1122,7 +1121,7 @@ cdef class ReductionMap(Map):
Traceback (most recent call last):
...
ZeroDivisionError: Cannot reduce field element -2/5*i + 1/5
modulo Fractional ideal (2*i + 1): it has negative valuation
modulo Fractional ideal (-2*i - 1): it has negative valuation
"""
# The reduction map is just x |--> F(to_vs(x) * (PB**(-1))) if
# either x is integral or the denominator of x is coprime to
Expand Down Expand Up @@ -1188,8 +1187,7 @@ cdef class ReductionMap(Map):
sage: f = k.convert_map_from(K)
sage: s = f.section(); s
Lifting map:
From: Residue field in abar of
Fractional ideal (-14*a^4 + 24*a^3 + 26*a^2 - 58*a + 15)
From: Residue field in abar of Fractional ideal (14*a^4 - 24*a^3 - 26*a^2 + 58*a - 15)
To: Number Field in a with defining polynomial x^5 - 5*x + 2
sage: s(k.gen())
a
Expand Down Expand Up @@ -1424,8 +1422,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism):
sage: f = k.coerce_map_from(K.ring_of_integers())
sage: s = f.section(); s
Lifting map:
From: Residue field in abar of
Fractional ideal (-14*a^4 + 24*a^3 + 26*a^2 - 58*a + 15)
From: Residue field in abar of Fractional ideal (14*a^4 - 24*a^3 - 26*a^2 + 58*a - 15)
To: Maximal Order generated by a in Number Field in a with defining polynomial x^5 - 5*x + 2
sage: s(k.gen())
a
Expand Down Expand Up @@ -1678,7 +1675,7 @@ cdef class LiftingMap(Section):
sage: F.<tmod> = K.factor(7)[0][0].residue_field()
sage: F.lift_map() #indirect doctest
Lifting map:
From: Residue field in tmod of Fractional ideal (theta_12^2 + 2)
From: Residue field in tmod of Fractional ideal (2*theta_12^3 + theta_12)
To: Maximal Order generated by theta_12 in Cyclotomic Field of order 12 and degree 4
"""
return "Lifting"
Expand Down
2 changes: 1 addition & 1 deletion src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class ResidueFiniteField_pari_ffelt(ResidueField_generic, FiniteField_pari_ffelt
sage: P.residue_class_degree()
2
sage: ff.<alpha> = P.residue_field(); ff
Residue field in alpha of Fractional ideal (-12*aa^2 + 189*aa - 475)
Residue field in alpha of Fractional ideal (12*aa^2 - 189*aa + 475)
sage: type(ff)
<class 'sage.rings.finite_rings.residue_field_pari_ffelt.ResidueFiniteField_pari_ffelt_with_category'>
sage: ff(alpha^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
Loading

0 comments on commit f619b6f

Please sign in to comment.