diff options
author | Antonio Rojas | 2022-09-30 09:02:00 +0200 |
---|---|---|
committer | Antonio Rojas | 2022-09-30 09:02:00 +0200 |
commit | b8d3571eb0460c60c652b83b7e18a19fbaae0352 (patch) | |
tree | f10d89b5b0fe5abcc29e89091ad52ec1ff9eb786 | |
parent | 5bba214093a3f96bf484d04627b6064575694bf5 (diff) | |
download | aur-b8d3571eb0460c60c652b83b7e18a19fbaae0352.tar.gz |
Add patch for pari 2.15
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 10 | ||||
-rw-r--r-- | sagemath-pari-2.15.patch | 1737 |
3 files changed, 1747 insertions, 4 deletions
@@ -1,6 +1,6 @@ pkgbase = sagemath-git pkgdesc = Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab - pkgver = 9.7.rc0.r0.gcae9ee5177a + pkgver = 9.8.beta1.r0.g54cd6fe6de5 pkgrel = 1 url = http://www.sagemath.org arch = x86_64 @@ -108,6 +108,7 @@ pkgbase = sagemath-git source = sagemath-gap-4.12.patch source = sagemath-ipywidgets-8.patch source = sagemath-tdlib-0.9.patch + source = sagemath-pari-2.15.patch sha256sums = SKIP sha256sums = eee5fa15d8c7be7e009166dbde3ea24bb10d7793dc12880516f278f86b1a6694 sha256sums = bd188af45ce31579b82407adee8e9bf6033a996f7ea6e328fabca526f31c08ba @@ -118,5 +119,6 @@ pkgbase = sagemath-git sha256sums = 84c1700e285ab1d94d16d0a602417a414447d8a23ac2e55a093285cc4bd2916d sha256sums = bdf56f85b608da12074780271ae134b02a03278f7b53a183f6dd97d8d72073e0 sha256sums = 56a83abecf2ff5a500442adc7a50abbb70006037dd39c39dcdb04b3ca9fb51e2 + sha256sums = 8a1d802b1916c5a7d9b1cdde3e46a79e44f1b10a9d70be1f1885ce84406faa01 pkgname = sagemath-git @@ -6,7 +6,7 @@ # Contributor: Stefan Husmann <stefan-husmann at t-online dot de> pkgname=sagemath-git -pkgver=9.7.rc0.r0.gcae9ee5177a +pkgver=9.8.beta1.r0.g54cd6fe6de5 pkgrel=1 pkgdesc='Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab' arch=(x86_64) @@ -62,7 +62,8 @@ source=(git://git.sagemath.org/sage.git#branch=develop sagemath-tachyon-0.99.patch sagemath-gap-4.12.patch sagemath-ipywidgets-8.patch - sagemath-tdlib-0.9.patch) + sagemath-tdlib-0.9.patch + sagemath-pari-2.15.patch) sha256sums=('SKIP' 'eee5fa15d8c7be7e009166dbde3ea24bb10d7793dc12880516f278f86b1a6694' 'bd188af45ce31579b82407adee8e9bf6033a996f7ea6e328fabca526f31c08ba' @@ -72,7 +73,8 @@ sha256sums=('SKIP' '9760db6c6ec40cc16ab8a0cbf3d019df7f6a69ff292e35622f282b7c888aac77' '84c1700e285ab1d94d16d0a602417a414447d8a23ac2e55a093285cc4bd2916d' 'bdf56f85b608da12074780271ae134b02a03278f7b53a183f6dd97d8d72073e0' - '56a83abecf2ff5a500442adc7a50abbb70006037dd39c39dcdb04b3ca9fb51e2') + '56a83abecf2ff5a500442adc7a50abbb70006037dd39c39dcdb04b3ca9fb51e2' + '8a1d802b1916c5a7d9b1cdde3e46a79e44f1b10a9d70be1f1885ce84406faa01') pkgver() { cd sage @@ -93,6 +95,8 @@ prepare(){ patch -p1 -i ../sagemath-gap-4.12.patch # Fixes for ipywidgets 8 https://trac.sagemath.org/ticket/34460 patch -p1 -i ../sagemath-ipywidgets-8.patch +# Update to PARI 2.15 https://trac.sagemath.org/ticket/34537 + patch -p1 -i ../sagemath-pari-2.15.patch # Arch-specific patches # assume all optional packages are installed diff --git a/sagemath-pari-2.15.patch b/sagemath-pari-2.15.patch new file mode 100644 index 000000000000..65735562178b --- /dev/null +++ b/sagemath-pari-2.15.patch @@ -0,0 +1,1737 @@ +diff --git a/build/pkgs/giac/patches/pari_2_15.patch b/build/pkgs/giac/patches/pari_2_15.patch +new file mode 100644 +index 0000000000..d2900a5ffc +--- /dev/null ++++ b/build/pkgs/giac/patches/pari_2_15.patch +@@ -0,0 +1,21 @@ ++ANYARG patch ++ ++diff --git a/src/pari.cc b/src/pari.cc ++index 76ce8e1..50d08ab 100644 ++--- a/src/pari.cc +++++ b/src/pari.cc ++@@ -40,6 +40,13 @@ using namespace std; ++ ++ #ifdef HAVE_LIBPARI ++ +++// Anyarg disappeared from PARI 2.15.0 +++#ifdef __cplusplus +++# define ANYARG ... +++#else +++# define ANYARG +++#endif +++ ++ #ifdef HAVE_PTHREAD_H ++ #include <pthread.h> ++ #endif ++ +diff --git a/build/pkgs/pari/checksums.ini b/build/pkgs/pari/checksums.ini +index b736feed31..bafd0f36f4 100644 +--- a/build/pkgs/pari/checksums.ini ++++ b/build/pkgs/pari/checksums.ini +@@ -1,5 +1,5 @@ + tarball=pari-VERSION.tar.gz +-sha1=e01647aab7e96a8cb4922cf26a4f224337c6647f +-md5=922f740fcdf8630b30d63dc76b58f756 +-cksum=297133525 ++sha1=cba9b279f67d5efe2fbbccf3be6e9725f816cf07 ++md5=76d430f1bea1b07fa2ad9712deeaa736 ++cksum=1990743897 + upstream_url=https://pari.math.u-bordeaux.fr/pub/pari/unix/pari-VERSION.tar.gz +diff --git a/build/pkgs/pari/package-version.txt b/build/pkgs/pari/package-version.txt +index a1a4224dd5..68e69e405e 100644 +--- a/build/pkgs/pari/package-version.txt ++++ b/build/pkgs/pari/package-version.txt +@@ -1 +1 @@ +-2.13.3 ++2.15.0 +diff --git a/src/doc/de/tutorial/tour_numtheory.rst b/src/doc/de/tutorial/tour_numtheory.rst +index a012234c99..e3149fe949 100644 +--- a/src/doc/de/tutorial/tour_numtheory.rst ++++ b/src/doc/de/tutorial/tour_numtheory.rst +@@ -157,7 +157,7 @@ implementiert. + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/doc/en/tutorial/tour_numtheory.rst b/src/doc/en/tutorial/tour_numtheory.rst +index 3064d100e2..075e0ac0ad 100644 +--- a/src/doc/en/tutorial/tour_numtheory.rst ++++ b/src/doc/en/tutorial/tour_numtheory.rst +@@ -157,7 +157,7 @@ NumberField class. + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/doc/es/tutorial/tour_numtheory.rst b/src/doc/es/tutorial/tour_numtheory.rst +index a1f7d1a87b..48e5376cfe 100644 +--- a/src/doc/es/tutorial/tour_numtheory.rst ++++ b/src/doc/es/tutorial/tour_numtheory.rst +@@ -140,7 +140,7 @@ Varios métodos relacionados están implementados en la clase ``NumberField``:: + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/doc/fr/tutorial/tour_numtheory.rst b/src/doc/fr/tutorial/tour_numtheory.rst +index 871092f5fa..d1b2fee883 100644 +--- a/src/doc/fr/tutorial/tour_numtheory.rst ++++ b/src/doc/fr/tutorial/tour_numtheory.rst +@@ -159,7 +159,7 @@ dans la classe NumberField. + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/doc/ja/tutorial/tour_numtheory.rst b/src/doc/ja/tutorial/tour_numtheory.rst +index 47af68c862..4d4ed52d50 100644 +--- a/src/doc/ja/tutorial/tour_numtheory.rst ++++ b/src/doc/ja/tutorial/tour_numtheory.rst +@@ -161,7 +161,7 @@ Sageには :math:`p` \-進数体も組込まれている. + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/doc/pt/tutorial/tour_numtheory.rst b/src/doc/pt/tutorial/tour_numtheory.rst +index 6371b491ea..a3dc973a93 100644 +--- a/src/doc/pt/tutorial/tour_numtheory.rst ++++ b/src/doc/pt/tutorial/tour_numtheory.rst +@@ -157,7 +157,7 @@ NumberField. + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/doc/ru/tutorial/tour_numtheory.rst b/src/doc/ru/tutorial/tour_numtheory.rst +index 652abfbc99..a985d49fbd 100644 +--- a/src/doc/ru/tutorial/tour_numtheory.rst ++++ b/src/doc/ru/tutorial/tour_numtheory.rst +@@ -150,7 +150,7 @@ Sage содержит стандартные функции теории чис + Univariate Quotient Polynomial Ring in a over Rational Field with modulus + x^3 + x^2 - 2*x + 8 + sage: K.units() +- (3*a^2 + 13*a + 13,) ++ (-3*a^2 - 13*a - 13,) + sage: K.discriminant() + -503 + sage: K.class_group() +diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py +index 1bd4d4c6a1..6483caa22d 100644 +--- a/src/sage/arith/misc.py ++++ b/src/sage/arith/misc.py +@@ -1514,13 +1514,13 @@ def divisors(n): + + sage: K.<a> = QuadraticField(7) + sage: divisors(K.ideal(7)) +- [Fractional ideal (1), Fractional ideal (-a), Fractional ideal (7)] ++ [Fractional ideal (1), Fractional ideal (a), Fractional ideal (7)] + sage: divisors(K.ideal(3)) + [Fractional ideal (1), Fractional ideal (3), +- Fractional ideal (-a + 2), Fractional ideal (-a - 2)] ++ Fractional ideal (a - 2), Fractional ideal (a + 2)] + sage: divisors(K.ideal(35)) +- [Fractional ideal (1), Fractional ideal (5), Fractional ideal (-a), +- Fractional ideal (7), Fractional ideal (-5*a), Fractional ideal (35)] ++ [Fractional ideal (1), Fractional ideal (5), Fractional ideal (a), ++ Fractional ideal (7), Fractional ideal (5*a), Fractional ideal (35)] + + TESTS:: + +@@ -2618,7 +2618,7 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds): + + sage: K.<i> = QuadraticField(-1) + sage: factor(122 - 454*i) +- (-3*i - 2) * (-i - 2)^3 * (i + 1)^3 * (i + 4) ++ (-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4) + + To access the data in a factorization:: + +diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +index f47d5d3624..8675935117 100644 +--- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py ++++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py +@@ -8122,9 +8122,9 @@ class DynamicalSystem_projective_field(DynamicalSystem_projective, + sage: f = DynamicalSystem_projective([x^2 + QQbar(sqrt(3))*y^2, y^2, QQbar(sqrt(2))*z^2]) + sage: f.reduce_base_field() + Dynamical System of Projective Space of dimension 2 over Number Field in a with +- defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137? ++ defining polynomial y^4 - 4*y^2 + 1 with a = -0.5176380902050415? + Defn: Defined on coordinates by sending (x : y : z) to +- (x^2 + (a^2 - 2)*y^2 : y^2 : (a^3 - 3*a)*z^2) ++ (x^2 + (-a^2 + 2)*y^2 : y^2 : (a^3 - 3*a)*z^2) + + :: + +diff --git a/src/sage/ext_data/pari/simon/ellQ.gp b/src/sage/ext_data/pari/simon/ellQ.gp +index 420af8f6a2..65e8386779 100644 +--- a/src/sage/ext_data/pari/simon/ellQ.gp ++++ b/src/sage/ext_data/pari/simon/ellQ.gp +@@ -40,7 +40,7 @@ + gp > \r ellcommon.gp + gp > \r ellQ.gp + +- The main function is ellrank(), which takes as an argument ++ The main function is ellQ_ellrank(), which takes as an argument + any elliptic curve in the form [a1,a2,a3,a4,a6] + the result is a vector [r,s,v], where + r is a lower bound for the rank, +@@ -50,7 +50,7 @@ + Example: + + gp > ell = [1,2,3,4,5]; +- gp > ellrank(ell) ++ gp > ellQ_ellrank(ell) + %1 = [1, 1, [[1,2]] + In this example, the rank is exactly 1, and [1,2] has infinite order. + +@@ -92,7 +92,7 @@ + \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + + Explications succintes : +- La fonction ellrank() accepte toutes les courbes sous la forme ++ La fonction ellQ_ellrank() accepte toutes les courbes sous la forme + [a1,a2,a3,a4,a6] + Les coefficients peuvent etre entiers ou non. + L'algorithme utilise est celui de la 2-descente. +@@ -100,7 +100,7 @@ + Il suffit de taper : + + gp > ell = [a1,a2,a3,a4,a6]; +- gp > ellrank(ell) ++ gp > ellQ_ellrank(ell) + + Retourne un vecteur [r,s,v] ou + r est le rang probable (c'est toujours une minoration du rang), +@@ -110,7 +110,7 @@ + Exemple : + + gp > ell = [1,2,3,4,5]; +- gp > ellrank(ell) ++ gp > ellQ_ellrank(ell) + %1 = [1, 1, [[1,2]] + Ici, le rang est exactement 1, et le point [1,2] est d'ordre infini. + +@@ -1571,12 +1571,12 @@ if( DEBUGLEVEL_ell >= 4, print(" end of ell2descent_gen")); + print("rank(E/Q) >= ",m1) + ); + } +-{ellrank(ell,help=[]) = ++{ellQ_ellrank(ell,help=[]) = + \\ Algorithm of 2-descent on the elliptic curve ell. + \\ help is a list of known points on ell. + my(urst,urst1,den,eqell,tors2,bnf,rang,time1); + +-if( DEBUGLEVEL_ell >= 3, print(" starting ellrank")); ++if( DEBUGLEVEL_ell >= 3, print(" starting ellQ_ellrank")); + if( #ell < 13, ell = ellinit(ell)); + + \\ kill the coefficients a1 and a3 +@@ -1630,7 +1630,7 @@ if( DEBUGLEVEL_ell >= 1, print(" Elliptic curve: Y^2 = ",eqell)); + )); + + rang[3] = ellchangepoint(rang[3],ellinverturst(urst)); +-if( DEBUGLEVEL_ell >= 3, print(" end of ellrank")); ++if( DEBUGLEVEL_ell >= 3, print(" end of ellQ_ellrank")); + + return(rang); + } +@@ -2106,13 +2106,13 @@ if( DEBUGLEVEL_ell >= 3, print(" end of ell2descent_viaisog")); + { + \\ functions for elliptic curves + addhelp(ell2descent_complete, +- "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellrank for the format of the output."); ++ "ell2descent_complete(e1,e2,e3): Performs a complete 2-descent on the elliptic curve y^2 = (x-e1)*(x-e2)*(x-e3). See ?ellQ_ellrank for the format of the output."); + addhelp(ell2descent_gen, +- "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellrank for the format of the output."); ++ "ell2descent_gen((E,bnf,k=1,help=[]): E is a vector of the form [0,A,0,B,C], (or the result of ellinit of such a vector) A,B,C integers such that x^3+A*x^2+B*x+C; bnf is the corresponding bnfinit(,1); Performs 2-descent on the elliptic curve Ek: k*y^2=x^3+A*x^2+B*x+C. See ?ellQ_ellrank for the format of the output."); + addhelp(ell2descent_viaisog, +- "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellrank for the format of the output."); +- addhelp(ellrank, +- "ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ"); ++ "ell2descent_viaisog(E,help=[]): E is an elliptic curve of the form [0,a,0,b,0], with a, b integers. Performs a 2-descent via isogeny on E. See ?ellQ_ellrank for the format of the output."); ++ addhelp(ellQ_ellrank, ++ "ellQ_ellrank(E,help=[]): E is any elliptic curve defined over Q. Returns a vector [r,s,v], where r is a lower bound for the rank of E, s is the rank of its 2-Selmer group and v is a list of independant points in E(Q)/2E(Q). If help is a vector of nontrivial points on E, the result might be faster. This function might be used in conjunction with elltors2(E). See also ?default_ellQ"); + addhelp(ellhalf, + "ellhalf(E,P): returns the vector of all points Q on the elliptic curve E such that 2Q = P"); + addhelp(ellredgen, +@@ -2143,7 +2143,7 @@ if( DEBUGLEVEL_ell >= 3, print(" end of ell2descent_viaisog")); + + \\ others + addhelp(default_ellQ, +- "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical."); ++ "default_ellQ(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, ELLREDGENFLAG, COMPLETE, MAXPROB, LIMBIGPRIME): set the value of the global variables used for ellQ_ellrank() and other related functions. DEBUGLEVEL_ell: 0-5: choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; ELLREDGENFLAG: if != 0, try to reduce the generators at the end; COMPLETE: if != 0 and full 2-torsion, use complete 2-descent, otherwise via 2-isogeny; MAXPROB, LIMBIGPRIME: technical."); + /* addhelp(DEBUGLEVEL_ell, + "DEBUGLEVEL_ell: Choose a higher value of this global variable to have more details of the computations printed during the 2-descent algorithm. 0 = don't print anything; 1 = (default) just print the result; 2 = print more details including the Selmer group and the nontrivial quartics."); + */ +diff --git a/src/sage/ext_data/pari/simon/qfsolve.gp b/src/sage/ext_data/pari/simon/qfsolve.gp +index 501fb50828..2107288c1d 100644 +--- a/src/sage/ext_data/pari/simon/qfsolve.gp ++++ b/src/sage/ext_data/pari/simon/qfsolve.gp +@@ -434,146 +434,6 @@ my(cc); + return([U3~*G3*U3,red[2]*U1*U2*U3]); + } + +-\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ +-\\ QUADRATIC FORMS MINIMIZATION \\ +-\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ +- +-\\ Minimization of the quadratic form G, with nonzero determinant. +-\\ of dimension n>=2. +-\\ G must by symmetric and have integral coefficients. +-\\ Returns [G',U,factd] with U in GLn(Q) such that G'=U~*G*U*constant +-\\ is integral and has minimal determinant. +-\\ In dimension 3 or 4, may return a prime p +-\\ if the reduction at p is impossible because of the local non solvability. +-\\ If given, factdetG must be equal to factor(abs(det(G))). +-{qfminimize(G,factdetG) = +-my(factd,U,Ker,Ker2,sol,aux,di); +-my(p); +-my(n,lf,i,vp,dimKer,dimKer2,m); +- +- n = length(G); +- factd = matrix(0,2); +- if( !factdetG, factdetG = factor(matdet(G))); +- +- lf = length(factdetG[,1]); +- i = 1; U = matid(n); +- +- while(i <= lf, +- vp = factdetG[i,2]; +- if( vp == 0, i++; next); +- p = factdetG[i,1]; +- if( p == -1, i++; next); +-if( DEBUGLEVEL_qfsolve >= 4, print(" p = ",p,"^",vp)); +- +-\\ The case vp = 1 can be minimized only if n is odd. +- if( vp == 1 && n%2 == 0, +- factd = concat(factd~, Mat([p,1])~)~; +- i++; next +- ); +- Ker = kermodp(G,p); dimKer = Ker[1]; Ker = Ker[2]; +- +-\\ Rem: we must have dimKer <= vp +-if( DEBUGLEVEL_qfsolve >= 4, print(" dimKer = ",dimKer)); +-\\ trivial case: dimKer = n +- if( dimKer == n, +-if( DEBUGLEVEL_qfsolve >= 4, print(" case 0: dimKer = n")); +- G /= p; +- factdetG[i,2] -= n; +- next +- ); +- G = Ker~*G*Ker; +- U = U*Ker; +- +-\\ 1st case: dimKer < vp +-\\ then the kernel mod p contains a kernel mod p^2 +- if( dimKer < vp, +-if( DEBUGLEVEL_qfsolve >= 4, print(" case 1: dimker < vp")); +- if( dimKer == 1, +-\\ G[,1] /= p; G[1,] /= p; +- G[,1] /= p; G[1,] = G[1,]/p; +- U[,1] /= p; +- factdetG[i,2] -= 2 +- , +- Ker2 = kermodp(matrix(dimKer,dimKer,j,k,G[j,k]/p),p); +- dimKer2 = Ker2[1]; Ker2 = Ker2[2]; +- for( j = 1, dimKer2, Ker2[,j] /= p); +- Ker2 = matdiagonalblock([Ker2,matid(n-dimKer)]); +- G = Ker2~*G*Ker2; +- U = U*Ker2; +- factdetG[i,2] -= 2*dimKer2 +-); +- +-if( DEBUGLEVEL_qfsolve >= 4, print(" end of case 1")); +- next +- ); +- +-\\ Now, we have vp = dimKer +-\\ 2nd case: the dimension of the kernel is >=2 +-\\ and contains an element of norm 0 mod p^2 +- +-\\ search for an element of norm p^2... in the kernel +- if( dimKer > 2 || +- (dimKer == 2 && issquare( di = Mod((G[1,2]^2-G[1,1]*G[2,2])/p^2,p))), +- if( dimKer > 2, +-if( DEBUGLEVEL_qfsolve >= 4, print(" case 2.1")); +- dimKer = 3; +- sol = qfsolvemodp(matrix(3,3,j,k,G[j,k]/p),p) +- , +-if( DEBUGLEVEL_qfsolve >= 4, print(" case 2.2")); +- if( G[1,1]%p^2 == 0, +- sol = [1,0]~ +- , sol = [-G[1,2]/p+sqrt(di),Mod(G[1,1]/p,p)]~ +- ) +- ); +- sol = centerlift(sol); +- sol /= content(sol); +-if( DEBUGLEVEL_qfsolve >= 4, print(" sol = ",sol)); +- Ker = vectorv(n, j, if( j<= dimKer, sol[j], 0)); \\ fill with 0's +- Ker = completebasis(Ker,1); +- Ker[,n] /= p; +- G = Ker~*G*Ker; +- U = U*Ker; +- factdetG[i,2] -= 2; +-if( DEBUGLEVEL_qfsolve >= 4, print(" end of case 2")); +- next +- ); +- +-\\ Now, we have vp = dimKer <= 2 +-\\ and the kernel contains no vector with norm p^2... +- +-\\ In some cases, exchanging the kernel and the image +-\\ makes the minimization easy. +- +- m = (n-1)\2-1; +- if( ( vp == 1 && issquare(Mod(-(-1)^m*matdet(G)/G[1,1],p))) +- || ( vp == 2 && n%2 == 1 && n >= 5) +- || ( vp == 2 && n%2 == 0 && !issquare(Mod((-1)^m*matdet(G)/p^2,p))) +- , +-if( DEBUGLEVEL_qfsolve >= 4, print(" case 3")); +- Ker = matid(n); +- for( j = dimKer+1, n, Ker[j,j] = p); +- G = Ker~*G*Ker/p; +- U = U*Ker; +- factdetG[i,2] -= 2*dimKer-n; +-if( DEBUGLEVEL_qfsolve >= 4, print(" end of case 3")); +- next +- ); +- +-\\ Minimization was not possible se far. +-\\ If n == 3 or 4, this proves the local non-solubility at p. +- if( n == 3 || n == 4, +-if( DEBUGLEVEL_qfsolve >= 1, print(" no local solution at ",p)); +- return(p)); +- +-if( DEBUGLEVEL_qfsolve >= 4, print(" prime ",p," finished")); +- factd = concat(factd~,Mat([p,vp])~)~; +- i++ +- ); +-\\ apply LLL to avoid coefficients explosion +- aux = qflll(U/content(U)); +-return([aux~*G*aux,U*aux,factd]); +-} +- + \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ + \\ CLASS GROUP COMPUTATIONS \\ + \\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ +diff --git a/src/sage/geometry/polyhedron/backend_field.py b/src/sage/geometry/polyhedron/backend_field.py +index 93c46c6630..996d6c1a7a 100644 +--- a/src/sage/geometry/polyhedron/backend_field.py ++++ b/src/sage/geometry/polyhedron/backend_field.py +@@ -275,7 +275,7 @@ class Polyhedron_field(Polyhedron_base): + An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0, + An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0) + sage: p.Vrepresentation() # optional - sage.rings.number_field +- (A vertex at (0.?e-15, 0.707106781186548?), ++ (A vertex at (0.?e-16, 0.7071067811865475?), + A vertex at (1.414213562373095?, 0), + A vertex at (4.000000000000000?, 0.372677996249965?)) + """ +@@ -318,7 +318,7 @@ class Polyhedron_field(Polyhedron_base): + An inequality (-0.1419794359520263?, -1.698172434277148?) x + 1.200789243901438? >= 0, + An inequality (0.3001973109753594?, 0.600394621950719?) x - 0.4245431085692869? >= 0) + sage: p.Vrepresentation() # optional - sage.rings.number_field +- (A vertex at (0.?e-15, 0.707106781186548?), ++ (A vertex at (0.?e-16, 0.7071067811865475?), + A vertex at (1.414213562373095?, 0), + A vertex at (4.000000000000000?, 0.372677996249965?)) + """ +diff --git a/src/sage/groups/matrix_gps/isometries.py b/src/sage/groups/matrix_gps/isometries.py +index f9111a2c92..cca45e7175 100644 +--- a/src/sage/groups/matrix_gps/isometries.py ++++ b/src/sage/groups/matrix_gps/isometries.py +@@ -11,11 +11,11 @@ EXAMPLES:: + sage: L = IntegralLattice("D4") + sage: O = L.orthogonal_group() + sage: O +- Group of isometries with 5 generators ( +- [-1 0 0 0] [0 0 0 1] [-1 -1 -1 -1] [ 1 1 0 0] [ 1 0 0 0] +- [ 0 -1 0 0] [0 1 0 0] [ 0 0 1 0] [ 0 0 1 0] [-1 -1 -1 -1] +- [ 0 0 -1 0] [0 0 1 0] [ 0 1 0 1] [ 0 1 0 1] [ 0 0 1 0] +- [ 0 0 0 -1], [1 0 0 0], [ 0 -1 -1 0], [ 0 -1 -1 0], [ 0 0 0 1] ++ Group of isometries with 3 generators ( ++ [0 0 0 1] [ 1 1 0 0] [ 1 0 0 0] ++ [0 1 0 0] [ 0 0 1 0] [-1 -1 -1 -1] ++ [0 0 1 0] [ 0 1 0 1] [ 0 0 1 0] ++ [1 0 0 0], [ 0 -1 -1 0], [ 0 0 0 1] + ) + + Basic functionality is provided by GAP:: +diff --git a/src/sage/interfaces/genus2reduction.py b/src/sage/interfaces/genus2reduction.py +index 56ae04b235..7a4794daf2 100644 +--- a/src/sage/interfaces/genus2reduction.py ++++ b/src/sage/interfaces/genus2reduction.py +@@ -143,31 +143,31 @@ class ReductionData(SageObject): + sur un corps de valuation discrète", Trans. AMS 348 (1996), + 4577-4610, Section 7.2, Proposition 4). + """ +- def __init__(self, pari_result, P, Q, minimal_equation, minimal_disc, +- local_data, conductor, prime_to_2_conductor_only): ++ def __init__(self, pari_result, P, Q, Pmin, Qmin, minimal_disc, ++ local_data, conductor): + self.pari_result = pari_result + self.P = P + self.Q = Q +- self.minimal_equation = minimal_equation ++ self.Pmin = Pmin ++ self.Qmin = Qmin + self.minimal_disc = minimal_disc + self.local_data = local_data + self.conductor = conductor +- self.prime_to_2_conductor_only = prime_to_2_conductor_only + + def _repr_(self): +- if self.prime_to_2_conductor_only: +- ex = ' (away from 2)' +- else: +- ex = '' + if self.Q == 0: + yterm = '' + else: + yterm = '+ (%s)*y '%self.Q ++ + s = 'Reduction data about this proper smooth genus 2 curve:\n' + s += '\ty^2 %s= %s\n'%(yterm, self.P) +- s += 'A Minimal Equation (away from 2):\n\ty^2 = %s\n'%self.minimal_equation +- s += 'Minimal Discriminant (away from 2): %s\n'%self.minimal_disc +- s += 'Conductor%s: %s\n'%(ex, self.conductor) ++ if self.Qmin: ++ s += 'A Minimal Equation:\n\ty^2 + (%s)y = %s\n'%(self.Qmin, self.Pmin) ++ else: ++ s += 'A Minimal Equation:\n\ty^2 = %s\n'%self.Pmin ++ s += 'Minimal Discriminant: %s\n'%self.minimal_disc ++ s += 'Conductor: %s\n'%self.conductor + s += 'Local Data:\n%s'%self._local_data_str() + return s + +@@ -242,17 +242,7 @@ class Genus2reduction(SageObject): + sage: factor(R.conductor) + 5^4 * 2267 + +- This means that only the odd part of the conductor is known. +- +- :: +- +- sage: R.prime_to_2_conductor_only +- True +- +- The discriminant is always minimal away from 2, but possibly not at +- 2. +- +- :: ++ The discriminant is always minimal:: + + sage: factor(R.minimal_disc) + 2^3 * 5^5 * 2267 +@@ -264,10 +254,10 @@ class Genus2reduction(SageObject): + sage: R + Reduction data about this proper smooth genus 2 curve: + y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5 +- A Minimal Equation (away from 2): +- y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855 +- Minimal Discriminant (away from 2): 56675000 +- Conductor (away from 2): 1416875 ++ A Minimal Equation: ++ y^2 ... ++ Minimal Discriminant: 56675000 ++ Conductor: 1416875 + Local Data: + p=2 + (potential) stable reduction: (II), j=1 +@@ -293,10 +283,10 @@ class Genus2reduction(SageObject): + sage: genus2reduction(0, x^6 + 3*x^3 + 63) + Reduction data about this proper smooth genus 2 curve: + y^2 = x^6 + 3*x^3 + 63 +- A Minimal Equation (away from 2): +- y^2 = x^6 + 3*x^3 + 63 +- Minimal Discriminant (away from 2): 10628388316852992 +- Conductor (away from 2): 2893401 ++ A Minimal Equation: ++ y^2 ... ++ Minimal Discriminant: -10628388316852992 ++ Conductor: 2893401 + Local Data: + p=2 + (potential) stable reduction: (V), j1+j2=0, j1*j2=0 +@@ -327,9 +317,9 @@ class Genus2reduction(SageObject): + sage: genus2reduction(x^3-x^2-1, x^2 - x) + Reduction data about this proper smooth genus 2 curve: + y^2 + (x^3 - x^2 - 1)*y = x^2 - x +- A Minimal Equation (away from 2): +- y^2 = x^6 + 58*x^5 + 1401*x^4 + 18038*x^3 + 130546*x^2 + 503516*x + 808561 +- Minimal Discriminant (away from 2): 169 ++ A Minimal Equation: ++ y^2 ... ++ Minimal Discriminant: -169 + Conductor: 169 + Local Data: + p=13 +@@ -370,10 +360,10 @@ class Genus2reduction(SageObject): + sage: genus2reduction(x^3 - 2*x^2 - 2*x + 1, -5*x^5) + Reduction data about this proper smooth genus 2 curve: + y^2 + (x^3 - 2*x^2 - 2*x + 1)*y = -5*x^5 +- A Minimal Equation (away from 2): +- y^2 = x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855 +- Minimal Discriminant (away from 2): 56675000 +- Conductor (away from 2): 1416875 ++ A Minimal Equation: ++ y^2 ... ++ Minimal Discriminant: 56675000 ++ Conductor: 1416875 + Local Data: + p=2 + (potential) stable reduction: (II), j=1 +@@ -389,9 +379,9 @@ class Genus2reduction(SageObject): + sage: genus2reduction(x^2 + 1, -5*x^5) + Reduction data about this proper smooth genus 2 curve: + y^2 + (x^2 + 1)*y = -5*x^5 +- A Minimal Equation (away from 2): +- y^2 = -20*x^5 + x^4 + 2*x^2 + 1 +- Minimal Discriminant (away from 2): 48838125 ++ A Minimal Equation: ++ y^2 ... ++ Minimal Discriminant: 48838125 + Conductor: 32025 + Local Data: + p=3 +@@ -412,9 +402,9 @@ class Genus2reduction(SageObject): + sage: genus2reduction(x^3 + x^2 + x,-2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2) + Reduction data about this proper smooth genus 2 curve: + y^2 + (x^3 + x^2 + x)*y = -2*x^5 + 3*x^4 - x^3 - x^2 - 6*x - 2 +- A Minimal Equation (away from 2): +- y^2 = x^6 + 18*x^3 + 36*x^2 - 27 +- Minimal Discriminant (away from 2): 1520984142 ++ A Minimal Equation: ++ y^2 ... ++ Minimal Discriminant: 1520984142 + Conductor: 954 + Local Data: + p=2 +@@ -436,18 +426,10 @@ class Genus2reduction(SageObject): + raise ValueError("Q (=%s) must have degree at most 3" % Q) + + res = pari.genus2red([P, Q]) +- + conductor = ZZ(res[0]) +- minimal_equation = R(res[2]) +- +- minimal_disc = QQ(res[2].poldisc()).abs() +- if minimal_equation.degree() == 5: +- minimal_disc *= minimal_equation[5]**2 +- # Multiply with suitable power of 2 of the form 2^(2*(d-1) - 12) +- b = 2 * (minimal_equation.degree() - 1) +- k = QQ((12 - minimal_disc.valuation(2), b)).ceil() +- minimal_disc >>= 12 - b*k +- minimal_disc = ZZ(minimal_disc) ++ Pmin = R(res[2][0]) ++ Qmin = R(res[2][1]) ++ minimal_disc = ZZ(pari.hyperelldisc(res[2])) + + local_data = {} + for red in res[3]: +@@ -468,9 +450,7 @@ class Genus2reduction(SageObject): + + local_data[p] = data + +- prime_to_2_conductor_only = (-1 in res[1].component(2)) +- return ReductionData(res, P, Q, minimal_equation, minimal_disc, local_data, +- conductor, prime_to_2_conductor_only) ++ return ReductionData(res, P, Q, Pmin, Qmin, minimal_disc, local_data, conductor) + + def __reduce__(self): + return _reduce_load_genus2reduction, tuple([]) +diff --git a/src/sage/lfunctions/dokchitser.py b/src/sage/lfunctions/dokchitser.py +index fec450d7bc..236402c293 100644 +--- a/src/sage/lfunctions/dokchitser.py ++++ b/src/sage/lfunctions/dokchitser.py +@@ -337,6 +337,7 @@ class Dokchitser(SageObject): + # After init_coeffs is called, future calls to this method should + # return the full output for further parsing + raise RuntimeError("unable to create L-series, due to precision or other limits in PARI") ++ t = t.replace(" *** _^_: Warning: normalizing a series with 0 leading term.\n", "") + return t + + def __check_init(self): +diff --git a/src/sage/lfunctions/pari.py b/src/sage/lfunctions/pari.py +index da783d2831..ba93f7a480 100644 +--- a/src/sage/lfunctions/pari.py ++++ b/src/sage/lfunctions/pari.py +@@ -328,7 +328,7 @@ def lfun_eta_quotient(scalings, exponents): + 0.0374412812685155 + + sage: lfun_eta_quotient([6], [4]) +- [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4])]], 0, [0, 1], 2, 36, 1] ++ [[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4]), 0]], 0, [0, 1], 2, 36, 1] + + sage: lfun_eta_quotient([2, 1, 4], [5, -2, -2]) + Traceback (most recent call last): +diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py +index e5a2aa2517..0efcb15de0 100644 +--- a/src/sage/libs/pari/tests.py ++++ b/src/sage/libs/pari/tests.py +@@ -356,7 +356,7 @@ Constructors:: + [2, 4]~*x + [1, 3]~ + + sage: pari(3).Qfb(7, 1) +- Qfb(3, 7, 1, 0.E-19) ++ Qfb(3, 7, 1) + sage: pari(3).Qfb(7, 2) + Traceback (most recent call last): + ... +@@ -512,7 +512,7 @@ Basic functions:: + sage: pari('sqrt(-2)').frac() + Traceback (most recent call last): + ... +- PariError: incorrect type in gfloor (t_COMPLEX) ++ PariError: incorrect type in gfrac (t_COMPLEX) + + sage: pari('1+2*I').imag() + 2 +diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py +index 25d93cac92..157ebabe29 100644 +--- a/src/sage/modular/cusps_nf.py ++++ b/src/sage/modular/cusps_nf.py +@@ -1220,7 +1220,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, + ...] + + :: +diff --git a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +index a881336596..090d1bfaf0 100644 +--- a/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py ++++ b/src/sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +@@ -43,7 +43,7 @@ def coerce_AA(p): + sage: AA(p)._exact_field() + Number Field in a with defining polynomial y^8 ... with a in ... + sage: coerce_AA(p)._exact_field() +- Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in 39.710518724...? ++ Number Field in a with defining polynomial y^4 - 1910*y^2 - 3924*y + 681058 with a in ...? + """ + el = AA(p) + el.simplify() +diff --git a/src/sage/modular/modsym/p1list_nf.py b/src/sage/modular/modsym/p1list_nf.py +index 222caacca8..f9d969732c 100644 +--- a/src/sage/modular/modsym/p1list_nf.py ++++ b/src/sage/modular/modsym/p1list_nf.py +@@ -58,7 +58,7 @@ Lift an MSymbol to a matrix in `SL(2, R)`: + + sage: alpha = MSymbol(N, a + 2, 3*a^2) + sage: alpha.lift_to_sl2_Ok() +- [-3*a^2 + a + 12, 25*a^2 - 50*a + 100, a + 2, a^2 - 3*a + 3] ++ [-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3] + sage: Ok = k.ring_of_integers() + sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok()) + sage: det(M) +@@ -945,11 +945,11 @@ class P1NFList(SageObject): + 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]) +- 1 ++ 5 + + :: + +diff --git a/src/sage/modules/free_quadratic_module_integer_symmetric.py b/src/sage/modules/free_quadratic_module_integer_symmetric.py +index a206f0c721..aeb19ab669 100644 +--- a/src/sage/modules/free_quadratic_module_integer_symmetric.py ++++ b/src/sage/modules/free_quadratic_module_integer_symmetric.py +@@ -1168,11 +1168,11 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b + sage: A4 = IntegralLattice("A4") + sage: Aut = A4.orthogonal_group() + sage: Aut +- Group of isometries with 5 generators ( +- [-1 0 0 0] [0 0 0 1] [-1 -1 -1 0] [ 1 0 0 0] [ 1 0 0 0] +- [ 0 -1 0 0] [0 0 1 0] [ 0 0 0 -1] [-1 -1 -1 -1] [ 0 1 0 0] +- [ 0 0 -1 0] [0 1 0 0] [ 0 0 1 1] [ 0 0 0 1] [ 0 0 1 1] +- [ 0 0 0 -1], [1 0 0 0], [ 0 1 0 0], [ 0 0 1 0], [ 0 0 0 -1] ++ Group of isometries with 4 generators ( ++ [0 0 0 1] [-1 -1 -1 0] [ 1 0 0 0] [ 1 0 0 0] ++ [0 0 1 0] [ 0 0 0 -1] [-1 -1 -1 -1] [ 0 1 0 0] ++ [0 1 0 0] [ 0 0 1 1] [ 0 0 0 1] [ 0 0 1 1] ++ [1 0 0 0], [ 0 1 0 0], [ 0 0 1 0], [ 0 0 0 -1] + ) + + The group acts from the right on the lattice and its discriminant group:: +@@ -1180,19 +1180,19 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b + sage: x = A4.an_element() + sage: g = Aut.an_element() + sage: g +- [ 1 1 1 0] +- [ 0 0 -1 0] +- [ 0 0 1 1] +- [ 0 -1 -1 -1] ++ [-1 -1 -1 0] ++ [ 0 0 1 0] ++ [ 0 0 -1 -1] ++ [ 0 1 1 1] + sage: x*g +- (1, 1, 1, 0) ++ (-1, -1, -1, 0) + sage: (x*g).parent()==A4 + True + sage: (g*x).parent() + Vector space of dimension 4 over Rational Field + sage: y = A4.discriminant_group().an_element() + sage: y*g +- (1) ++ (4) + + If the group is finite we can compute the usual things:: + +@@ -1208,10 +1208,10 @@ class FreeQuadraticModule_integer_symmetric(FreeQuadraticModule_submodule_with_b + + sage: A2 = IntegralLattice(matrix.identity(3),Matrix(ZZ,2,3,[1,-1,0,0,1,-1])) + sage: A2.orthogonal_group() +- Group of isometries with 3 generators ( +- [-1/3 2/3 2/3] [ 2/3 2/3 -1/3] [1 0 0] +- [ 2/3 -1/3 2/3] [ 2/3 -1/3 2/3] [0 0 1] +- [ 2/3 2/3 -1/3], [-1/3 2/3 2/3], [0 1 0] ++ Group of isometries with 2 generators ( ++ [ 2/3 2/3 -1/3] [1 0 0] ++ [ 2/3 -1/3 2/3] [0 0 1] ++ [-1/3 2/3 2/3], [0 1 0] + ) + + It can be negative definite as well:: +diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py +index cfa3ada73e..5ac823bc6c 100755 +--- a/src/sage/quadratic_forms/binary_qf.py ++++ b/src/sage/quadratic_forms/binary_qf.py +@@ -141,7 +141,7 @@ class BinaryQF(SageObject): + and a.degree() == 2 and a.parent().ngens() == 2): + x, y = a.parent().gens() + a, b, c = [a.monomial_coefficient(mon) for mon in [x**2, x*y, y**2]] +- elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR'): ++ elif isinstance(a, pari_gen) and a.type() in ('t_QFI', 't_QFR', 't_QFB'): + # a has 3 or 4 components + a, b, c = a[0], a[1], a[2] + try: +diff --git a/src/sage/quadratic_forms/genera/genus.py b/src/sage/quadratic_forms/genera/genus.py +index 8290b6c4fa..0fc43f33c6 100644 +--- a/src/sage/quadratic_forms/genera/genus.py ++++ b/src/sage/quadratic_forms/genera/genus.py +@@ -3088,8 +3088,8 @@ class GenusSymbol_global_ring(): + sage: G = Genus(matrix(ZZ, 3, [6,3,0, 3,6,0, 0,0,2])) + sage: G.representatives() + ( +- [2 0 0] [ 2 -1 0] +- [0 6 3] [-1 2 0] ++ [2 0 0] [ 2 1 0] ++ [0 6 3] [ 1 2 0] + [0 3 6], [ 0 0 18] + ) + +diff --git a/src/sage/quadratic_forms/qfsolve.py b/src/sage/quadratic_forms/qfsolve.py +index ddde95e04f..d5e15d9f83 100644 +--- a/src/sage/quadratic_forms/qfsolve.py ++++ b/src/sage/quadratic_forms/qfsolve.py +@@ -70,7 +70,7 @@ def qfsolve(G): + + sage: M = Matrix(QQ, [[3, 0, 0, 0], [0, 5, 0, 0], [0, 0, -7, 0], [0, 0, 0, -11]]) + sage: qfsolve(M) +- (3, -4, -3, -2) ++ (3, 4, -3, -2) + """ + ret = G.__pari__().qfsolve() + if ret.type() == 't_COL': +diff --git a/src/sage/quadratic_forms/quadratic_form__automorphisms.py b/src/sage/quadratic_forms/quadratic_form__automorphisms.py +index c36c667e3b..3d72cf3be1 100644 +--- a/src/sage/quadratic_forms/quadratic_form__automorphisms.py ++++ b/src/sage/quadratic_forms/quadratic_form__automorphisms.py +@@ -300,9 +300,9 @@ def automorphism_group(self): + sage: Q = DiagonalQuadraticForm(ZZ, [1,1,1]) + sage: Q.automorphism_group() + Matrix group over Rational Field with 3 generators ( +- [-1 0 0] [0 0 1] [ 0 0 1] +- [ 0 -1 0] [0 1 0] [-1 0 0] +- [ 0 0 -1], [1 0 0], [ 0 1 0] ++ [ 0 0 1] [1 0 0] [ 1 0 0] ++ [-1 0 0] [0 0 1] [ 0 -1 0] ++ [ 0 1 0], [0 1 0], [ 0 0 1] + ) + + :: +diff --git a/src/sage/rings/finite_rings/finite_field_prime_modn.py b/src/sage/rings/finite_rings/finite_field_prime_modn.py +index f2a91186cd..6b0f0f990e 100644 +--- a/src/sage/rings/finite_rings/finite_field_prime_modn.py ++++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py +@@ -111,7 +111,7 @@ class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRin + sage: RF13 = K.residue_field(pp) + sage: RF13.hom([GF(13)(1)]) + Ring morphism: +- From: Residue field of Fractional ideal (w + 18) ++ From: Residue field of Fractional ideal (-w - 18) + To: Finite Field of size 13 + Defn: 1 |--> 1 + +diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx +index 7596f2a302..1e1869f1b1 100644 +--- a/src/sage/rings/finite_rings/residue_field.pyx ++++ b/src/sage/rings/finite_rings/residue_field.pyx +@@ -20,13 +20,13 @@ monogenic (i.e., 2 is an essential discriminant divisor):: + + 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) ++ 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) + 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`:: + +@@ -258,9 +258,9 @@ class ResidueFieldFactory(UniqueFactory): + the index of ``ZZ[a]`` in the maximal order for all ``a``:: + + sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8); P = K.ideal(2).factor()[0][0]; P +- Fractional ideal (1/2*a^2 - 1/2*a + 1) ++ Fractional ideal (-1/2*a^2 + 1/2*a - 1) + sage: F = K.residue_field(P); F +- Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1) ++ Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1) + sage: F(a) + 0 + sage: B = K.maximal_order().basis(); B +@@ -270,7 +270,7 @@ class ResidueFieldFactory(UniqueFactory): + sage: F(B[2]) + 0 + sage: F +- Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1) ++ Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1) + sage: F.degree() + 1 + +@@ -730,15 +730,15 @@ class ResidueField_generic(Field): + EXAMPLES:: + + sage: I = QQ[3^(1/3)].factor(5)[1][0]; I +- Fractional ideal (-a + 2) ++ Fractional ideal (a - 2) + sage: k = I.residue_field(); k +- Residue field of Fractional ideal (-a + 2) ++ Residue field of Fractional ideal (a - 2) + sage: f = k.lift_map(); f + Lifting map: +- From: Residue field of Fractional ideal (-a + 2) ++ From: Residue field of Fractional ideal (a - 2) + To: Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409? + sage: f.domain() +- Residue field of Fractional ideal (-a + 2) ++ Residue field of Fractional ideal (a - 2) + sage: f.codomain() + Maximal Order in Number Field in a with defining polynomial x^3 - 3 with a = 1.442249570307409? + sage: f(k.0) +@@ -768,7 +768,7 @@ class ResidueField_generic(Field): + + sage: K.<a> = NumberField(x^3-11) + sage: F = K.ideal(37).factor(); F +- (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (2*a - 5)) ++ (Fractional ideal (37, a + 9)) * (Fractional ideal (37, a + 12)) * (Fractional ideal (-2*a + 5)) + sage: k = K.residue_field(F[0][0]) + sage: l = K.residue_field(F[1][0]) + sage: k == l +@@ -846,7 +846,7 @@ cdef class ReductionMap(Map): + sage: F.reduction_map() + Partially defined reduction map: + From: Number Field in a with defining polynomial x^3 + x^2 - 2*x + 8 +- To: Residue field of Fractional ideal (1/2*a^2 - 1/2*a + 1) ++ To: Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1) + + sage: K.<theta_5> = CyclotomicField(5) + sage: F = K.factor(7)[0][0].residue_field() +diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py +index e99dff850f..759cbfb334 100644 +--- a/src/sage/rings/number_field/S_unit_solver.py ++++ b/src/sage/rings/number_field/S_unit_solver.py +@@ -1781,20 +1781,20 @@ def sieve_ordering(SUK, q): + sage: SUK = K.S_unit_group(S=3) + sage: sieve_data = list(sieve_ordering(SUK, 19)) + sage: sieve_data[0] +- (Fractional ideal (xi - 3), +- Fractional ideal (-2*xi^2 + 3), ++ (Fractional ideal (-2*xi^2 + 3), ++ Fractional ideal (-xi + 3), + Fractional ideal (2*xi + 1)) + + sage: sieve_data[1] +- (Residue field of Fractional ideal (xi - 3), +- Residue field of Fractional ideal (-2*xi^2 + 3), ++ (Residue field of Fractional ideal (-2*xi^2 + 3), ++ Residue field of Fractional ideal (-xi + 3), + Residue field of Fractional ideal (2*xi + 1)) + + sage: sieve_data[2] +- ([18, 7, 16, 4], [18, 9, 12, 8], [18, 3, 10, 10]) ++ ([18, 12, 16, 8], [18, 16, 10, 4], [18, 10, 12, 10]) + + sage: sieve_data[3] +- (486, 648, 11664) ++ (648, 2916, 3888) + """ + + K = SUK.number_field() +diff --git a/src/sage/rings/number_field/bdd_height.py b/src/sage/rings/number_field/bdd_height.py +index beb047ae02..b7c8c33d0b 100644 +--- a/src/sage/rings/number_field/bdd_height.py ++++ b/src/sage/rings/number_field/bdd_height.py +@@ -248,7 +248,7 @@ def bdd_norm_pr_ideal_gens(K, norm_list): + sage: from sage.rings.number_field.bdd_height import bdd_norm_pr_ideal_gens + sage: K.<g> = QuadraticField(123) + sage: bdd_norm_pr_ideal_gens(K, range(5)) +- {0: [0], 1: [1], 2: [-g - 11], 3: [], 4: [2]} ++ {0: [0], 1: [1], 2: [g + 11], 3: [], 4: [2]} + + :: + +diff --git a/src/sage/rings/number_field/class_group.py b/src/sage/rings/number_field/class_group.py +index da255ee6fa..46b98c242e 100644 +--- a/src/sage/rings/number_field/class_group.py ++++ b/src/sage/rings/number_field/class_group.py +@@ -221,11 +221,11 @@ class FractionalIdealClass(AbelianGroupWithValuesElement): + Class group of order 76 with structure C38 x C2 + of Number Field in a with defining polynomial x^2 + 20072 + sage: I = (G.0)^11; I +- Fractional ideal class (41, 1/2*a + 5) ++ Fractional ideal class (33, 1/2*a + 8) + sage: J = G(I.ideal()^5); J +- Fractional ideal class (115856201, 1/2*a + 40407883) ++ Fractional ideal class (39135393, 1/2*a + 13654253) + sage: J.reduce() +- Fractional ideal class (57, 1/2*a + 44) ++ Fractional ideal class (73, 1/2*a + 47) + sage: J == I^5 + True + """ +diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py +index 79acd053bb..e060148e4d 100644 +--- a/src/sage/rings/number_field/galois_group.py ++++ b/src/sage/rings/number_field/galois_group.py +@@ -944,7 +944,7 @@ class GaloisGroup_v2(GaloisGroup_perm): + sage: K.<b> = NumberField(x^4 - 2*x^2 + 2, 'a').galois_closure() + sage: G = K.galois_group() + sage: [G.artin_symbol(P) for P in K.primes_above(7)] +- [(1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8), (1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7)] ++ [(1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7), (1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8)] + sage: G.artin_symbol(17) + Traceback (most recent call last): + ... +diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py +index cfb71b38ab..ebf0dd4339 100644 +--- a/src/sage/rings/number_field/number_field.py ++++ b/src/sage/rings/number_field/number_field.py +@@ -3648,7 +3648,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + sage: L.<b> = K.extension(x^2 - 3, x^2 + 1) + sage: M.<c> = L.extension(x^2 + 1) + sage: L.ideal(K.ideal(2, a)) +- Fractional ideal (-a) ++ Fractional ideal (a) + sage: M.ideal(K.ideal(2, a)) == M.ideal(a*(b - c)/2) + True + +@@ -4232,7 +4232,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + (y^2 + 6, Mod(1/6*y, y^2 + 6), Mod(6*y, y^2 + 1/6)) + """ + f = self.absolute_polynomial()._pari_with_name('y') +- if f.pollead() == f.content().denominator() == 1: ++ f = f * f.content().denominator() ++ if f.pollead() == 1: + g = f + alpha = beta = g.variable().Mod(g) + else: +@@ -4826,7 +4827,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + + sage: K.<a> = NumberField(2*x^2 - 1/3) + sage: K._S_class_group_and_units(tuple(K.primes_above(2) + K.primes_above(3))) +- ([-6*a + 2, 6*a + 3, -1, 12*a + 5], []) ++ ([6*a + 2, 6*a + 3, -1, -12*a + 5], []) + """ + K_pari = self.pari_bnf(proof=proof) + S_pari = [p.pari_prime() for p in sorted(set(S))] +@@ -5171,7 +5172,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + + sage: [K.ideal(g).factor() for g in gens] + [(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)), +- Fractional ideal (-a), ++ Fractional ideal (a), + (Fractional ideal (2, a + 1))^2, + 1] + +@@ -5756,7 +5757,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + sage: K.elements_of_norm(3) + [] + sage: K.elements_of_norm(50) +- [-7*a + 1, 5*a - 5, 7*a + 1] ++ [-a - 7, 5*a - 5, 7*a + 1] + + TESTS: + +@@ -5868,7 +5869,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + sage: K.factor(1+a) + Fractional ideal (a + 1) + sage: K.factor(1+a/5) +- (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1 * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-3*a - 2)) ++ (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1 * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-2*a + 3)) + + An example over a relative number field:: + +@@ -6474,9 +6475,9 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + sage: new_basis = k.reduced_basis(prec=120) + sage: [c.minpoly() for c in new_basis] + [x - 1, +- x^2 - x + 1, ++ x^2 + x + 1, ++ x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657, + x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657, +- x^6 - 3*x^5 - 102*x^4 + 315*x^3 + 10254*x^2 - 80955*x + 198147, + x^3 - 171*x + 848, + x^6 + 171*x^4 + 1696*x^3 + 29241*x^2 + 145008*x + 719104] + sage: R = k.order(new_basis) +@@ -7072,7 +7073,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2, + -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4, + a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2, +- -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^3 - a^2 + 2*a - 2) ++ 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7) + + TESTS: + +@@ -7081,7 +7082,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + + sage: K.<a> = NumberField(1/2*x^2 - 1/6) + sage: K.units() +- (-3*a + 2,) ++ (3*a - 2,) + """ + proof = proof_flag(proof) + +@@ -7160,7 +7161,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField): + sage: U.gens() + (u0, u1, u2, u3, u4, u5, u6, u7, u8) + sage: U.gens_values() # result not independently verified +- [-1, -a^9 - a + 1, -a^16 + a^15 - a^14 + a^12 - a^11 + a^10 + a^8 - a^7 + 2*a^6 - a^4 + 3*a^3 - 2*a^2 + 2*a - 1, 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4, a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1, -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2, -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4, a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2, -a^14 - a^13 + a^12 + 2*a^10 + a^8 - 2*a^7 - 2*a^6 + 2*a^3 - a^2 + 2*a - 2] ++ [-1, -a^9 - a + 1, -a^16 + a^15 - a^14 + a^12 - a^11 + a^10 + a^8 - a^7 + 2*a^6 - a^4 + 3*a^3 - 2*a^2 + 2*a - 1, 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4, a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1, -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2, -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4, a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2, 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7] + """ + proof = proof_flag(proof) + +diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx +index 784c239dc1..aa740069dc 100644 +--- a/src/sage/rings/number_field/number_field_element.pyx ++++ b/src/sage/rings/number_field/number_field_element.pyx +@@ -4446,7 +4446,7 @@ cdef class NumberFieldElement(FieldElement): + sage: f = Qi.embeddings(K)[0] + sage: a = f(2+3*i) * (2-zeta)^2 + sage: a.descend_mod_power(Qi,2) +- [-3*i - 2, -2*i + 3] ++ [-2*i + 3, 3*i + 2] + + An absolute example:: + +@@ -5124,7 +5124,7 @@ cdef class NumberFieldElement_relative(NumberFieldElement): + EXAMPLES:: + + sage: K.<a, b, c> = NumberField([x^2 - 2, x^2 - 3, x^2 - 5]) +- sage: P = K.prime_factors(5)[0] ++ sage: P = K.prime_factors(5)[1] + sage: (2*a + b - c).valuation(P) + 1 + """ +diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py +index 5f587556a4..33481fead0 100644 +--- a/src/sage/rings/number_field/number_field_ideal.py ++++ b/src/sage/rings/number_field/number_field_ideal.py +@@ -3355,7 +3355,7 @@ def quotient_char_p(I, p): + [] + + sage: I = K.factor(13)[0][0]; I +- Fractional ideal (-3*i - 2) ++ Fractional ideal (-2*i + 3) + sage: I.residue_class_degree() + 1 + sage: quotient_char_p(I, 13)[0] +diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py +index bae36d4b9c..f64bd5b761 100644 +--- a/src/sage/rings/number_field/number_field_ideal_rel.py ++++ b/src/sage/rings/number_field/number_field_ideal_rel.py +@@ -272,7 +272,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): + sage: L.<b> = K.extension(5*x^2 + 1) + sage: P = L.primes_above(2)[0] + sage: P.gens_reduced() +- (2, 15*a*b + 3*a + 1) ++ (2, -15*a*b + 3*a + 1) + """ + try: + # Compute the single generator, if it exists +@@ -401,7 +401,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): + sage: L.<b> = K.extension(5*x^2 + 1) + sage: P = L.primes_above(2)[0] + sage: P.relative_norm() +- Fractional ideal (-6*a + 2) ++ Fractional ideal (6*a + 2) + """ + L = self.number_field() + K = L.base_field() +@@ -518,7 +518,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal): + sage: L.<b> = K.extension(5*x^2 + 1) + sage: P = L.primes_above(2)[0] + sage: P.ideal_below() +- Fractional ideal (-6*a + 2) ++ Fractional ideal (6*a + 2) + """ + L = self.number_field() + K = L.base_field() +diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py +index 9e80ef1e3c..dbabb18c50 100644 +--- a/src/sage/rings/number_field/number_field_rel.py ++++ b/src/sage/rings/number_field/number_field_rel.py +@@ -217,14 +217,14 @@ class NumberField_relative(NumberField_generic): + sage: l.<b> = k.extension(5*x^2 + 3); l + Number Field in b with defining polynomial 5*x^2 + 3 over its base field + sage: l.pari_rnf() +- [x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]] ++ [x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4), ..., y^4 + 6*y^2 + 1, x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4)], [0, 0]] + sage: b + b + + sage: l.<b> = k.extension(x^2 + 3/5); l + Number Field in b with defining polynomial x^2 + 3/5 over its base field + sage: l.pari_rnf() +- [x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4), ..., y^4 + 6*y^2 + 1, x^2 + (-1/2*y^2 + y - 3/2)*x + (-1/4*y^3 + 1/4*y^2 - 3/4*y - 13/4)], [0, 0]] ++ [x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4), ..., y^4 + 6*y^2 + 1, x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4)], [0, 0]] + sage: b + b + +diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py +index 6eca89ed8d..78ef4c3b33 100644 +--- a/src/sage/rings/number_field/order.py ++++ b/src/sage/rings/number_field/order.py +@@ -520,7 +520,7 @@ class Order(IntegralDomain, sage.rings.abc.Order): + 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 (11, a + 7) ++ Fractional ideal class (43, a + 13) + sage: Ok = k.maximal_order(); Ok + Maximal Order in Number Field in a with defining polynomial x^2 + 5077 + sage: Ok * (11, a + 7) +diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py +index c534aaa9f6..6bc67565d2 100644 +--- a/src/sage/rings/number_field/selmer_group.py ++++ b/src/sage/rings/number_field/selmer_group.py +@@ -491,7 +491,7 @@ 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 (a), + (Fractional ideal (2, a + 1))^2, + 1] + +diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py +index 93e4a74192..8658213658 100644 +--- a/src/sage/rings/polynomial/polynomial_quotient_ring.py ++++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py +@@ -1792,7 +1792,7 @@ class PolynomialQuotientRing_generic(CommutativeRing): + sage: D.selmer_generators([K.ideal(2, -a+1), K.ideal(3, a+1)], 3) + [2, a + 1] + 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)) +diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py +index 7b7c957fdf..0b416aca96 100644 +--- a/src/sage/rings/qqbar.py ++++ b/src/sage/rings/qqbar.py +@@ -312,8 +312,8 @@ and we get a way to produce the number directly:: + True + sage: sage_input(n) + R.<y> = QQ[] +- v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159))) +- -109*v^3 - 89*v^2 + 327*v + 178 ++ v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364))) ++ -109*v^3 + 89*v^2 + 327*v - 178 + + We can also see that some computations (basically, those which are + easy to perform exactly) are performed directly, instead of storing +@@ -362,7 +362,7 @@ algorithms in :trac:`10255`:: + # Verified + R1.<x> = QQbar[] + R2.<y> = QQ[] +- v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(RR(0.51763809020504148), RR(0.51763809020504159))) ++ v = AA.polynomial_root(AA.common_polynomial(y^4 - 4*y^2 + 1), RIF(-RR(1.9318516525781366), -RR(1.9318516525781364))) + AA.polynomial_root(AA.common_polynomial(x^4 + QQbar(v^3 - 3*v - 1)*x^3 + QQbar(-v^3 + 3*v - 3)*x^2 + QQbar(-3*v^3 + 9*v + 3)*x + QQbar(3*v^3 - 9*v)), RIF(RR(0.99999999999999989), RR(1.0000000000000002))) + sage: one + 1 +@@ -2310,7 +2310,7 @@ def do_polred(poly, threshold=32): + cost = 2 * bitsize.nbits() + 5 * poly.degree().nbits() + if cost > threshold: + return parent.gen(), parent.gen(), poly +- new_poly, elt_back = poly.__pari__().polredbest(flag=1) ++ new_poly, elt_back = poly.numerator().__pari__().polredbest(flag=1) + elt_fwd = elt_back.modreverse() + return parent(elt_fwd.lift()), parent(elt_back.lift()), parent(new_poly) + +@@ -2542,10 +2542,10 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal + Defn: a |--> 1.414213562373095?) + + sage: number_field_elements_from_algebraics((rt2,rt3)) +- (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, -a^2 + 2], Ring morphism: ++ (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, [-a^3 + 3*a, a^2 - 2], Ring morphism: + From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 + To: Algebraic Real Field +- Defn: a |--> 0.5176380902050415?) ++ Defn: a |--> -1.931851652578137?) + + ``rt3a`` is a real number in ``QQbar``. Ordinarily, we'd get a homomorphism + to ``AA`` (because all elements are real), but if we specify ``same_field=True``, +@@ -2570,7 +2570,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal + (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^3 + 3*a, Ring morphism: + From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 + To: Algebraic Real Field +- Defn: a |--> 0.5176380902050415?) ++ Defn: a |--> -1.931851652578137?) + + We can specify ``minimal=True`` if we want the smallest number field:: + +@@ -2618,7 +2618,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal + sage: nfI^2 + -1 + sage: sum = nfrt2 + nfrt3 + nfI + nfz3; sum +- 2*a^6 + a^5 - a^4 - a^3 - 2*a^2 - a ++ a^5 + a^4 - a^3 + 2*a^2 - a - 1 + sage: hom(sum) + 2.646264369941973? + 1.866025403784439?*I + sage: hom(sum) == rt2 + rt3 + qqI + z3 +@@ -2658,7 +2658,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal + sage: nf, nums, hom = number_field_elements_from_algebraics(elems, embedded=True) + sage: nf + Number Field in a with defining polynomial y^24 - 6*y^23 ...- 9*y^2 + 1 +- with a = 0.2598678911433438? + 0.0572892247058457?*I ++ with a = 0.2598679? + 0.0572892?*I + sage: list(map(QQbar, nums)) == elems == list(map(hom, nums)) + True + +@@ -2725,7 +2725,7 @@ def number_field_elements_from_algebraics(numbers, minimal=False, same_field=Fal + sqrt(2), AA.polynomial_root(x^3-3, RIF(0,3)), 11/9, 1] + sage: res = number_field_elements_from_algebraics(my_nums, embedded=True) + sage: res[0] +- Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = -95.5053039433554? ++ Number Field in a with defining polynomial y^24 - 107010*y^22 - 24*y^21 + ... + 250678447193040618624307096815048024318853254384 with a = 93.32530798172420? + """ + gen = qq_generator + +@@ -3129,7 +3129,7 @@ class AlgebraicGenerator(SageObject): + sage: root = ANRoot(x^2 - x - 1, RIF(1, 2)) + sage: gen = AlgebraicGenerator(nf, root) + sage: gen.pari_field() +- [y^2 - y - 1, [2, 0], ...] ++ [[y^2 - y - 1, [2, 0], ...] + """ + if self.is_trivial(): + raise ValueError("No PARI field attached to trivial generator") +@@ -3213,7 +3213,7 @@ class AlgebraicGenerator(SageObject): + sage: qq_generator.union(gen3) is gen3 + True + sage: gen2.union(gen3) +- Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415? ++ Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137? + """ + if self._trivial: + return other +@@ -3306,13 +3306,13 @@ class AlgebraicGenerator(SageObject): + Number Field in a with defining polynomial y^2 - 3 with a in 1.732050807568878? + sage: gen2_3 = gen2.union(gen3) + sage: gen2_3 +- Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415? ++ Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137? + sage: qq_generator.super_poly(gen2) is None + True + sage: gen2.super_poly(gen2_3) + -a^3 + 3*a + sage: gen3.super_poly(gen2_3) +- -a^2 + 2 ++ a^2 - 2 + + """ + if checked is None: +@@ -3360,13 +3360,13 @@ class AlgebraicGenerator(SageObject): + sage: sqrt3 = ANExtensionElement(gen3, nf3.gen()) + sage: gen2_3 = gen2.union(gen3) + sage: gen2_3 +- Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 0.5176380902050415? ++ Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -1.931851652578137? + sage: gen2_3(sqrt2) + -a^3 + 3*a + sage: gen2_3(ANRational(1/7)) + 1/7 + sage: gen2_3(sqrt3) +- -a^2 + 2 ++ a^2 - 2 + """ + if self._trivial: + return elt._value +@@ -4336,10 +4336,10 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement): + sage: rt3 = AA(sqrt(3)) + sage: rt3b = rt2 + rt3 - rt2 + sage: rt3b.as_number_field_element() +- (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, -a^2 + 2, Ring morphism: ++ (Number Field in a with defining polynomial y^4 - 4*y^2 + 1, a^2 - 2, Ring morphism: + From: Number Field in a with defining polynomial y^4 - 4*y^2 + 1 + To: Algebraic Real Field +- Defn: a |--> 0.5176380902050415?) ++ Defn: a |--> -1.931851652578137?) + sage: rt3b.as_number_field_element(minimal=True) + (Number Field in a with defining polynomial y^2 - 3, a, Ring morphism: + From: Number Field in a with defining polynomial y^2 - 3 +@@ -4401,7 +4401,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement): + sage: rt2b = rt3 + rt2 - rt3 + sage: rt2b.exactify() + sage: rt2b._exact_value() +- a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137? ++ a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415? + sage: rt2b.simplify() + sage: rt2b._exact_value() + a where a^2 - 2 = 0 and a in 1.414213562373095? +@@ -4422,7 +4422,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement): + sage: QQbar(2)._exact_field() + Trivial generator + sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_field() +- Number Field in a with defining polynomial y^4 - 20*y^2 + 81 with a in 2.375100220297941? ++ Number Field in a with defining polynomial y^4 - 20*y^2 + 81 with a in -3.789313782671036? + sage: (QQbar(7)^(3/5))._exact_field() + Number Field in a with defining polynomial y^5 - 2*y^4 - 18*y^3 + 38*y^2 + 82*y - 181 with a in 2.554256611698490? + """ +@@ -4442,7 +4442,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement): + sage: QQbar(2)._exact_value() + 2 + sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_value() +- -1/9*a^3 - a^2 + 11/9*a + 10 where a^4 - 20*a^2 + 81 = 0 and a in 2.375100220297941? ++ -1/9*a^3 + a^2 + 11/9*a - 10 where a^4 - 20*a^2 + 81 = 0 and a in -3.789313782671036? + sage: (QQbar(7)^(3/5))._exact_value() + 2*a^4 + 2*a^3 - 34*a^2 - 17*a + 150 where a^5 - 2*a^4 - 18*a^3 + 38*a^2 + 82*a - 181 = 0 and a in 2.554256611698490? + """ +@@ -6885,7 +6885,7 @@ class AlgebraicPolynomialTracker(SageObject): + sage: p = sqrt(AA(2)) * x^2 - sqrt(AA(3)) + sage: cp = AA.common_polynomial(p) + sage: cp.generator() +- Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 1.931851652578137? ++ Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in -0.5176380902050415? + """ + self.exactify() + return self._gen +@@ -7734,7 +7734,7 @@ class ANExtensionElement(ANDescr): + + sage: rt2b.exactify() + sage: rt2b._descr +- a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137? ++ a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415? + sage: rt2b._descr.is_simple() + False + """ +@@ -7819,7 +7819,7 @@ class ANExtensionElement(ANDescr): + sage: rt2b = rt3 + rt2 - rt3 + sage: rt2b.exactify() + sage: rt2b._descr +- a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in 1.931851652578137? ++ a^3 - 3*a where a^4 - 4*a^2 + 1 = 0 and a in -0.5176380902050415? + sage: rt2b._descr.simplify(rt2b) + a where a^2 - 2 = 0 and a in 1.414213562373095? + """ +@@ -7858,9 +7858,9 @@ class ANExtensionElement(ANDescr): + sage: type(b) + <class 'sage.rings.qqbar.ANExtensionElement'> + sage: b.neg(a) +- 1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I ++ -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I + sage: b.neg("ham spam and eggs") +- 1/3*a^3 - 2/3*a^2 + 4/3*a - 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I ++ -1/3*a^3 + 1/3*a^2 - a - 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I + """ + return ANExtensionElement(self._generator, -self._value) + +@@ -7876,9 +7876,9 @@ class ANExtensionElement(ANDescr): + sage: type(b) + <class 'sage.rings.qqbar.ANExtensionElement'> + sage: b.invert(a) +- 7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I ++ -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I + sage: b.invert("ham spam and eggs") +- 7/3*a^3 - 2/3*a^2 + 4/3*a - 12 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? - 1.573132184970987?*I ++ -7/3*a^3 + 19/3*a^2 - 7*a - 9 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? + 1.573132184970987?*I + """ + return ANExtensionElement(self._generator, ~self._value) + +@@ -7894,9 +7894,9 @@ class ANExtensionElement(ANDescr): + sage: type(b) + <class 'sage.rings.qqbar.ANExtensionElement'> + sage: b.conjugate(a) +- -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I ++ 1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I + sage: b.conjugate("ham spam and eggs") +- -1/3*a^3 + 2/3*a^2 - 4/3*a + 2 where a^4 - 2*a^3 + a^2 - 6*a + 9 = 0 and a in -0.7247448713915890? + 1.573132184970987?*I ++ 1/3*a^3 - 1/3*a^2 + a + 1 where a^4 - 2*a^3 + a^2 + 6*a + 3 = 0 and a in 1.724744871391589? - 1.573132184970987?*I + """ + if self._exactly_real: + return self +@@ -8529,7 +8529,7 @@ def an_binop_expr(a, b, op): + sage: x = an_binop_expr(a, b, operator.add); x + <sage.rings.qqbar.ANBinaryExpr object at ...> + sage: x.exactify() +- -6/7*a^7 + 2/7*a^6 + 71/7*a^5 - 26/7*a^4 - 125/7*a^3 + 72/7*a^2 + 43/7*a - 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.12580...? ++ 6/7*a^7 - 2/7*a^6 - 71/7*a^5 + 26/7*a^4 + 125/7*a^3 - 72/7*a^2 - 43/7*a + 47/7 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997? + + sage: a = QQbar(sqrt(2)) + QQbar(sqrt(3)) + sage: b = QQbar(sqrt(3)) + QQbar(sqrt(5)) +@@ -8538,7 +8538,7 @@ def an_binop_expr(a, b, op): + sage: x = an_binop_expr(a, b, operator.mul); x + <sage.rings.qqbar.ANBinaryExpr object at ...> + sage: x.exactify() +- 2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in 3.1258...? ++ 2*a^7 - a^6 - 24*a^5 + 12*a^4 + 46*a^3 - 22*a^2 - 22*a + 9 where a^8 - 12*a^6 + 23*a^4 - 12*a^2 + 1 = 0 and a in -0.3199179336182997? + """ + return ANBinaryExpr(a, b, op) + +diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py +index 1c4f2dff18..32c2e47e49 100644 +--- a/src/sage/schemes/affine/affine_morphism.py ++++ b/src/sage/schemes/affine/affine_morphism.py +@@ -1148,9 +1148,9 @@ class SchemeMorphism_polynomial_affine_space_field(SchemeMorphism_polynomial_aff + sage: H = End(A) + sage: f = H([(QQbar(sqrt(2))*x^2 + 1/QQbar(sqrt(3))) / (5*x)]) + sage: f.reduce_base_field() +- Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = 1.931851652578137? ++ Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a = ...? + Defn: Defined on coordinates by sending (x) to +- (((a^3 - 3*a)*x^2 + (1/3*a^2 - 2/3))/(5*x)) ++ (((a^3 - 3*a)*x^2 + (-1/3*a^2 + 2/3))/(5*x)) + + :: + +diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py +index 6b64df4d07..aaec89ff34 100644 +--- a/src/sage/schemes/elliptic_curves/ell_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_field.py +@@ -845,7 +845,7 @@ class EllipticCurve_field(ell_generic.EllipticCurve_generic, ProjectivePlaneCurv + sage: E = E.base_extend(G).quadratic_twist(c); E + Elliptic Curve defined by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000) over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9 + sage: K.<b> = E.division_field(3, simplify_all=True); K +- Number Field in b with defining polynomial x^12 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025 ++ Number Field in b with defining polynomial x^12 + 5*x^10 + 40*x^8 + 315*x^6 + 750*x^4 + 675*x^2 + 2025 + + Some higher-degree examples:: + +diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py +index 926ae310ea..3bae819fb0 100644 +--- a/src/sage/schemes/elliptic_curves/ell_generic.py ++++ b/src/sage/schemes/elliptic_curves/ell_generic.py +@@ -3324,8 +3324,8 @@ class EllipticCurve_generic(WithEqualityById, plane_curve.ProjectivePlaneCurve): + sage: K.<a> = QuadraticField(2) + sage: E = EllipticCurve([1,a]) + sage: E.pari_curve() +- [Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(0, y^2 - 2), Mod(1, y^2 - 2), +- Mod(y, y^2 - 2), Mod(0, y^2 - 2), Mod(2, y^2 - 2), Mod(4*y, y^2 - 2), ++ [0, 0, 0, Mod(1, y^2 - 2), ++ Mod(y, y^2 - 2), 0, Mod(2, y^2 - 2), Mod(4*y, y^2 - 2), + Mod(-1, y^2 - 2), Mod(-48, y^2 - 2), Mod(-864*y, y^2 - 2), + Mod(-928, y^2 - 2), Mod(3456/29, y^2 - 2), Vecsmall([5]), + [[y^2 - 2, [2, 0], 8, 1, [[1, -1.41421356237310; +diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py +index edbd196090..c44c803aa8 100644 +--- a/src/sage/schemes/elliptic_curves/ell_number_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_number_field.py +@@ -218,7 +218,7 @@ class EllipticCurve_number_field(EllipticCurve_field): + sage: E == loads(dumps(E)) + True + sage: E.simon_two_descent() +- (2, 2, [(0 : 0 : 1)]) ++ (2, 2, [(0 : 0 : 1), (1/18*a + 7/18 : -5/54*a - 17/54 : 1)]) + sage: E.simon_two_descent(lim1=5, lim3=5, limtriv=10, maxprob=7, limbigprime=10) + (2, 2, [(-1 : 0 : 1), (-2 : -1/2*a - 1/2 : 1)]) + +@@ -274,7 +274,7 @@ class EllipticCurve_number_field(EllipticCurve_field): + sage: E.simon_two_descent() # long time (4s on sage.math, 2013) + (3, + 3, +- [(5/8*zeta43_0^2 + 17/8*zeta43_0 - 9/4 : -27/16*zeta43_0^2 - 103/16*zeta43_0 + 39/8 : 1), ++ [(1/8*zeta43_0^2 - 3/8*zeta43_0 - 1/4 : -5/16*zeta43_0^2 + 7/16*zeta43_0 + 1/8 : 1), + (0 : 0 : 1)]) + """ + verbose = int(verbose) +@@ -865,7 +865,7 @@ class EllipticCurve_number_field(EllipticCurve_field): + Conductor exponent: 1 + Kodaira Symbol: I1 + Tamagawa Number: 1, +- Local data at Fractional ideal (-3*i - 2): ++ Local data at Fractional ideal (-2*i + 3): + Reduction type: bad split multiplicative + Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1 + Minimal discriminant valuation: 2 +@@ -2645,12 +2645,12 @@ class EllipticCurve_number_field(EllipticCurve_field): + [-92, -23, -23] + + sage: C.matrix() # long time +- [1 2 2 4 2 4] +- [2 1 2 2 4 4] +- [2 2 1 4 4 2] +- [4 2 4 1 3 3] +- [2 4 4 3 1 3] +- [4 4 2 3 3 1] ++ [1 2 2 4 4 2] ++ [2 1 2 4 2 4] ++ [2 2 1 2 4 4] ++ [4 4 2 1 3 3] ++ [4 2 4 3 1 3] ++ [2 4 4 3 3 1] + + The graph of this isogeny class has a shape which does not + occur over `\QQ`: a triangular prism. Note that for curves +@@ -2677,12 +2677,12 @@ class EllipticCurve_number_field(EllipticCurve_field): + + sage: G = C.graph() # long time + sage: G.adjacency_matrix() # long time +- [0 1 1 0 1 0] +- [1 0 1 1 0 0] +- [1 1 0 0 0 1] +- [0 1 0 0 1 1] +- [1 0 0 1 0 1] +- [0 0 1 1 1 0] ++ [0 1 1 0 0 1] ++ [1 0 1 0 1 0] ++ [1 1 0 1 0 0] ++ [0 0 1 0 1 1] ++ [0 1 0 1 0 1] ++ [1 0 0 1 1 0] + + To display the graph without any edge labels:: + +@@ -3316,7 +3316,7 @@ class EllipticCurve_number_field(EllipticCurve_field): + sage: points = [E.lift_x(x) for x in xi] + sage: newpoints, U = E.lll_reduce(points) # long time (35s on sage.math, 2011) + sage: [P[0] for P in newpoints] # long time +- [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 175620639884534615751/25, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7404442636649562303, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297] ++ [6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 11465667352242779838, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7041412654828066743, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297] + + An example to show the explicit use of the height pairing matrix:: + +diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py +index fc54013b7b..94143ad2d6 100644 +--- a/src/sage/schemes/elliptic_curves/ell_rational_field.py ++++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py +@@ -1827,7 +1827,7 @@ class EllipticCurve_rational_field(EllipticCurve_number_field): + sage: E = EllipticCurve('389a1') + sage: E._known_points = [] # clear cached points + sage: E.simon_two_descent() +- (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)]) ++ (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) + sage: E = EllipticCurve('5077a1') + sage: E.simon_two_descent() + (3, 3, [(1 : 0 : 1), (2 : 0 : 1), (0 : 2 : 1)]) +diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +index 81ad295160..d484a4a18b 100644 +--- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py ++++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py +@@ -780,12 +780,12 @@ def deg_one_primes_iter(K, principal_only=False): + [Fractional ideal (2, a + 1), + Fractional ideal (3, a + 1), + Fractional ideal (3, a + 2), +- Fractional ideal (-a), ++ Fractional ideal (a), + Fractional ideal (7, a + 3), + Fractional ideal (7, a + 4)] + sage: it = deg_one_primes_iter(K, True) + sage: [next(it) for _ in range(6)] +- [Fractional ideal (-a), ++ [Fractional ideal (a), + Fractional ideal (-2*a + 3), + Fractional ideal (2*a + 3), + Fractional ideal (a + 6), +diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py +index 28b97f34af..9f7d1b6020 100644 +--- a/src/sage/schemes/elliptic_curves/gp_simon.py ++++ b/src/sage/schemes/elliptic_curves/gp_simon.py +@@ -56,7 +56,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, + sage: import sage.schemes.elliptic_curves.gp_simon + sage: E=EllipticCurve('389a1') + sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E) +- (2, 2, [(1 : 0 : 1), (-11/9 : 28/27 : 1)]) ++ (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)]) + + TESTS:: + +@@ -117,7 +117,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, + # The block below mimics the defaults in Simon's scripts, and needs to be changed + # when these are updated. + if K is QQ: +- cmd = 'ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points]) ++ cmd = 'ellQ_ellrank(%s, %s);' % (list(E.ainvs()), [P.__pari__() for P in known_points]) + if lim1 is None: + lim1 = 5 + if lim3 is None: +@@ -144,7 +144,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None, + if verbose > 0: + print(s) + v = gp.eval('ans') +- if v=='ans': # then the call to ellrank() or bnfellrank() failed ++ if v=='ans': # then the call to ellQ_ellrank() or bnfellrank() failed + raise RuntimeError("An error occurred while running Simon's 2-descent program") + if verbose >= 2: + print("v = %s" % v) +diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +index a936deb74f..dc19254d8c 100644 +--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py ++++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py +@@ -1208,14 +1208,14 @@ def isogenies_13_0(E, minimal_models=True): + sage: [phi.codomain().ainvs() for phi in isogenies_13_0(E)] # long time (4s) + [(0, + 0, +- 20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645, ++ 20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705, + -139861295/2650795873449984*a^11 - 3455957/5664093746688*a^10 - 345310571/50976843720192*a^9 - 500530795/118001953056*a^8 - 12860048113/265504394376*a^7 - 25007420461/44250732396*a^6 + 458134176455/1416023436672*a^5 + 16701880631/9077073312*a^4 + 155941666417/9077073312*a^3 + 3499310115/378211388*a^2 - 736774863/94552847*a - 21954102381/94552847, +- 579363345221/13763747804451840*a^11 + 371192377511/860234237778240*a^10 + 8855090365657/1146978983704320*a^9 + 5367261541663/1633873196160*a^8 + 614883554332193/15930263662560*a^7 + 30485197378483/68078049840*a^6 - 131000897588387/2450809794240*a^5 - 203628705777949/306351224280*a^4 - 1587619388190379/204234149520*a^3 + 14435069706551/11346341640*a^2 + 7537273048614/472764235*a + 89198980034806/472764235), ++ 8342795944891/198197968384106496*a^11 + 8908625263589/20645621706677760*a^10 + 53130542636623/6881873902225920*a^9 + 376780111042213/114697898370432*a^8 + 614884052146333/15930263662560*a^7 + 3566768133324359/7965131831280*a^6 - 1885593809102545/35291661037056*a^5 - 2443732172026523/3676214691360*a^4 - 9525729503937541/1225404897120*a^3 + 51990274442321/40846829904*a^2 + 67834019370596/4254878115*a + 267603083706812/1418292705), + (0, + 0, +- 20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 - 101/8789110986240*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 - 19487/21127670640*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 + 8349/521670880*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 58759402/48906645, ++ 20360599/165164973653422080*a^11 - 3643073/41291243413355520*a^10 + 1887439/1146978983704320*a^9 + 5557619461/573489491852160*a^8 - 82824971/11947697746920*a^7 + 1030632647/7965131831280*a^6 - 475752603733/29409717530880*a^5 + 87205112531/7352429382720*a^4 - 43618899433/204234149520*a^3 + 5858744881/12764634345*a^2 - 1858703809/2836585410*a + 2535050171/1418292705, + -6465569317/1325397936724992*a^11 - 112132307/1960647835392*a^10 - 17075412917/25488421860096*a^9 - 207832519229/531008788752*a^8 - 1218275067617/265504394376*a^7 - 9513766502551/177002929584*a^6 + 4297077855437/708011718336*a^5 + 354485975837/4538536656*a^4 + 4199379308059/4538536656*a^3 - 30841577919/189105694*a^2 - 181916484042/94552847*a - 2135779171614/94552847, +- -132601797212627/3440936951112960*a^11 - 6212467020502021/13763747804451840*a^10 - 1515926454902497/286744745926080*a^9 - 15154913741799637/4901619588480*a^8 - 576888119803859263/15930263662560*a^7 - 86626751639648671/204234149520*a^6 + 16436657569218427/306351224280*a^5 + 1540027900265659087/2450809794240*a^4 + 375782662805915809/51058537380*a^3 - 14831920924677883/11346341640*a^2 - 7237947774817724/472764235*a - 84773764066089509/472764235)] ++ -1316873026840277/34172063514501120*a^11 - 18637401045099413/41291243413355520*a^10 - 36382234917217247/6881873902225920*a^9 - 61142238484016213/19775499719040*a^8 - 576888119306045123/15930263662560*a^7 - 3378443313906256321/7965131831280*a^6 + 326466167429333279/6084769144320*a^5 + 4620083325391594991/7352429382720*a^4 + 9018783894167184149/1225404897120*a^3 - 9206015742300283/7042556880*a^2 - 65141531411426446/4254878115*a - 254321286054666133/1418292705)] + """ + if E.j_invariant()!=0: + raise ValueError("j-invariant must be 0.") |