# Built-in $L$-series

An $L$*-series* or an $L$*-function* is an infinite sum $L(s)=\sum_{n=1}^\infty a_n/n^s$ in the complex variable $s$ with complex coefficients $a_n$. Such functions arise in many places in mathematics and they are usually naturally associated with some kind of mathematical object, for instance a character, a number field, a curve, a modular form or a cohomology group of an algebraic variety. The coefficients $a_n$ are certain invariants associated with that object. For example, in the case of a character $\chi: ({\mathbb{Z}}/m{\mathbb{Z}})^*\to {\mathbb{C}}^*$ they are simply its values $a_n=\chi(n)$ when gcd$(n,m)=1$ and 0 otherwise.

Magma is able to associate an $L$-series to various types of object. The intrinsic which provides access to such pre-defined $L$-series is

`LSeries(`*object: optional parameters*`)`

Every such function returns a variable of type `LSer`. A range of functions may now be applied to this $L$-series object as described in the following sections (and in fact more are available than listed), and these are independent of the object to which the $L$-series was originally associated. In fact, an object of type `LSer` only “remembers” its origin for printing purposes.

## `RiemannZeta() -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

The Riemann zeta function $\zeta(s)$ is returned.

The number of digits of precision to which the values $\zeta(s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted, the precision of the default real field will be used.

## `Example: Lseries Sig Riemann (ex-b6ea59)`

Check that $\zeta(2)$ agrees numerically with $\pi^2/6$.

```magma
> L := RiemannZeta( : Precision:=40);
> Evaluate(L,2);
1.644934066848226436472415166646025189219
> Pi(RealField(40))^2/6;
1.644934066848226436472415166646025189219

```

## `LSeries(K): FldNum -> LSer`

```magma
Method            : MonStgElt                    Default: "Default"
ClassNumberFormula: BoolElt                      Default: false
Precision         : RngIntElt                    Default: 
```

Create the Dedekind zeta function $\zeta(K,s)$ of a number field $K$. The series is defined by $\sum_I {\rm Norm}_{K/{\mathbb{Q}}}(I)^{-s}$, where the sum is taken over the non-zero ideals $I$ of the maximal order of $K$. For $K={\mathbb{Q}}$, the series coincides with the Riemann zeta function.

The optional parameter `Method` may be `"Artin"`, `"Direct"` or `"Default"` and specifies whether the zeta function should be computed as a product of $L$-series of Artin representations or directly, by counting prime ideals. (The default behaviour depends upon the field.)

For the `"Direct"` method, the Dedekind zeta function has a simple pole at $s=1$ whose residue must be known in order to compute the $L$-values. The class number formula gives an expression for this residue in terms of the number of real/complex embeddings of $K$, the regulator, the class number and the number of roots of unity in $K$. If the optional parameter `ClassNumberFormula` is set to `true`, then these quantities are computed on initialization (using Magma’s functions `Signature(K), Regulator(K), #ClassGroup(MaximalOrder(K))` and `#TorsionSubgroup(UnitGroup(K))`) and it might take some time if the discriminant of $K$ is large. If `ClassNumberFormula` is `false` (default) then the residue is computed numerically from the functional equation. This is generally faster, unless the discriminant of $K$ is small and the precision is set to be very high.

The number of digits of precision to which the values $\zeta(K,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

## `Example: Lseries Sig Dedekind (ex-a7a8a2)`

This code computes the value of $\zeta({\mathbb{Q}}(i),s)$ at $s=2$.

```magma
> P<x> := PolynomialRing(Integers());
> K := NumberField(x^2+1);
> L := LSeries(K);
> Evaluate(L, 2);
1.50670300992298503088656504818

```

## `Example: Lseries Sig Dedekind2 (ex-e875eb)`

The code computes $\zeta(F,2)$ for $F={\mathbb{Q}}(\root 12 \of 3)$.

```magma
> R<x> := PolynomialRing(Rationals());
> F := NumberField(x^12-3);
> L := LSeries(F: Method:="Direct");
> Conductor(L), LCfRequired(L);
1579460446107205632 92968955438

```

The set-up time for the direct method is negligible, but the $L$-value computation will take days for this number of coefficients. On the other hand, the normal closure of $F$ is not too large and has only representations of small dimension:

```magma
> G := GaloisGroup(F);
> #G, [Degree(ch): ch in CharacterTable(G)];
24 [ 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
> time L := LSeries(F : Method:="Artin");
Time: 0.340

```

It took longer to define the $L$-series, but the advantage is that it is a product of $L$-series with very small conductors, and the $L$-value calculations are almost instant:

```magma
> [Conductor(f[1]) : f in Factorisation(L)];
[ 1, 12, 3888, 243, 576, 15552, 15552 ]
> time Evaluate(L, 2);
1.63925427193646882835990708820
Time: 0.840
%> L eq LSeries(PermutationCharacter(F));
%true

```

## `Example: armitage (ex-f2ca95)`

This code follows an example of Serre and Armitage (see [[Armitage, 1971](../../references.md#cite-armitage-root-number), [Friedlander, 1975/76](../../references.md#cite-friedlander-root-number), [Serre, 1971](../../references.md#cite-serre-root-number)]) where the $\zeta$-function of a field vanishes at the central point.

```magma
> _<x> := PolynomialRing(Rationals());
> K<s5> := NumberField( x^2-5 );
> L<s205> := NumberField( x^2-205 );
> C := Compositum(K,L);
> e1 := C!(5+s5);
> e2 := C!(41+s205);
> E := ext<C | Polynomial( [ -e1*e2, 0, 1] )>;
> A := AbsoluteField(E);
> DefiningPolynomial(A);
x^8 - 820*x^6 + 223040*x^4 - 24206400*x^2 + 871430400
> Signature(A); // totally real
8 0
> L := LSeries(A);
> LCfRequired(L); // approx value, with old CFE
2739
> CFENew(L); // new vers of CheckFunctionalEquation
0.000000000000000000000000000000
> Evaluate(L, 1/2); // zero as expected
0.000000000000000000000000000000

```

So the evaluation of $L$ at $1/2$ is zero as expected. In fact, L is a product, and one factor has odd sign:

```magma
> L`prod;
[
    <L-series of Riemann zeta function, 1>,
    <L-series of Artin representation Q8: (1,1,-1,1,-1) of
    ext<Q|x^8-820*x^6+223040*x^4-24206400*x^2+871430400>, conductor 5, 1>,
    <L-series of Artin representation Q8: (1,1,1,-1,-1) of
    ext<Q|x^8-820*x^6+223040*x^4-24206400*x^2+871430400>, conductor 41, 1>,
    <L-series of Artin representation Q8: (1,1,-1,-1,1) of
    ext<Q|x^8-820*x^6+223040*x^4-24206400*x^2+871430400>, conductor 205, 1>,
    <L-series of Artin representation Q8: (2,-2,0,0,0) of
    ext<Q|x^8-820*x^6+223040*x^4-24206400*x^2+871430400>, conductor 42025, 2>
]
> [ ComplexField(9)!Sign(x[1]) : x in $1 ];
[ 1.00000000, 1.00000000, 1.00000000, 1.00000000, -1.00000000 ]
> Sign(L`prod[5][1]);
-1.00000000000000000000000000000

```

This phenomenon happens fairly generally with symplectic representations, and quaternionic Galois groups give the most direct examples. The example of smallest conductor $2^83^2$ appears to be for the field $x^8+12x^6+36x^4+36x^2+9$, while $x^8-x^7+x^6-4x^5+5x^4-8x^3+4x^2-8x+16$ has Galois group ${\bf SL}_2({\bf F}_3)$ and conductor $163^2$.

## `LSeries(A): ArtRep -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Creates the $L$-series of an Artin representation $A$. (For information about Artin representations see Chapter [Artin Representations](../../GlobalFields/ArtinRepresentations/index-artin-representations.md#artrep).)

## `Example: Lseries Artin (ex-e5651d)`

$L$-series of the two characters of ${\operatorname{Gal}}({\mathbb{Q}}(i)/{\mathbb{Q}})\cong C_2$.

```magma
> K := QuadraticField(-1);
> triv,sign := Explode(ArtinRepresentations(K));
> Evaluate(LSeries(triv), 2);    // zeta(2)=pi^2/6
1.64493406684822643647241516665
> Evaluate(LSeries(sign), 2);
0.915965594177219015054603514933

```

## `Example: Lseries A7 (ex-c074bd)`

We take a polynomial over ${\mathbb{Q}}$ with Galois group $A_7$ and the unique 6-dimensional irreducible Artin representation $a$ of this group

```magma
> load galpols;
> f:=PolynomialWithGaloisGroup(7,6); // Alt(7)
> K:=NumberField(f);
> A:=ArtinRepresentations(K);
> a:=A[2];a;
Artin representation A7: (6,2,3,0,0,1,-1,-1,-1) of ext<Q|x^7-2*x^6-7*x^5+11*x^4+
   16*x^3-14*x^2-11*x+2>

```

Its $L$-series with the default precision of 30 digits needs a lot of coefficients to compute with.

```magma
> L:=LSeries(a);
> LCfRequired(L); // approx value
1830809

```

We decrease the precision to 8 digits

```magma
> L:=LSeries(a: Precision:=8);
> LCfRequired(L); // approx value with CheckFunctionalEquation
52584

```

Now it takes under 15 seconds to verify the functional equation of $L(a,s)$ and to compute its value at $s=2$.

```magma
> CFENew(L); // new vers of CheckFunctionalEquation
1.4901161E-8
> Evaluate(L,2);
1.1105972

```

## `LSeries(E): CrvEll -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Create the $L$-series $L(E,s)$ of an elliptic curve $E$ defined over ${\mathbb{Q}}$ or over a number field.

The number of digits of precision to which the values $L(E,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

Note that the computation time for evaluating an $L$-series grows roughly like the square root of the conductor (or its norm to ${\mathbb{Q}}$ if the base field is a number field). Therefore an evaluation might take an unreasonable amount of time if the conductor of $E$ is much larger than, say, $10^{10}$ or so. If only the leading term at $s=1$ is required, over ${\mathbb{Q}}$ it is faster to use `AnalyticRank` or `ConjecturalRegulator`.

Note also for general number fields it is only conjectured that $L(E/K,s)$ has a meromorphic continuation to ${\mathbb{C}}$ and also possesses a functional equation. This conjecture is implicitly used in the computations.

## `Example: Lseries Sig Elliptic (ex-f74234)`

Consider the curve $E: y^2+y=x^3+x^2$ over ${\mathbb{Q}}$ of conductor 43. It has Mordell–Weil rank equal to 1, so we expect $L(E/{\mathbb{Q}},1)=0$ and $L'(E/{\mathbb{Q}},1)\ne 0$ by the Birch-Swinnerton-Dyer conjecture.

```magma
> E := EllipticCurve([0,1,1,0,0]);
> Conductor(E);
43
> L:=LSeries(E);
> Evaluate(L, 1);
0.000000000000000000000000000000
> Evaluate(L, 1 : Derivative:=1);
0.343523974618478230618071163922

```

Now base change $E$ to $K={\mathbb{Q}}(i)$. The Mordell–Weil rank of $E$ over $K$ is 2:

```magma
> Rank(E) + Rank(QuadraticTwist(E,-1));
2

```

So we expect $L(E/K,s)$ to have a zero of order 2:

```magma
> K := QuadraticField(-1);
> EK := BaseChange(E, K);
> L := LSeries(EK);
> Evaluate(L, 1);
0.000000000000000000000000000000
> Evaluate(L, 1 : Derivative:=1) lt 10^-20;
true
> Evaluate(L, 1 : Derivative:=2);
1.62399545025600030722546910344

```

## `LSeries(E, K): CrvEll, FldNum -> LSer`

```magma
Method   : MonStgElt                    Default: "Default"
Precision: RngIntElt                    Default: 
```

Given an elliptic curve $E$ defined over the rationals and a number field $K$, create the $L$-series $L(E/K,s)$ associated with $E/K$. Note that in general it is only conjectured that $L(E/K,s)$ has an analytic continuation to ${\mathbb{C}}$ and possesses a functional equation. This conjecture is implicitly used in the computations.

Technically, the resulting $L$-series is the tensor product of two $l$-adic representations, the one associated to $E/{\mathbb{Q}}$ and the one associated to $K/{\mathbb{Q}}$. `Method` specifies how `LSeries(K)` should be defined. It is the same parameter as for `LSeries(FldNum)`. Note that the conductor of the $L$-series $L(E/K,s)$ usually increases very rapidly with the discriminant of $K$. Consequently, if the used method is `"Direct"` or the irreducible constituents of `PermutationCharacter(K)` have large dimension, the computation time may be quite substantial.

The number of digits of precision to which the values $L(E/K,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

## `Example: Lseries Sig Ellnf (ex-9cb4a0)`

We take the curve $E: y^2=x^3+x$ over the rationals and apply base change to obtain a curve over ${\mathbb{Q}}(\sqrt{5})$. The resulting $L$-series $L(E,K,s)$ is in fact the product of $L(E/{\mathbb{Q}},s)$ and $L(F/{\mathbb{Q}},s)$ where $F$ is $E$ twisted by $5$.

```magma
> E := EllipticCurve([0, 0, 0, 1, 0]);
> F := QuadraticTwist(E, 5);
> L := LSeries(E, QuadraticField(5));
> Evaluate(L, 1);
1.53733828470360522458966069195
> Evaluate(LSeries(E),1) * Evaluate(LSeries(F),1);
1.53733828470360522458966069195

```

Here is another example over a cyclotomic field. The $L$-value computations are fast, as here they only involve one-dimensional twists:

```magma
> E := EllipticCurve([0, 0, 0, 1, 0]);
> L := LSeries(E, CyclotomicField(11));
> time Evaluate(L, 1);
0.000000000000000000000000000000
Time: 1.560

```

## `LSeries(E, A): CrvEll, ArtRep -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Twisted $L$-series of an elliptic curve $E/{\mathbb{Q}}$ by an Artin representation $A$.

## `Example: Lseries Sig Ellartintwist (ex-50ee8e)`

We take the elliptic curve 11A3 and twist it by the characters of ${\mathbb{Q}}(\zeta_5)/{\mathbb{Q}}$:

```magma
> E := EllipticCurve(CremonaDatabase(),"11A3");
> K := CyclotomicField(5);
> art := ArtinRepresentations(K);
> for A in art do Evaluate(LSeries(E,A),1); end for;
0.253841860855910684337758923351
0.685976714588516438169889514223 + 1.10993363969520543571381847366*$.1
2.83803828204429619496466743332
0.685976714588516438169889514223 - 1.10993363969520543571381847366*$.1

```

All the $L$-values are non-zero, so according to the Birch-Swinnerton-Dyer conjecture $E$ has rank 0 over ${\mathbb{Q}}(\zeta_5)$. Indeed:

```magma
> #TwoSelmerGroup(BaseChange(E,K));
1

```

## `Example: Lseries Etw Quaternion (ex-e42206)`

As a higher-dimensional example, we twist $E=X_1(11)/{\mathbb{Q}}$ by a 2-dimensional Artin representation that factors through a quaternion Galois group.

```magma
> load galpols;
> E:=EllipticCurve("11a3");           // X_1(11)
> f:=PolynomialWithGaloisGroup(8,5);  // Quaternion Galois group
> K:=NumberField(f);
> A:=ArtinRepresentations(K);
> assert exists(a){a: a in A | Degree(a) eq 2};a;
Artin representation Q8: (2,-2,0,0,0) of ext<Q|x^8-12*x^6+36*x^4-36*x^2+9>
> L:=LSeries(E,a: Precision:=10);
> LCfRequired(L);
208818
> time Evaluate(L,1);
1.678012769
Time: 7.470
> Sign(L);
1.000000000

```

## `LSeries(C): CrvHyp[FldRat] -> LSer`

```magma
Precision: RngIntElt                    Default: 
LocalData: List                         Default: [* *]
```

Returns the $L$-series of a hyperelliptic curve $C/{\mathbb{Q}}$.

The number of digits of precision to which the values $L(C,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

If the conductor exponents and the local factors at (some of) the bad primes are known in advance, they can be passed as a list of tuples `<prime,conductor exponent,local factor>`, e.g. LocalData:=$[*\langle 2,11,1-x\rangle*]$.

Current implementation can only compute the conductor at 2 when $v_2(\Delta)<12$, using Ogg’s formula. If this is not the case, either the local factor at 2 must be supplied in LocalData, or the use of Ogg’s formula at 2 forced with `LocalData:="Ogg"` or `[* <2,"Ogg"> *]`.

## `Example: Lseries Sig Crvhyp (ex-8fc046)`

We take the hyperelliptic curve $y^2=x^5+1$

```magma
> R<x> := PolynomialRing(Rationals());
> C := HyperellipticCurve(x^5+1);
> L := LSeries(C: Precision:=18);
> LCfRequired(L);   // need this number of coefficients
1809
> Evaluate(L,1);  // L(C,1)
1.03140710417331776
> Sign(L); // sign in the functional equation
1.00000000000000000

```

The L-value is non-zero, indicating that the Jacobian should have rank 0. In fact, it does:

```magma
> RankBound(Jacobian(C));
0

```

## `LSeries(C, K): CrvHyp[FldRat], FldNum -> LSer`

```magma
Precision: RngIntElt                    Default: 
LocalData: List                         Default: [* *]
```

The $L$-series associated to a hyperelliptic curve $C/{\mathbb{Q}}$ base changed to a number field $K$.

The number of digits of precision to which the values $L(C,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

Current implementation can only compute the conductor at 2 when $v_2(\Delta)<12$, using Ogg’s formula. If this is not the case, the use of Ogg’s formula at 2 can be forced with `LocalData:="Ogg"`. Also, the local Galois representation machinery is used in the computations, and it is currently not implemented for some of the reduction types.

## `Example: Lseries Crvhyp Qnf (ex-1a6295)`

```magma
> R<x> := PolynomialRing(Rationals());
> C := HyperellipticCurve(x^5-x+1);
> K := CyclotomicField(4);
> L := LSeries(C,K: Precision:=12);
> CheckFunctionalEquation(L);
0.000000000000

```

## `LSeries(C): CrvHyp[FldNum] -> LSer`

```magma
Precision: RngIntElt                    Default: 
LocalData: List                         Default: [* *]
```

The $L$-series of a hyperelliptic curve $C$ defined over a number field $K$.

The number of digits of precision to which the values $L(C/K,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

If the conductor exponents and the local factors at (some of) the bad primes are known in advance, they can be passed as a list of tuples `<prime ideal,conductor exponent,local factor>`, e.g. LocalData:=$[*\langle P,11,1-x\rangle*]$.

Current implementation can only compute the conductor at primes $P|2$ when $v_P(\Delta)<12$, using Ogg’s formula. If this is not the case, either the local factor at 2 must be supplied in LocalData, or the use of Ogg’s formula at 2 forced with `LocalData:="Ogg"` or `[* <P,"Ogg"> *]`.

A word of warning: as is it the case for most $L$-functions, the number of Dirichlet coefficients necessary to compute with $L(C/K,s)$ behaves roughly like the square root of the conductor $N$ of the $L$-function. For a curve $C/K$ of genus $g$ and conductor $N_C$ (an ideal in $O_K)$, this conductor is given by the formula

$$
N = |{\rm Norm}_{K/{\mathbb{Q}}}(N_C)|\cdot |\Delta_{K/{\mathbb{Q}}}|^{2g},
$$

It grows very fast, and so in practice the use of these $L$-series is limited to small genus and small degree $[K:{\mathbb{Q}}]$, even for curves of small conductor.

## `Example: Lseries Crvhyp Nf (ex-73aef0)`

We take a hyperelliptic curve $C$ of genus 2 over ${\mathbb{Q}}(i)$,

$$
C/{\mathbb{Q}}(i):\quad y^2 \,+\, (x^3+x^2+x+1)y \,=\, -(i+1)x^3-(i+1)x^2-ix,
$$

define its $L$-series $L(C,s)$ and compute $L(C,1)$ and $L'(C,1)$.

```magma
> K<i>:=CyclotomicField(4);
> R<x>:=PolynomialRing(K);
> C:=HyperellipticCurve((-i-1)*x^3+(-i-1)*x^2-i*x,x^3+x^2+x+1);
> L:=LSeries(C: Precision:=8);
> LCfRequired(L);                // need this many coefficients
7855
> CheckFunctionalEquation(L);    // zero to correct precision
-7.4505806E-9
> Evaluate(L,1);                 // L(C,1) is zero
6.4853393E-10
> Evaluate(L,1: Derivative:=1);  // L'(C,1) is non-zero
0.31311835

```

According to the Birch–Swinnerton-Dyer conjecture, the Jacobian of $C/{\mathbb{Q}}(i)$ should have rank 1. We can verify that it has indeed trivial 2-torsion, 2-Selmer group of size 2, and that there are non-trivial rational points on $C$:

```magma
> f:=HyperellipticPolynomials(SimplifiedModel(C));
> J:=Jacobian(HyperellipticCurve(f));
> #TwoTorsionSubgroup(J),#TwoSelmerGroup(J);
1 2
> Points(C: Bound:=10);
{@ (1 : 0 : 0), (1 : -1 : 0), (0 : -1 : 1), (0 : 0 : 1), (i - 1 : -1 : 1),
   (i - 1 : -i - 1 : 1), (-i : 1 : 1), (-i : -1 : 1) @}

```

## `LSeries(Chi): GrpDrchElt -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Given a primitive dirichlet character $\chi: ({\mathbb{Z}}/m{\mathbb{Z}})^*\to {\mathbb{C}}^*$, create the associated Dirichlet $L$-series $L(\chi,s)=\sum_{n=1}^\infty \chi(n)/n^s$. The character $\chi$ must be defined so that its values fall in either the ring of integers, the rational field or a cyclotomic field.

The number of digits of precision to which the values $L(\chi,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

For information on Dirichlet characters, see Section [Dirichlet Characters](../../BasicRings/ResidueClassRings/dirichlet-characters.md#rngint-dirichlet).

## `Example: Lseries Sig Character (ex-ac2d65)`

We define a primitive character $\chi: ({\mathbb{Z}}/37{\mathbb{Z}})^*\to {\mathbb{C}}^*$ and construct the associated Dirichlet $L$-function.

```magma
> G<Chi> := DirichletGroup(37, CyclotomicField(36));
> L := LSeries(Chi);
> Evaluate(L,1); // depends on the chosen generator of G
1.65325576836885655776002342451 - 0.551607898922910805875537715935*$.1

```

## `LSeries(hmf): ModFrmHilElt -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Given a cuspidal newform in a space of Hilbert modular forms, this creates the associated L-series. Note that this is **not** implemented for Bianchi modular forms, as the computations of Hecke eigenvalues (particularly at bad primes) is not always feasible in that case.

## `Example: Lseries Hilbert Modform (ex-846e3d)`

```magma
> K := NumberField(x^2 - 5) where x is PolynomialRing(Rationals()).1;
> H := HilbertCuspForms(K,7*Integers(K),[2,2]);
> f := NewformDecomposition(NewSubspace(H))[1];
> L := LSeries(Eigenform(f));
> LSetPrecision(L,9);
> LCfRequired(L); // approximate value, with old CFE
198
> time CFENew(L); // new vers of CheckFunctionalEquation
0.000000000
Time: 9.690

```

## `LSeries(omf): ModFrmAlgElt -> LSer`

```magma
Precision: RngIntElt                    Default: 0
UseAuto  : BoolElt                      Default: true
LowMemory: BoolElt                      Default: false
ThetaPrec: RngIntElt                    Default: 25
```

Given a cuspidal newform in a space of orthogonal modular forms for a quadratic space of rank $3$ or $5$, this creates the associated L-series. Note that this is currently **not** implemented for other spaces of algebraic modular forms, particularly unitary modular forms, as the computations of Hecke eigenvalues at bad primes is not always implemented in that case. The parameters `UseAuto`, `LowMemory` and `ThetaPrec` are for computing the Hecke operators, as in `HeckeOperator` for algebraic modular forms.

## `Example: Lseries Orthogonal Modform (ex-cc704a)`

```magma
> L := QuinaryQuadraticLattices(61)[1][1];
> M := OrthogonalModularForms(L);
> fs := HeckeEigenforms(M);
> f := fs[2];
> L := LSeries(f);
> LSetPrecision(L,10);
> LCfRequired(L); // approximate value, with old CFE
66
> time CFENew(L); // new vers of CheckFunctionalEquation
0.000000000
Time: 355.350

```

## `LSeries(psi): GrpHeckeElt -> LSer`

## `LSeries(psi): GrossenChar -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Given a primitive Hecke (Grössen)character on ideals, construct the associated L-series.

For more information on these see Section [Hecke Grössencharacters and their L-functions](../../GlobalFields/DirichletAndHeckeCharacters/introduction.md#char-characters).

## `LSeries(f): ModFrmElt -> LSer`

```magma
Embedding: Map/UserProgram                    Default: 
Precision: RngIntElt                          Default: 
```

Given a modular form $f$, construct the $L$-series $L(f,s)=\sum_{n=1}^\infty a_n/n^s$, where $f$ has the $q$-expansion $\sum_{n=0}^\infty a_n q^n$. It is assumed that $L(f,s)$ satisfies a functional equation of the standard kind (see Section [Terminology](general.md#terminology) for the precise form of the functional equation).

The optional parameter `embedding` specifies a map which embeds the coefficients of $f$ into the complex field. By default this is the identity map, so that the coefficients of $f$ must be coercible into ${\mathbb{C}}$. Otherwise, the value of the parameter must either be an object of type `Map` or a user-defined function $e(x)$ each having domain the base ring of $f$ and codomain the complex field (or values than can be coerced into the complex field).

The number of digits of precision to which the values $L(f,s)$ are to be computed may be specified using the `Precision` parameter. If it is omitted the precision is taken to be that of the default real field.

## `Example: Lseries Sig Modfrm (ex-0f42a0)`

We define a newform of weight 2 and conductor 16. It is not defined over the integers but rather over $B={\mathbb{Z}}[i]$.

```magma
> f := Newforms("G1N16k2A")[1]; f;
q + (-a - 1)*q^2 + (a - 1)*q^3 + 2*a*q^4 + (-a - 1)*q^5 + 2*q^6 - 2*a*q^7 +
   (-2*a + 2)*q^8 + a*q^9 + 2*a*q^10 + (a + 1)*q^11 + O(q^12)
> B:=BaseRing(f); B;
Equation Order with defining polynomial x^2 + 1 over its ground order

```

The two distinct embeddings of $B$ into the complex numbers give rise to two modular forms, which can be accessed using the `ComplexEmbeddings` function.

```magma
> f1, f2 := Explode(ComplexEmbeddings(f)[1]);
> Coefficient(f,2), Coefficient(f1,2), Coefficient(f2,2);
-a - 1
-1.00000000000000000000000000000 + 1.00000000000000000000000000000*$.1
   -1.00000000000000000000000000000 - 1.00000000000000000000000000000*$.1

```

Thus, $f_1$ and $f_2$ have genuine complex coefficients and we can construct the associated $L$-series and compute their $L$-values, for instance at $s=1$.

```magma
> L1 := LSeries(f1);
> L2 := LSeries(f2);
> CFENew(L1); // new vers of CheckFunctionalEquation
4.73316543132607083247037139170E-30
> CFENew(L2);
4.73316543132607083247037139170E-30
> v1 := Evaluate(L1,1); v2 := Evaluate(L2,1); v1,v2;
0.359306437003505684066327207778 + 0.0714704939991172686588458066909*$.1
   0.359306437003505684066327207778 - 0.0714704939991172686588458066909*$.1

```

If instead we invoke `LSeries(f)`, Magma will note that $f$ is defined over a number field and complain that the coefficients of $f$ are not well-defined complex numbers.

```magma
> L := LSeries(f);
Runtime error: For f over a number field, you have to specify a complex
   embedding

```

Instead of using `ComplexEmbeddings`, one can instead explicitly specify an embedding of the coefficients of $B$ into the complex numbers using the parameter `Embedding` with the function `LSeries` The following statements define the same $L$-function as $L_2$ above.

```magma
> C<i> := ComplexField();
> L2A := LSeries(f: Embedding:=hom< B -> C | i > );
> L2B := LSeries(f: Embedding:=func< x | Conjugates(x)[1] > );
> L2C := LSeries(f1: Embedding:=func< x | ComplexConjugate(x) > );

```

Finally, we illustrate the very important fact that Magma expects, but does *not* check that the $L$-function associated to a modular form satisfies a functional equation.

```magma
> L := LSeries(f1+f2);  // or L:=LSeries(f: Embedding:=func<x|Trace(B!x)>);

```

Although Magma is happy with this definition, it is in fact illegal. The modular form $f$ has a character whose values lie in the field of the $4$-th roots of unity.

```magma
> Order(DirichletCharacter(f));
4

```

The two embeddings $f_1$ and $f_2$ of $f$ have *different* (complex conjugate) characters and $f_1+f_2$ does not satisfy a functional equation of the standard kind. Magma will suspect this when it tries to determine the sign in the functional equation and thereby print a warning:

```magma
> Evaluate(L,1);
 |Sign| is nowhere near 1, wrong functional equation?
0.363706143196151750493063407843
> CFENew(L); // new vers of CheckFunctionalEquation
0.293560852738072340956684556739

```

The function `CheckFunctionalEquation` or `CFENew` should return 0 (to current precision), so the functional equation is not satisfied, and the result of evaluating $L$ will be a random number. So it is the *user’s* responsibility to ensure that the modular form does satisfy a functional equation as described in Section [Terminology](general.md#terminology).

## `LSeries(S): ModSym -> LSer`

```magma
Precision: RngIntElt                    Default: 
```

Given a 1-dimensional cuspidal modular symbol space, construct the $L$-series determined by its Hecke operators (for the Euler factors). In fact, the dual Hecke operators are used for efficiency purposes.

## `Example: Lseries Sig Modsym (ex-52ab37)`

We give two examples, the first of a largish level where the computations might otherwise be difficult, and the second for one where the space has a nontrivial character.

```magma
> S := CuspidalSubspace(ModularSymbols(864,4,+1)); // wt 4
> x := PolynomialRing(Integers()).1;
> K := Kernel([<5,x-19>,<7,x-13>],S); // 19 at p=5, 13 at p=7
> assert Dimension(K) eq 1;
> L := LSeries(K);
> LCfRequired(L); // approx for old CheckFunctionalEquation
467
> CFENew(L);
0.000000000000000000000000000000
> time DualHeckeOperator(K,997);
[31536]
Time: 0.040

```

```magma
> chi := DirichletGroup(4).1; // nontrivial character modulo 4
> S := CuspidalSubspace(ModularSymbols(chi,5,+1)); // weight 5
> L := LSeries(S);
> CFENew(L);
0.000000000000000000000000000000
> EulerFactor(L,2);
4*x + 1
> DualHeckeOperator(S,2);
[-4]

```
