\(L\)-functions from PARI

This is a wrapper around the general PARI \(L\)-functions functionality.

AUTHORS:

  • Frédéric Chapoton (2018) interface

class sage.lfunctions.pari.LFunction(lfun, prec=None)[source]

Bases: SageObject

Build the \(L\)-function from a PARI \(L\)-function.

Rank 1 elliptic curve

We compute with the \(L\)-series of a rank \(1\) curve.

sage: E = EllipticCurve('37a')
sage: L = E.lseries().dokchitser(algorithm='pari'); L
PARI L-function associated to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
sage: L(1)
0.000000000000000
sage: L.derivative(1)
0.305999773834052
sage: L.derivative(1, 2)
0.373095594536324
sage: L.num_coeffs()
50
sage: L.taylor_series(1, 4)
0.000000000000000 + 0.305999773834052*z + 0.186547797268162*z^2 - 0.136791463097188*z^3 + O(z^4)
sage: L.check_functional_equation()  # abs tol 4e-19
1.08420217248550e-19
>>> from sage.all import *
>>> E = EllipticCurve('37a')
>>> L = E.lseries().dokchitser(algorithm='pari'); L
PARI L-function associated to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
>>> L(Integer(1))
0.000000000000000
>>> L.derivative(Integer(1))
0.305999773834052
>>> L.derivative(Integer(1), Integer(2))
0.373095594536324
>>> L.num_coeffs()
50
>>> L.taylor_series(Integer(1), Integer(4))
0.000000000000000 + 0.305999773834052*z + 0.186547797268162*z^2 - 0.136791463097188*z^3 + O(z^4)
>>> L.check_functional_equation()  # abs tol 4e-19
1.08420217248550e-19
E = EllipticCurve('37a')
L = E.lseries().dokchitser(algorithm='pari'); L
L(1)
L.derivative(1)
L.derivative(1, 2)
L.num_coeffs()
L.taylor_series(1, 4)
L.check_functional_equation()  # abs tol 4e-19

Rank 2 elliptic curve

We compute the leading coefficient and Taylor expansion of the \(L\)-series of a rank \(2\) elliptic curve:

sage: E = EllipticCurve('389a')
sage: L = E.lseries().dokchitser(algorithm='pari')
sage: L.num_coeffs()
163
sage: L.derivative(1, E.rank())
1.51863300057685
sage: L.taylor_series(1, 4)
...e-19 + (...e-19)*z + 0.759316500288427*z^2 - 0.430302337583362*z^3 + O(z^4)
>>> from sage.all import *
>>> E = EllipticCurve('389a')
>>> L = E.lseries().dokchitser(algorithm='pari')
>>> L.num_coeffs()
163
>>> L.derivative(Integer(1), E.rank())
1.51863300057685
>>> L.taylor_series(Integer(1), Integer(4))
...e-19 + (...e-19)*z + 0.759316500288427*z^2 - 0.430302337583362*z^3 + O(z^4)
E = EllipticCurve('389a')
L = E.lseries().dokchitser(algorithm='pari')
L.num_coeffs()
L.derivative(1, E.rank())
L.taylor_series(1, 4)

Number field

We compute with the Dedekind zeta function of a number field:

sage: x = var('x')
sage: K = NumberField(x**4 - x**2 - 1,'a')
sage: L = K.zeta_function(algorithm='pari')
sage: L.conductor
400
sage: L.num_coeffs()
348
sage: L(2)
1.10398438736918
sage: L.taylor_series(2, 3)
1.10398438736918 - 0.215822638498759*z + 0.279836437522536*z^2 + O(z^3)
>>> from sage.all import *
>>> x = var('x')
>>> K = NumberField(x**Integer(4) - x**Integer(2) - Integer(1),'a')
>>> L = K.zeta_function(algorithm='pari')
>>> L.conductor
400
>>> L.num_coeffs()
348
>>> L(Integer(2))
1.10398438736918
>>> L.taylor_series(Integer(2), Integer(3))
1.10398438736918 - 0.215822638498759*z + 0.279836437522536*z^2 + O(z^3)
x = var('x')
K = NumberField(x**4 - x**2 - 1,'a')
L = K.zeta_function(algorithm='pari')
L.conductor
L.num_coeffs()
L(2)
L.taylor_series(2, 3)

Ramanujan \(\Delta\) L-function

The coefficients are given by Ramanujan’s tau function:

sage: from sage.lfunctions.pari import lfun_generic, LFunction
sage: lf = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
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)))')
sage: lf.init_coeffs(tau)
sage: L = LFunction(lf)
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_generic, LFunction
>>> lf = lfun_generic(conductor=Integer(1), gammaV=[Integer(0), Integer(1)], weight=Integer(12), eps=Integer(1))
>>> 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)))')
>>> lf.init_coeffs(tau)
>>> L = LFunction(lf)
from sage.lfunctions.pari import lfun_generic, LFunction
lf = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
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)))')
lf.init_coeffs(tau)
L = LFunction(lf)

Now we are ready to evaluate, etc.

sage: L(1)
0.0374412812685155
sage: L.taylor_series(1, 3)
0.0374412812685155 + 0.0709221123619322*z + 0.0380744761270520*z^2 + O(z^3)
>>> from sage.all import *
>>> L(Integer(1))
0.0374412812685155
>>> L.taylor_series(Integer(1), Integer(3))
0.0374412812685155 + 0.0709221123619322*z + 0.0380744761270520*z^2 + O(z^3)
L(1)
L.taylor_series(1, 3)
Lambda(s)[source]

Evaluate the completed \(L\)-function at s.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_number_field, LFunction
sage: L = LFunction(lfun_number_field(QQ))
sage: L.Lambda(2)
0.523598775598299
sage: L.Lambda(1 - 2)
0.523598775598299
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_number_field, LFunction
>>> L = LFunction(lfun_number_field(QQ))
>>> L.Lambda(Integer(2))
0.523598775598299
>>> L.Lambda(Integer(1) - Integer(2))
0.523598775598299
from sage.lfunctions.pari import lfun_number_field, LFunction
L = LFunction(lfun_number_field(QQ))
L.Lambda(2)
L.Lambda(1 - 2)
check_functional_equation()[source]

Verify how well numerically the functional equation is satisfied.

If what this function returns does not look like 0 at all, probably the functional equation is wrong, i.e. some of the parameters gammaV, conductor, etc., or the coefficients are wrong.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_generic, LFunction
sage: lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[1], v=pari('k->vector(k,n,1)'))
sage: L = LFunction(lf)
sage: L.check_functional_equation()
4.33680868994202e-19
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_generic, LFunction
>>> lf = lfun_generic(conductor=Integer(1), gammaV=[Integer(0)], weight=Integer(1), eps=Integer(1), poles=[Integer(1)], residues=[Integer(1)], v=pari('k->vector(k,n,1)'))
>>> L = LFunction(lf)
>>> L.check_functional_equation()
4.33680868994202e-19
from sage.lfunctions.pari import lfun_generic, LFunction
lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[1], v=pari('k->vector(k,n,1)'))
L = LFunction(lf)
L.check_functional_equation()

If we choose the sign in functional equation for the \(\zeta\) function incorrectly, the functional equation does not check out:

sage: lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=-1, poles=[1], residues=[1])
sage: lf.init_coeffs([1]*2000)
sage: L = LFunction(lf)
sage: L.check_functional_equation()
16.0000000000000
>>> from sage.all import *
>>> lf = lfun_generic(conductor=Integer(1), gammaV=[Integer(0)], weight=Integer(1), eps=-Integer(1), poles=[Integer(1)], residues=[Integer(1)])
>>> lf.init_coeffs([Integer(1)]*Integer(2000))
>>> L = LFunction(lf)
>>> L.check_functional_equation()
16.0000000000000
lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=-1, poles=[1], residues=[1])
lf.init_coeffs([1]*2000)
L = LFunction(lf)
L.check_functional_equation()
property conductor

Return the conductor.

EXAMPLES:

sage: from sage.lfunctions.pari import *
sage: L = LFunction(lfun_number_field(QQ)); L.conductor
1
sage: E = EllipticCurve('11a')
sage: L = LFunction(lfun_number_field(E)); L.conductor
11
>>> from sage.all import *
>>> from sage.lfunctions.pari import *
>>> L = LFunction(lfun_number_field(QQ)); L.conductor
1
>>> E = EllipticCurve('11a')
>>> L = LFunction(lfun_number_field(E)); L.conductor
11
from sage.lfunctions.pari import *
L = LFunction(lfun_number_field(QQ)); L.conductor
E = EllipticCurve('11a')
L = LFunction(lfun_number_field(E)); L.conductor
derivative(s, D=1)[source]

Return the derivative of the \(L\)-function at point s and order D.

INPUT:

  • s – complex number

  • D – integer (default: 1)

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_number_field, LFunction
sage: L = LFunction(lfun_number_field(QQ))
sage: L.derivative(2)
-0.937548254315844
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_number_field, LFunction
>>> L = LFunction(lfun_number_field(QQ))
>>> L.derivative(Integer(2))
-0.937548254315844
from sage.lfunctions.pari import lfun_number_field, LFunction
L = LFunction(lfun_number_field(QQ))
L.derivative(2)
hardy(t)[source]

Evaluate the associated Hardy function at t.

This only works for real t.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_number_field, LFunction
sage: L = LFunction(lfun_number_field(QQ))
sage: L.hardy(2)
-0.962008487244041
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_number_field, LFunction
>>> L = LFunction(lfun_number_field(QQ))
>>> L.hardy(Integer(2))
-0.962008487244041
from sage.lfunctions.pari import lfun_number_field, LFunction
L = LFunction(lfun_number_field(QQ))
L.hardy(2)
num_coeffs(T=1)[source]

Return number of coefficients \(a_n\) that are needed in order to perform most relevant \(L\)-function computations to the desired precision.

EXAMPLES:

sage: E = EllipticCurve('11a')
sage: L = E.lseries().dokchitser(algorithm='pari')
sage: L.num_coeffs()
27
sage: E = EllipticCurve('5077a')
sage: L = E.lseries().dokchitser(algorithm='pari')
sage: L.num_coeffs()
591

sage: from sage.lfunctions.pari import lfun_generic, LFunction
sage: lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[-1], v=pari('k->vector(k,n,1)'))
sage: L = LFunction(lf)
sage: L.num_coeffs()
4
>>> from sage.all import *
>>> E = EllipticCurve('11a')
>>> L = E.lseries().dokchitser(algorithm='pari')
>>> L.num_coeffs()
27
>>> E = EllipticCurve('5077a')
>>> L = E.lseries().dokchitser(algorithm='pari')
>>> L.num_coeffs()
591

>>> from sage.lfunctions.pari import lfun_generic, LFunction
>>> lf = lfun_generic(conductor=Integer(1), gammaV=[Integer(0)], weight=Integer(1), eps=Integer(1), poles=[Integer(1)], residues=[-Integer(1)], v=pari('k->vector(k,n,1)'))
>>> L = LFunction(lf)
>>> L.num_coeffs()
4
E = EllipticCurve('11a')
L = E.lseries().dokchitser(algorithm='pari')
L.num_coeffs()
E = EllipticCurve('5077a')
L = E.lseries().dokchitser(algorithm='pari')
L.num_coeffs()
from sage.lfunctions.pari import lfun_generic, LFunction
lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[-1], v=pari('k->vector(k,n,1)'))
L = LFunction(lf)
L.num_coeffs()
taylor_series(s, k=6, var='z')[source]

Return the first \(k\) terms of the Taylor series expansion of the \(L\)-series about \(s\).

This is returned as a formal power series in var.

INPUT:

  • s – complex number; point about which to expand

  • k – integer (default: 6); series is \(O(``var``^k)\)

  • var – string (default: 'z'); variable of power series

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_number_field, LFunction
sage: lf = lfun_number_field(QQ)
sage: L = LFunction(lf)
sage: L.taylor_series(2, 3)
1.64493406684823 - 0.937548254315844*z + 0.994640117149451*z^2 + O(z^3)
sage: E = EllipticCurve('37a')
sage: L = E.lseries().dokchitser(algorithm='pari')
sage: L.taylor_series(1)
0.000000000000000 + 0.305999773834052*z + 0.186547797268162*z^2 - 0.136791463097188*z^3 + 0.0161066468496401*z^4 + 0.0185955175398802*z^5 + O(z^6)
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_number_field, LFunction
>>> lf = lfun_number_field(QQ)
>>> L = LFunction(lf)
>>> L.taylor_series(Integer(2), Integer(3))
1.64493406684823 - 0.937548254315844*z + 0.994640117149451*z^2 + O(z^3)
>>> E = EllipticCurve('37a')
>>> L = E.lseries().dokchitser(algorithm='pari')
>>> L.taylor_series(Integer(1))
0.000000000000000 + 0.305999773834052*z + 0.186547797268162*z^2 - 0.136791463097188*z^3 + 0.0161066468496401*z^4 + 0.0185955175398802*z^5 + O(z^6)
from sage.lfunctions.pari import lfun_number_field, LFunction
lf = lfun_number_field(QQ)
L = LFunction(lf)
L.taylor_series(2, 3)
E = EllipticCurve('37a')
L = E.lseries().dokchitser(algorithm='pari')
L.taylor_series(1)

We compute a Taylor series where each coefficient is to high precision:

sage: E = EllipticCurve('389a')
sage: L = E.lseries().dokchitser(200,algorithm='pari')
sage: L.taylor_series(1, 3)
2...e-63 + (...e-63)*z + 0.75931650028842677023019260789472201907809751649492435158581*z^2 + O(z^3)
>>> from sage.all import *
>>> E = EllipticCurve('389a')
>>> L = E.lseries().dokchitser(Integer(200),algorithm='pari')
>>> L.taylor_series(Integer(1), Integer(3))
2...e-63 + (...e-63)*z + 0.75931650028842677023019260789472201907809751649492435158581*z^2 + O(z^3)
E = EllipticCurve('389a')
L = E.lseries().dokchitser(200,algorithm='pari')
L.taylor_series(1, 3)

Check that Issue #25402 is fixed:

sage: L = EllipticCurve("24a1").modular_form().lseries()
sage: L.taylor_series(-1, 3)
0.000000000000000 - 0.702565506265199*z + 0.638929001045535*z^2 + O(z^3)
>>> from sage.all import *
>>> L = EllipticCurve("24a1").modular_form().lseries()
>>> L.taylor_series(-Integer(1), Integer(3))
0.000000000000000 - 0.702565506265199*z + 0.638929001045535*z^2 + O(z^3)
L = EllipticCurve("24a1").modular_form().lseries()
L.taylor_series(-1, 3)
zeros(maxi)[source]

Return the zeros with imaginary part bounded by maxi.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_number_field, LFunction
sage: lf = lfun_number_field(QQ)
sage: L = LFunction(lf)
sage: L.zeros(20)
[14.1347251417347]
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_number_field, LFunction
>>> lf = lfun_number_field(QQ)
>>> L = LFunction(lf)
>>> L.zeros(Integer(20))
[14.1347251417347]
from sage.lfunctions.pari import lfun_number_field, LFunction
lf = lfun_number_field(QQ)
L = LFunction(lf)
L.zeros(20)
sage.lfunctions.pari.lfun_character(chi)[source]

Create the \(L\)-function of a primitive Dirichlet character.

If the given character is not primitive, it is replaced by its associated primitive character.

OUTPUT: one pari:lfun object

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_character, LFunction
sage: chi = DirichletGroup(6).gen().primitive_character()
sage: L = LFunction(lfun_character(chi))
sage: L(3)
0.884023811750080
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_character, LFunction
>>> chi = DirichletGroup(Integer(6)).gen().primitive_character()
>>> L = LFunction(lfun_character(chi))
>>> L(Integer(3))
0.884023811750080
from sage.lfunctions.pari import lfun_character, LFunction
chi = DirichletGroup(6).gen().primitive_character()
L = LFunction(lfun_character(chi))
L(3)
sage.lfunctions.pari.lfun_delta()[source]

Return the \(L\)-function of Ramanujan’s Delta modular form.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_delta, LFunction
sage: L = LFunction(lfun_delta())
sage: L(1)
0.0374412812685155
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_delta, LFunction
>>> L = LFunction(lfun_delta())
>>> L(Integer(1))
0.0374412812685155
from sage.lfunctions.pari import lfun_delta, LFunction
L = LFunction(lfun_delta())
L(1)
sage.lfunctions.pari.lfun_elliptic_curve(E)[source]

Create the \(L\)-function of an elliptic curve.

OUTPUT: one pari:lfun object

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_elliptic_curve, LFunction
sage: E = EllipticCurve('11a1')
sage: L = LFunction(lfun_elliptic_curve(E))
sage: L(3)
0.752723147389051
sage: L(1)
0.253841860855911
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_elliptic_curve, LFunction
>>> E = EllipticCurve('11a1')
>>> L = LFunction(lfun_elliptic_curve(E))
>>> L(Integer(3))
0.752723147389051
>>> L(Integer(1))
0.253841860855911
from sage.lfunctions.pari import lfun_elliptic_curve, LFunction
E = EllipticCurve('11a1')
L = LFunction(lfun_elliptic_curve(E))
L(3)
L(1)

Over number fields:

sage: K.<a> = QuadraticField(2)
sage: E = EllipticCurve([1, a])
sage: L = LFunction(lfun_elliptic_curve(E))
sage: L(3)
1.00412346717019
>>> from sage.all import *
>>> K = QuadraticField(Integer(2), names=('a',)); (a,) = K._first_ngens(1)
>>> E = EllipticCurve([Integer(1), a])
>>> L = LFunction(lfun_elliptic_curve(E))
>>> L(Integer(3))
1.00412346717019
K.<a> = QuadraticField(2)
E = EllipticCurve([1, a])
L = LFunction(lfun_elliptic_curve(E))
L(3)
sage.lfunctions.pari.lfun_eta_quotient(scalings, exponents)[source]

Return the \(L\)-function of an eta-quotient.

This uses pari:lfunetaquo.

INPUT:

  • scalings – list of integers; the scaling factors

  • exponents – list of integers; the exponents

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_eta_quotient, LFunction
sage: L = LFunction(lfun_eta_quotient([1], [24]))
sage: L(1)
0.0374412812685155

sage: lfun_eta_quotient([6], [4])
[[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):
...
PariError: sorry, noncuspidal eta quotient is not yet implemented
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_eta_quotient, LFunction
>>> L = LFunction(lfun_eta_quotient([Integer(1)], [Integer(24)]))
>>> L(Integer(1))
0.0374412812685155

>>> lfun_eta_quotient([Integer(6)], [Integer(4)])
[[Vecsmall([7]), [Vecsmall([6]), Vecsmall([4]), 0]], 0, [0, 1], 2, 36, 1]

>>> lfun_eta_quotient([Integer(2), Integer(1), Integer(4)], [Integer(5), -Integer(2), -Integer(2)])
Traceback (most recent call last):
...
PariError: sorry, noncuspidal eta quotient is not yet implemented
from sage.lfunctions.pari import lfun_eta_quotient, LFunction
L = LFunction(lfun_eta_quotient([1], [24]))
L(1)
lfun_eta_quotient([6], [4])
lfun_eta_quotient([2, 1, 4], [5, -2, -2])
class sage.lfunctions.pari.lfun_generic(conductor, gammaV, weight, eps, poles=[], residues='automatic', prec=None, *args, **kwds)[source]

Bases: object

Create a PARI \(L\)-function (pari:lfun instance).

The arguments are:

lfun_generic(conductor, gammaV, weight, eps, poles, residues, init)

where

  • conductor – integer; the conductor

  • gammaV – list of Gamma-factor parameters, e.g. [0] for Riemann zeta, [0,1] for ell.curves, (see examples)

  • weight – positive real number, usually an integer e.g. 1 for Riemann zeta, 2 for \(H^1\) of curves/\(\QQ\)

  • eps – complex number; sign in functional equation

  • poles – (default: []) list of points where \(L^*(s)\) has (simple) poles; only poles with \(Re(s)>weight/2\) should be included

  • residues – vector of residues of \(L^*(s)\) in those poles or set residues='automatic' (default)

  • init – list of coefficients

RIEMANN ZETA FUNCTION:

We compute with the Riemann Zeta function:

sage: from sage.lfunctions.pari import lfun_generic, LFunction
sage: lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[1])
sage: lf.init_coeffs([1]*2000)
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_generic, LFunction
>>> lf = lfun_generic(conductor=Integer(1), gammaV=[Integer(0)], weight=Integer(1), eps=Integer(1), poles=[Integer(1)], residues=[Integer(1)])
>>> lf.init_coeffs([Integer(1)]*Integer(2000))
from sage.lfunctions.pari import lfun_generic, LFunction
lf = lfun_generic(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[1])
lf.init_coeffs([1]*2000)

Now we can wrap this PARI \(L\)-function into one Sage \(L\)-function:

sage: L = LFunction(lf); L
L-series of conductor 1 and weight 1
sage: L(1)
Traceback (most recent call last):
...
ArithmeticError: pole here
sage: L(2)
1.64493406684823
sage: L.derivative(2)
-0.937548254315844
sage: h = RR('0.0000000000001')
sage: (zeta(2+h) - zeta(2.))/h
-0.937028232783632
sage: L.taylor_series(2, k=5)
1.64493406684823 - 0.937548254315844*z + 0.994640117149451*z^2 - 1.00002430047384*z^3 + 1.00006193307...*z^4 + O(z^5)
>>> from sage.all import *
>>> L = LFunction(lf); L
L-series of conductor 1 and weight 1
>>> L(Integer(1))
Traceback (most recent call last):
...
ArithmeticError: pole here
>>> L(Integer(2))
1.64493406684823
>>> L.derivative(Integer(2))
-0.937548254315844
>>> h = RR('0.0000000000001')
>>> (zeta(Integer(2)+h) - zeta(RealNumber('2.')))/h
-0.937028232783632
>>> L.taylor_series(Integer(2), k=Integer(5))
1.64493406684823 - 0.937548254315844*z + 0.994640117149451*z^2 - 1.00002430047384*z^3 + 1.00006193307...*z^4 + O(z^5)
L = LFunction(lf); L
L(1)
L(2)
L.derivative(2)
h = RR('0.0000000000001')
(zeta(2+h) - zeta(2.))/h
L.taylor_series(2, k=5)
init_coeffs(v, cutoff=None, w=1)[source]

Set the coefficients \(a_n\) of the \(L\)-series.

If \(L(s)\) is not equal to its dual, pass the coefficients of the dual as the second optional argument.

INPUT:

  • v – list of complex numbers or unary function

  • cutoff – unused

  • w – list of complex numbers or unary function

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_generic, LFunction
sage: lf = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
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)))')
sage: lf.init_coeffs(pari_coeffs)
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_generic, LFunction
>>> lf = lfun_generic(conductor=Integer(1), gammaV=[Integer(0), Integer(1)], weight=Integer(12), eps=Integer(1))
>>> 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)))')
>>> lf.init_coeffs(pari_coeffs)
from sage.lfunctions.pari import lfun_generic, LFunction
lf = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
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)))')
lf.init_coeffs(pari_coeffs)

Evaluate the resulting \(L\)-function at a point, and compare with the answer that one gets “by definition” (of \(L\)-function attached to a modular form):

sage: L = LFunction(lf)
sage: L(14)
0.998583063162746
sage: a = delta_qexp(1000)
sage: sum(a[n]/float(n)^14 for n in reversed(range(1,1000)))
0.9985830631627461
>>> from sage.all import *
>>> L = LFunction(lf)
>>> L(Integer(14))
0.998583063162746
>>> a = delta_qexp(Integer(1000))
>>> sum(a[n]/float(n)**Integer(14) for n in reversed(range(Integer(1),Integer(1000))))
0.9985830631627461
L = LFunction(lf)
L(14)
a = delta_qexp(1000)
sum(a[n]/float(n)^14 for n in reversed(range(1,1000)))

Illustrate that one can give a list of complex numbers for v (see Issue #10937):

sage: l2 = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
sage: l2.init_coeffs(list(delta_qexp(1000))[1:])
sage: L2 = LFunction(l2)
sage: L2(14)
0.998583063162746
>>> from sage.all import *
>>> l2 = lfun_generic(conductor=Integer(1), gammaV=[Integer(0), Integer(1)], weight=Integer(12), eps=Integer(1))
>>> l2.init_coeffs(list(delta_qexp(Integer(1000)))[Integer(1):])
>>> L2 = LFunction(l2)
>>> L2(Integer(14))
0.998583063162746
l2 = lfun_generic(conductor=1, gammaV=[0, 1], weight=12, eps=1)
l2.init_coeffs(list(delta_qexp(1000))[1:])
L2 = LFunction(l2)
L2(14)
sage.lfunctions.pari.lfun_genus2(C)[source]

Return the \(L\)-function of a curve of genus 2.

INPUT:

  • C – hyperelliptic curve of genus 2

Currently, the model needs to be minimal at 2.

This uses pari:lfungenus2.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_genus2, LFunction
sage: x = polygen(QQ, 'x')
sage: C = HyperellipticCurve(x^5 + x + 1)
sage: L = LFunction(lfun_genus2(C))
...
sage: L(3)
0.965946926261520

sage: C = HyperellipticCurve(x^2 + x, x^3 + x^2 + 1)
sage: L = LFunction(lfun_genus2(C))
sage: L(2)
0.364286342944359
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_genus2, LFunction
>>> x = polygen(QQ, 'x')
>>> C = HyperellipticCurve(x**Integer(5) + x + Integer(1))
>>> L = LFunction(lfun_genus2(C))
...
>>> L(Integer(3))
0.965946926261520

>>> C = HyperellipticCurve(x**Integer(2) + x, x**Integer(3) + x**Integer(2) + Integer(1))
>>> L = LFunction(lfun_genus2(C))
>>> L(Integer(2))
0.364286342944359
from sage.lfunctions.pari import lfun_genus2, LFunction
x = polygen(QQ, 'x')
C = HyperellipticCurve(x^5 + x + 1)
L = LFunction(lfun_genus2(C))
L(3)
C = HyperellipticCurve(x^2 + x, x^3 + x^2 + 1)
L = LFunction(lfun_genus2(C))
L(2)
sage.lfunctions.pari.lfun_hgm(motif, t)[source]

Create the \(L\)-function of an hypergeometric motive.

OUTPUT: one pari:lfun object

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_hgm, LFunction
sage: from sage.modular.hypergeometric_motive import HypergeometricData as Hyp
sage: H = Hyp(gamma_list=([3,-1,-1,-1]))
sage: L = LFunction(lfun_hgm(H, 1/5))
sage: L(3)
0.901925346034773
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_hgm, LFunction
>>> from sage.modular.hypergeometric_motive import HypergeometricData as Hyp
>>> H = Hyp(gamma_list=([Integer(3),-Integer(1),-Integer(1),-Integer(1)]))
>>> L = LFunction(lfun_hgm(H, Integer(1)/Integer(5)))
>>> L(Integer(3))
0.901925346034773
from sage.lfunctions.pari import lfun_hgm, LFunction
from sage.modular.hypergeometric_motive import HypergeometricData as Hyp
H = Hyp(gamma_list=([3,-1,-1,-1]))
L = LFunction(lfun_hgm(H, 1/5))
L(3)
sage.lfunctions.pari.lfun_number_field(K)[source]

Create the Dedekind zeta function of a number field.

OUTPUT: one pari:lfun object

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_number_field, LFunction

sage: L = LFunction(lfun_number_field(QQ))
sage: L(3)
1.20205690315959

sage: K = NumberField(x**2 - 2, 'a')
sage: L = LFunction(lfun_number_field(K))
sage: L(3)
1.15202784126080
sage: L(0)
...0.000000000000000
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_number_field, LFunction

>>> L = LFunction(lfun_number_field(QQ))
>>> L(Integer(3))
1.20205690315959

>>> K = NumberField(x**Integer(2) - Integer(2), 'a')
>>> L = LFunction(lfun_number_field(K))
>>> L(Integer(3))
1.15202784126080
>>> L(Integer(0))
...0.000000000000000
from sage.lfunctions.pari import lfun_number_field, LFunction
L = LFunction(lfun_number_field(QQ))
L(3)
K = NumberField(x**2 - 2, 'a')
L = LFunction(lfun_number_field(K))
L(3)
L(0)
sage.lfunctions.pari.lfun_quadratic_form(qf)[source]

Return the \(L\)-function of a positive definite quadratic form.

This uses pari:lfunqf.

EXAMPLES:

sage: from sage.lfunctions.pari import lfun_quadratic_form, LFunction
sage: Q = QuadraticForm(ZZ, 2, [2, 3, 4])
sage: L = LFunction(lfun_quadratic_form(Q))
sage: L(3)
0.377597233183583
>>> from sage.all import *
>>> from sage.lfunctions.pari import lfun_quadratic_form, LFunction
>>> Q = QuadraticForm(ZZ, Integer(2), [Integer(2), Integer(3), Integer(4)])
>>> L = LFunction(lfun_quadratic_form(Q))
>>> L(Integer(3))
0.377597233183583
from sage.lfunctions.pari import lfun_quadratic_form, LFunction
Q = QuadraticForm(ZZ, 2, [2, 3, 4])
L = LFunction(lfun_quadratic_form(Q))
L(3)