Skip to content

Commit ca25316

Browse files
author
Release Manager
committed
Trac #34522: clean up src/sage/lfunctions/pari.py
The goal of this ticket is to remove a deprecation message introduced in #26098 (>1 year) and apply some pycodestyle conventions. URL: https://trac.sagemath.org/34522 Reported by: gh-DavidAyotte Ticket author(s): David Ayotte Reviewer(s): Matthias Koeppe
2 parents ccf1a25 + 4c9486b commit ca25316

File tree

1 file changed

+23
-34
lines changed

1 file changed

+23
-34
lines changed

src/sage/lfunctions/pari.py

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(self, conductor, gammaV, weight, eps, poles=[],
108108
if args or kwds:
109109
self.init_coeffs(*args, **kwds)
110110

111-
def init_coeffs(self, v, cutoff=None, w=1, *args, **kwds):
111+
def init_coeffs(self, v, cutoff=None, w=1):
112112
"""
113113
Set the coefficients `a_n` of the `L`-series.
114114
@@ -126,7 +126,7 @@ def init_coeffs(self, v, cutoff=None, w=1, *args, **kwds):
126126
EXAMPLES::
127127
128128
sage: from sage.lfunctions.pari import lfun_generic, LFunction
129-
sage: lf = lfun_generic(conductor=1, gammaV=[0,1], weight=12, eps=1)
129+
sage: lf = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
130130
sage: pari_coeffs = pari('k->vector(k,n,(5*sigma(n,3)+7*sigma(n,5))*n/12 - 35*sum(k=1,n-1,(6*k-4*(n-k))*sigma(k,3)*sigma(n-k,5)))')
131131
sage: lf.init_coeffs(pari_coeffs)
132132
@@ -144,7 +144,7 @@ def init_coeffs(self, v, cutoff=None, w=1, *args, **kwds):
144144
Illustrate that one can give a list of complex numbers for v
145145
(see :trac:`10937`)::
146146
147-
sage: l2 = lfun_generic(conductor=1, gammaV=[0,1], weight=12, eps=1)
147+
sage: l2 = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
148148
sage: l2.init_coeffs(list(delta_qexp(1000))[1:])
149149
sage: L2 = LFunction(l2)
150150
sage: L2(14)
@@ -155,20 +155,9 @@ def init_coeffs(self, v, cutoff=None, w=1, *args, **kwds):
155155
Verify that setting the `w` parameter does not raise an error
156156
(see :trac:`10937`)::
157157
158-
sage: L2 = lfun_generic(conductor=1, gammaV=[0,1], weight=12, eps=1)
158+
sage: L2 = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
159159
sage: L2.init_coeffs(list(delta_qexp(1000))[1:], w=[1..1000])
160-
161-
Additional arguments are ignored for compatibility with the old
162-
Dokchitser script::
163-
164-
sage: L2.init_coeffs(list(delta_qexp(1000))[1:], foo="bar")
165-
doctest:...: DeprecationWarning: additional arguments for initializing an lfun_generic are ignored
166-
See https://trac.sagemath.org/26098 for details.
167160
"""
168-
if args or kwds:
169-
from sage.misc.superseded import deprecation
170-
deprecation(26098, "additional arguments for initializing an lfun_generic are ignored")
171-
172161
v = pari(v)
173162
if v.type() not in ('t_CLOSURE', 't_VEC'):
174163
raise TypeError("v (coefficients) must be a list or a function")
@@ -250,12 +239,12 @@ def lfun_character(chi):
250239
251240
Check the values::
252241
253-
sage: chi = DirichletGroup(24)([1,-1,-1]); chi
242+
sage: chi = DirichletGroup(24)([1, -1, -1]); chi
254243
Dirichlet character modulo 24 of conductor 24
255244
mapping 7 |--> 1, 13 |--> -1, 17 |--> -1
256245
sage: Lchi = lfun_character(chi)
257246
sage: v = [0] + Lchi.lfunan(30).sage()
258-
sage: all(v[i] == chi(i) for i in (7,13,17))
247+
sage: all(v[i] == chi(i) for i in (7, 13, 17))
259248
True
260249
"""
261250
if not chi.is_primitive():
@@ -285,7 +274,7 @@ def lfun_elliptic_curve(E):
285274
Over number fields::
286275
287276
sage: K.<a> = QuadraticField(2)
288-
sage: E = EllipticCurve([1,a])
277+
sage: E = EllipticCurve([1, a])
289278
sage: L = LFunction(lfun_elliptic_curve(E))
290279
sage: L(3)
291280
1.00412346717019
@@ -309,7 +298,7 @@ def lfun_number_field(K):
309298
sage: L(3)
310299
1.20205690315959
311300
312-
sage: K = NumberField(x**2-2, 'a')
301+
sage: K = NumberField(x**2 - 2, 'a')
313302
sage: L = LFunction(lfun_number_field(K))
314303
sage: L(3)
315304
1.15202784126080
@@ -338,10 +327,10 @@ def lfun_eta_quotient(scalings, exponents):
338327
sage: L(1)
339328
0.0374412812685155
340329
341-
sage: lfun_eta_quotient([6],[4])
330+
sage: lfun_eta_quotient([6], [4])
342331
[[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4])]], 0, [0, 1], 2, 36, 1]
343332
344-
sage: lfun_eta_quotient([2,1,4], [5,-2,-2])
333+
sage: lfun_eta_quotient([2, 1, 4], [5, -2, -2])
345334
Traceback (most recent call last):
346335
...
347336
PariError: sorry, noncuspidal eta quotient is not yet implemented
@@ -377,7 +366,7 @@ def lfun_quadratic_form(qf):
377366
EXAMPLES::
378367
379368
sage: from sage.lfunctions.pari import lfun_quadratic_form, LFunction
380-
sage: Q = QuadraticForm(ZZ,2,[2,3,4])
369+
sage: Q = QuadraticForm(ZZ, 2, [2, 3, 4])
381370
sage: L = LFunction(lfun_quadratic_form(Q))
382371
sage: L(3)
383372
0.377597233183583
@@ -409,7 +398,7 @@ def lfun_genus2(C):
409398
sage: L(3)
410399
0.965946926261520
411400
412-
sage: C = HyperellipticCurve(x^2+x, x^3+x^2+1)
401+
sage: C = HyperellipticCurve(x^2 + x, x^3 + x^2 + 1)
413402
sage: L = LFunction(lfun_genus2(C))
414403
sage: L(2)
415404
0.364286342944359
@@ -445,11 +434,11 @@ class LFunction(SageObject):
445434
0.000000000000000
446435
sage: L.derivative(1)
447436
0.305999773834052
448-
sage: L.derivative(1,2)
437+
sage: L.derivative(1, 2)
449438
0.373095594536324
450439
sage: L.num_coeffs()
451440
50
452-
sage: L.taylor_series(1,4)
441+
sage: L.taylor_series(1, 4)
453442
0.000000000000000 + 0.305999773834052*z + 0.186547797268162*z^2 - 0.136791463097188*z^3 + O(z^4)
454443
sage: L.check_functional_equation() # abs tol 4e-19
455444
1.08420217248550e-19
@@ -463,9 +452,9 @@ class LFunction(SageObject):
463452
sage: L = E.lseries().dokchitser(algorithm="pari")
464453
sage: L.num_coeffs()
465454
163
466-
sage: L.derivative(1,E.rank())
455+
sage: L.derivative(1, E.rank())
467456
1.51863300057685
468-
sage: L.taylor_series(1,4)
457+
sage: L.taylor_series(1, 4)
469458
...e-19 + (...e-19)*z + 0.759316500288427*z^2 - 0.430302337583362*z^3 + O(z^4)
470459
471460
.. RUBRIC:: Number field
@@ -481,15 +470,15 @@ class LFunction(SageObject):
481470
348
482471
sage: L(2)
483472
1.10398438736918
484-
sage: L.taylor_series(2,3)
473+
sage: L.taylor_series(2, 3)
485474
1.10398438736918 - 0.215822638498759*z + 0.279836437522536*z^2 + O(z^3)
486475
487476
.. RUBRIC:: Ramanujan `\Delta` L-function
488477
489478
The coefficients are given by Ramanujan's tau function::
490479
491480
sage: from sage.lfunctions.pari import lfun_generic, LFunction
492-
sage: lf = lfun_generic(conductor=1, gammaV=[0,1], weight=12, eps=1)
481+
sage: lf = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
493482
sage: tau = pari('k->vector(k,n,(5*sigma(n,3)+7*sigma(n,5))*n/12 - 35*sum(k=1,n-1,(6*k-4*(n-k))*sigma(k,3)*sigma(n-k,5)))')
494483
sage: lf.init_coeffs(tau)
495484
sage: L = LFunction(lf)
@@ -498,7 +487,7 @@ class LFunction(SageObject):
498487
499488
sage: L(1)
500489
0.0374412812685155
501-
sage: L.taylor_series(1,3)
490+
sage: L.taylor_series(1, 3)
502491
0.0374412812685155 + 0.0709221123619322*z + 0.0380744761270520*z^2 + O(z^3)
503492
"""
504493
def __init__(self, lfun, prec=None):
@@ -608,7 +597,7 @@ def Lambda(self, s):
608597
sage: L = LFunction(lfun_number_field(QQ))
609598
sage: L.Lambda(2)
610599
0.523598775598299
611-
sage: L.Lambda(1-2)
600+
sage: L.Lambda(1 - 2)
612601
0.523598775598299
613602
"""
614603
s = self._CCin(s)
@@ -630,7 +619,7 @@ def hardy(self, t):
630619
631620
TESTS::
632621
633-
sage: L.hardy(.4+.3*I)
622+
sage: L.hardy(.4 + .3*I)
634623
Traceback (most recent call last):
635624
...
636625
PariError: incorrect type in lfunhardy (t_COMPLEX)
@@ -694,7 +683,7 @@ def taylor_series(self, s, k=6, var='z'):
694683
695684
sage: E = EllipticCurve('389a')
696685
sage: L = E.lseries().dokchitser(200,algorithm="pari")
697-
sage: L.taylor_series(1,3)
686+
sage: L.taylor_series(1, 3)
698687
2...e-63 + (...e-63)*z + 0.75931650028842677023019260789472201907809751649492435158581*z^2 + O(z^3)
699688
700689
Check that :trac:`25402` is fixed::
@@ -757,7 +746,7 @@ def __call__(self, s):
757746
sage: L = E.lseries().dokchitser(100, algorithm="pari")
758747
sage: L(1)
759748
0.00000000000000000000000000000
760-
sage: L(1+I)
749+
sage: L(1 + I)
761750
-1.3085436607849493358323930438 + 0.81298000036784359634835412129*I
762751
"""
763752
s = self._CC(s)

0 commit comments

Comments
 (0)