diff --git a/build/pkgs/pari/checksums.ini b/build/pkgs/pari/checksums.ini index ccbfa9e208c..19999aceb9c 100644 --- a/build/pkgs/pari/checksums.ini +++ b/build/pkgs/pari/checksums.ini @@ -1,4 +1,4 @@ tarball=pari-VERSION.tar.gz -sha1=a936e0ed661c8e453578f3c129c3a454e2039e3e -md5=59f2e4c3c51f7652182400489cd76e6a -cksum=1366291737 +sha1=efd1eb6b8d87066b2b9f3b2c38ecb30bbfdb48d2 +md5=f3f3342913a3b3b306970b3462f4d47d +cksum=1553747906 diff --git a/build/pkgs/pari/package-version.txt b/build/pkgs/pari/package-version.txt index f9e24123df3..4a4ef6b5825 100644 --- a/build/pkgs/pari/package-version.txt +++ b/build/pkgs/pari/package-version.txt @@ -1 +1 @@ -2.8-2771-gb70b447.p0 +2.8.0.alpha.p0 diff --git a/src/sage/libs/pari/paridecl.pxd b/src/sage/libs/pari/paridecl.pxd index c93a6467bc2..c236c6aa4b5 100644 --- a/src/sage/libs/pari/paridecl.pxd +++ b/src/sage/libs/pari/paridecl.pxd @@ -2594,7 +2594,7 @@ cdef extern from "sage/libs/pari/parisage.h": GEN ellrandom(GEN e) long ellrootno(GEN e, GEN p) long ellrootno_global(GEN e) - GEN ellsea(GEN E, GEN p, long early_abort) + GEN ellsea(GEN E, ulong smallfact) GEN ellsigma(GEN om, GEN z, long flag, long prec) GEN ellsub(GEN e, GEN z1, GEN z2) GEN elltaniyama(GEN e, long prec) @@ -3014,10 +3014,11 @@ cdef extern from "sage/libs/pari/parisage.h": GEN padic_to_Q_shallow(GEN x) GEN QpV_to_QV(GEN v) GEN RgM_mulreal(GEN x, GEN y) - GEN RgX_RgM_eval_col(GEN x, GEN M, long c) GEN RgX_cxeval(GEN T, GEN u, GEN ui) GEN RgX_deflate_max(GEN x0, long *m) long RgX_deflate_order(GEN x) + long ZX_deflate_order(GEN x) + GEN ZX_deflate_max(GEN x, long *m) long RgX_degree(GEN x, long v) GEN RgX_integ(GEN x) GEN bitprecision0(GEN x, long n) @@ -3056,6 +3057,7 @@ cdef extern from "sage/libs/pari/parisage.h": GEN ggrando(GEN x, long n) GEN ggt(GEN x, GEN y) GEN gimag(GEN x) + GEN gisexactzero(GEN g) GEN gle(GEN x, GEN y) GEN glt(GEN x, GEN y) GEN gmod(GEN x, GEN y) @@ -3067,8 +3069,10 @@ cdef extern from "sage/libs/pari/parisage.h": GEN gne(GEN x, GEN y) GEN gnot(GEN x) GEN gpolvar(GEN y) + GEN gppadicprec(GEN x, GEN p) GEN gppoldegree(GEN x, long v) long gprecision(GEN x) + GEN gpserprec(GEN x, long v) GEN greal(GEN x) GEN grndtoi(GEN x, long *e) GEN ground(GEN x) @@ -3096,6 +3100,7 @@ cdef extern from "sage/libs/pari/parisage.h": GEN imag_i(GEN x) GEN integ(GEN x, long v) GEN integser(GEN x) + GEN inv_ser(GEN b) int iscomplex(GEN x) int isexactzero(GEN g) int isrationalzeroscalar(GEN g) @@ -3142,7 +3147,9 @@ cdef extern from "sage/libs/pari/parisage.h": GEN scalarpol_shallow(GEN x, long v) GEN scalarser(GEN x, long v, long prec) GEN ser_unscale(GEN P, GEN h) + long serprec(GEN x, long v) GEN serreverse(GEN x) + GEN sertoser(GEN x, long prec) GEN simplify(GEN x) GEN simplify_shallow(GEN x) GEN tayl(GEN x, long v, long precdl) @@ -3427,7 +3434,7 @@ cdef extern from "sage/libs/pari/parisage.h": GEN lfunlambda0(GEN ldata, GEN s, long der, long bitprec) GEN lfunmisc_to_ldata(GEN ldata) GEN lfunmisc_to_ldata_shallow(GEN ldata) - long lfunorderzero(GEN ldata, long bitprec) + long lfunorderzero(GEN ldata, long m, long bitprec) GEN lfunprod_get_fact(GEN tech) GEN lfunrootno(GEN data, long bitprec) GEN lfunrootres(GEN data, long bitprec) @@ -3460,7 +3467,7 @@ cdef extern from "sage/libs/pari/parisage.h": GEN lfunmfspec(GEN lmisc, long bitprec) GEN lfunmfpeters(GEN ldata, long bitprec) GEN lfunmul(GEN ldata1, GEN ldata2, long bitprec) - GEN lfunqf(GEN ldata) + GEN lfunqf(GEN ldata, long prec) GEN lfunsymsq(GEN ldata, GEN known, long prec) GEN lfunsymsqspec(GEN lmisc, long bitprec) GEN lfunzetakinit(GEN pol, GEN dom, long der, long flag, long bitprec) diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py index 6d4b6e145f2..281506d855f 100644 --- a/src/sage/libs/pari/tests.py +++ b/src/sage/libs/pari/tests.py @@ -1167,13 +1167,13 @@ [0, 1, [1, 0, 0, 0], 1] sage: e = pari(EllipticCurve('27a3').a_invariants()).ellinit() sage: e.elllocalred(3) - [3, 2, [1, -1, 0, 1], 1] + [3, 2, [1, 0, 0, 0], 1] sage: e = pari(EllipticCurve('24a4').a_invariants()).ellinit() sage: e.elllocalred(2) - [3, 3, [1, 1, 0, 1], 2] + [3, 3, [1, 0, 0, 0], 2] sage: e = pari(EllipticCurve('20a2').a_invariants()).ellinit() sage: e.elllocalred(2) - [2, 4, [1, 1, 0, 1], 3] + [2, 4, [1, 0, 0, 0], 3] sage: e = pari(EllipticCurve('11a2').a_invariants()).ellinit() sage: e.elllocalred(11) [1, 5, [1, 0, 0, 0], 1] @@ -1185,22 +1185,22 @@ [1, 10, [1, 0, 0, 0], 2] sage: e = pari(EllipticCurve('32a3').a_invariants()).ellinit() sage: e.elllocalred(2) - [5, -1, [1, 1, 1, 0], 1] + [5, -1, [1, 0, 0, 0], 1] sage: e = pari(EllipticCurve('24a5').a_invariants()).ellinit() sage: e.elllocalred(2) - [3, -2, [1, 2, 1, 4], 1] + [3, -2, [1, 0, 0, 0], 1] sage: e = pari(EllipticCurve('24a2').a_invariants()).ellinit() sage: e.elllocalred(2) - [3, -3, [1, 2, 1, 4], 2] + [3, -3, [1, 0, 0, 0], 2] sage: e = pari(EllipticCurve('20a1').a_invariants()).ellinit() sage: e.elllocalred(2) - [2, -4, [1, 0, 1, 2], 3] + [2, -4, [1, 0, 0, 0], 3] sage: e = pari(EllipticCurve('24a1').a_invariants()).ellinit() sage: e.elllocalred(2) - [3, -5, [1, 0, 1, 2], 4] + [3, -5, [1, 0, 0, 0], 4] sage: e = pari(EllipticCurve('90c2').a_invariants()).ellinit() sage: e.elllocalred(3) - [2, -10, [1, 96, 1, 316], 4] + [2, -10, [1, 0, 0, 0], 4] sage: e = pari([0,1,1,-2,0]).ellinit() sage: e.elllseries(2.1) diff --git a/src/sage_setup/autogen/pari/doc.py b/src/sage_setup/autogen/pari/doc.py index 59e2635e62f..46f6166b0ad 100644 --- a/src/sage_setup/autogen/pari/doc.py +++ b/src/sage_setup/autogen/pari/doc.py @@ -9,7 +9,8 @@ from six import unichr -leading_ws = re.compile("^ +", re.MULTILINE) +leading_ws = re.compile("^( +)", re.MULTILINE) +trailing_ws = re.compile("( +)$", re.MULTILINE) double_space = re.compile(" +") end_space = re.compile(r"(@\[end[a-z]*\])([A-Za-z])") @@ -37,7 +38,8 @@ escape_percent = re.compile(r"^(\S.*)[%]", re.MULTILINE) escape_hash = re.compile(r"^(\S.*)[#]", re.MULTILINE) -label_link = re.compile(r"(Section *)?\[@\[startbold\]Label: *(se:)?([^@]*)@\[endbold\]\]") +label_define = re.compile(r"@\[label [a-zA-Z0-9:]*\]") +label_ref = re.compile(r"(Section *)?@\[startref\](se:)?([^@]*)@\[endref\]") def sub_loop(regex, repl, text): @@ -92,6 +94,10 @@ def raw_to_rest(doc): Traceback (most recent call last): ... SyntaxError: @ found: @[invalid] + + sage: s = '@3@[startbold]*@[endbold] snip @[dollar]0@[dollar]\ndividing @[dollar]#E@[dollar].' + sage: raw_to_rest(s) + u'- snip :math:`0`\n dividing :math:`\\#E`.' """ doc = doc.decode("utf-8") @@ -113,8 +119,9 @@ def raw_to_rest(doc): doc = doc.replace("@[uuml]", "ü") doc = doc.replace("\\'{a}", "á") - # Remove leading whitespace from every line + # Remove leading and trailing whitespace from every line doc = leading_ws.sub("", doc) + doc = trailing_ws.sub("", doc) # Remove multiple spaces doc = double_space.sub(" ", doc) @@ -123,14 +130,19 @@ def raw_to_rest(doc): # insert a non-breaking space doc = end_space.sub("\\1" + unichr(0xa0) + "\\2", doc) - # Remove links - doc = label_link.sub("``\\3`` (in the PARI manual)", doc) + # Fix labels and references + doc = label_define.sub("", doc) + doc = label_ref.sub("``\\3`` (in the PARI manual)", doc) # Bullet items doc = doc.replace("@3@[startbold]*@[endbold] ", "@BULLET ") doc = sub_loop(bullet_loop, "\\1 \\3", doc) doc = doc.replace("@BULLET ", "- ") + # Add =VOID= in front of all leading whitespace (which was + # intentionally added) to avoid confusion with verbatim blocks. + doc = leading_ws.sub(r"=VOID=\1", doc) + # Verbatim blocks doc = begin_verb.sub("::\n\n@0", doc) doc = end_verb.sub("", doc) @@ -160,6 +172,9 @@ def raw_to_rest(doc): doc = doc.replace("@[cbr]", "}") doc = doc.replace("@[startword]", "\\") doc = doc.replace("@[endword]", "") + # (special rules for Hom and Frob, see trac ticket 21005) + doc = doc.replace("@[startlword]Hom@[endlword]", "\\text{Hom}") + doc = doc.replace("@[startlword]Frob@[endlword]", "\\text{Frob}") doc = doc.replace("@[startlword]", "\\") doc = doc.replace("@[endlword]", "") doc = doc.replace("@[startbi]", "\\mathbb{") @@ -184,6 +199,7 @@ def raw_to_rest(doc): doc = doc.replace("=MID=", r"\|") doc = doc.replace("=PERCENT=", r"\%") doc = doc.replace("=HASH=", r"\#") + doc = doc.replace("=VOID=", "") # Handle DISPLAYMATH doc = doc.replace("@[endDISPLAYMATH]", "\n\n") @@ -238,7 +254,7 @@ def get_raw_doc(function): sage: from sage_setup.autogen.pari.doc import get_raw_doc sage: get_raw_doc("cos") - '@[startbold]cos@[dollar](x)@[dollar]:@[endbold]\n\n\n\nCosine of @[dollar]x@[dollar].\n\n\nThe library syntax is @[startcode]GEN @[startbold]gcos@[endbold](GEN x, long prec)@[endcode].\n\n\n' + '@[startbold]cos@[dollar](x)@[dollar]:@[endbold]\n\n@[label se:cos]\nCosine of @[dollar]x@[dollar].\n\n\nThe library syntax is @[startcode]GEN @[startbold]gcos@[endbold](GEN x, long prec)@[endcode].\n\n\n' sage: get_raw_doc("abcde") Traceback (most recent call last): ... @@ -274,7 +290,7 @@ def get_rest_doc(function): .. MATH:: - f(x) = \exp(-i\Pi/24).\eta((x+1)/2)/\eta(x) {such that} + f(x) = \exp(-i\pi/24).\eta((x+1)/2)/\eta(x) {such that} j = (f^{24}-16)^3/f^{24}, where :math:`j` is the elliptic :math:`j`-invariant (see the function :literal:`ellj`). @@ -294,14 +310,16 @@ def get_rest_doc(function): Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \sqrt2`. + :: sage: print(get_rest_doc("ellap")) Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, defined over - :math:`\mathbb{Q}` or a finite field :math:`\mathbb{F}_q`. The argument :math:`p` is best left omitted if the - curve is defined over a finite field, and must be a prime number otherwise. - This function computes the trace of Frobenius :math:`t` for the elliptic curve :math:`E`, - defined by the equation :math:`\#E(\mathbb{F}_q) = q+1 - t`. + a number field or a finite field :math:`\mathbb{F}_q`. The argument :math:`p` is best left + omitted if the curve is defined over a finite field, and must be a prime + number or a maximal ideal otherwise. This function computes the trace of + Frobenius :math:`t` for the elliptic curve :math:`E`, defined by the equation :math:`\#E(\mathbb{F}_q) + = q+1 - t` (for primes of good reduction). When the characteristic of the finite field is large, the availability of the :literal:`seadata` package will speed the computation. @@ -338,6 +356,38 @@ def get_rest_doc(function): ? ellap(E) %8 = -3 + If the curve is defined over a more general number field than :math:`\mathbb{Q}`, + the maximal ideal :math:`p` must be explicitly given in :literal:`idealprimedec` + format. If :math:`p` is above :math:`2` or :math:`3`, the function currently assumes (without + checking) that the given model is locally minimal at :math:`p`. There is no + restriction at other primes. + + :: + + ? K = nfinit(a^2+1); E = ellinit([1+a,0,1,0,0], K); + ? fa = idealfactor(K, E.disc) + %2 = + [ [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 1] + + [[13, [5, 1]~, 1, 1, [-5, -1; 1, -5]] 2] + ? ellap(E, fa[1,1]) + %3 = -1 \\ non-split multiplicative reduction + ? ellap(E, fa[2,1]) + %4 = 1 \\ split multiplicative reduction + ? P17 = idealprimedec(K,17)[1]; + ? ellap(E, P17) + %6 = 6 \\ good reduction + ? E2 = ellchangecurve(E, [17,0,0,0]); + ? ellap(E2, P17) + %8 = 6 \\ same, starting from a non-miminal model + + ? P3 = idealprimedec(K,3)[1]; + ? E3 = ellchangecurve(E, [3,0,0,0]); + ? ellap(E, P3) \\ OK: E is minimal at P3 + %11 = -2 + ? ellap(E3, P3) \\ junk: E3 is not minimal at P3 | 3 + %12 = 0 + :strong:`Algorithms used.` If :math:`E/\mathbb{F}_q` has CM by a principal imaginary quadratic order we use a fast explicit formula (involving essentially Kronecker symbols and Cornacchia's algorithm), in :math:`O(\log q)^2`.