Elements of modular forms spaces

Class hierarchy:

class sage.modular.modform.element.EisensteinSeries(parent, vector, t, chi, psi)

Bases: sage.modular.modform.element.ModularFormElement

An Eisenstein series.

EXAMPLES:

sage: E = EisensteinForms(1,12)
sage: E.eisenstein_series()
[
691/65520 + q + 2049*q^2 + 177148*q^3 + 4196353*q^4 + 48828126*q^5 + O(q^6)
]
sage: E = EisensteinForms(11,2)
sage: E.eisenstein_series()
[
5/12 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5 + O(q^6)
]
sage: E = EisensteinForms(Gamma1(7),2)
sage: E.set_precision(4)
sage: E.eisenstein_series()
[
1/4 + q + 3*q^2 + 4*q^3 + O(q^4),
1/7*zeta6 - 3/7 + q + (-2*zeta6 + 1)*q^2 + (3*zeta6 - 2)*q^3 + O(q^4),
q + (-zeta6 + 2)*q^2 + (zeta6 + 2)*q^3 + O(q^4),
-1/7*zeta6 - 2/7 + q + (2*zeta6 - 1)*q^2 + (-3*zeta6 + 1)*q^3 + O(q^4),
q + (zeta6 + 1)*q^2 + (-zeta6 + 3)*q^3 + O(q^4)
]
L()

Return the conductor of self.chi().

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].L()
17
M()

Return the conductor of self.psi().

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].M()
1
character()

Return the character associated to self.

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].character()
Dirichlet character modulo 17 of conductor 17 mapping 3 |--> zeta16

sage: chi = DirichletGroup(7)[4]
sage: E = EisensteinForms(chi).eisenstein_series() ; E
[
-1/7*zeta6 - 2/7 + q + (2*zeta6 - 1)*q^2 + (-3*zeta6 + 1)*q^3 + (-2*zeta6 - 1)*q^4 + (5*zeta6 - 4)*q^5 + O(q^6),
q + (zeta6 + 1)*q^2 + (-zeta6 + 3)*q^3 + (zeta6 + 2)*q^4 + (zeta6 + 4)*q^5 + O(q^6)
]
sage: E[0].character() == chi
True
sage: E[1].character() == chi
True
chi()

Return the parameter chi associated to self.

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].chi()
Dirichlet character modulo 17 of conductor 17 mapping 3 |--> zeta16
new_level()

Return level at which self is new.

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].level()
17
sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].new_level()
17
sage: [ [x.level(), x.new_level()] for x in EisensteinForms(DirichletGroup(60).0^2,2).eisenstein_series() ]
[[60, 2], [60, 3], [60, 2], [60, 5], [60, 2], [60, 2], [60, 2], [60, 3], [60, 2], [60, 2], [60, 2]]
parameters()

Return chi, psi, and t, which are the defining parameters of self.

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].parameters()
(Dirichlet character modulo 17 of conductor 17 mapping 3 |--> zeta16, Dirichlet character modulo 17 of conductor 1 mapping 3 |--> 1, 1)
psi()

Return the parameter psi associated to self.

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].psi()
 Dirichlet character modulo 17 of conductor 1 mapping 3 |--> 1
t()

Return the parameter t associated to self.

EXAMPLES:

sage: EisensteinForms(DirichletGroup(17).0,99).eisenstein_series()[1].t()
1
class sage.modular.modform.element.ModularFormElement(parent, x, check=True)

Bases: sage.modular.modform.element.ModularForm_abstract, sage.modular.hecke.element.HeckeModuleElement

An element of a space of modular forms.

INPUT:

  • parent - ModularForms (an ambient space of modular forms)
  • x - a vector on the basis for parent
  • check - if check is True, check the types of the inputs.

OUTPUT:

  • ModularFormElement - a modular form

EXAMPLES:

sage: M = ModularForms(Gamma0(11),2)
sage: f = M.0
sage: f.parent()
Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field
atkin_lehner_eigenvalue(d=None, embedding=None)

Return the result of the Atkin-Lehner operator \(W_d\) on self.

INPUT:

  • d – a positive integer exactly dividing the level \(N\) of self, i.e. \(d\) divides \(N\) and is coprime to \(N/d\). (Default: \(d = N\))
  • embedding – ignored (but accepted for compatibility with Newform.atkin_lehner_eigenvalue())

OUTPUT:

The Atkin-Lehner eigenvalue of \(W_d\) on self. If self is not an eigenform for \(W_d\), a ValueError is raised.

See also

For the conventions used to define the operator \(W_d\), see sage.modular.hecke.module.HeckeModule_free_module.atkin_lehner_operator().

EXAMPLES:

sage: CuspForms(1, 30).0.atkin_lehner_eigenvalue()
1
sage: CuspForms(2, 8).0.atkin_lehner_eigenvalue()
Traceback (most recent call last):
...
NotImplementedError: Don't know how to compute Atkin-Lehner matrix acting on this space (try using a newform constructor instead)
modform_lseries(*args, **kwds)

Deprecated: Use lseries() instead. See trac ticket #16917 for details.

twist(chi, level=None)

Return the twist of the modular form self by the Dirichlet character chi.

If self is a modular form \(f\) with character \(\epsilon\) and \(q\)-expansion

\[f(q) = \sum_{n=0}^\infty a_n q^n,\]

then the twist by \(\chi\) is a modular form \(f_\chi\) with character \(\epsilon\chi^2\) and \(q\)-expansion

\[f_\chi(q) = \sum_{n=0}^\infty \chi(n) a_n q^n.\]

INPUT:

  • chi – a Dirichlet character
  • level – (optional) the level \(N\) of the twisted form. By default, the algorithm chooses some not necessarily minimal value for \(N\) using [AL1978], Proposition 3.1, (See also [Kob1993], Proposition III.3.17, for a simpler but slightly weaker bound.)

OUTPUT:

The form \(f_\chi\) as an element of the space of modular forms for \(\Gamma_1(N)\) with character \(\epsilon\chi^2\).

EXAMPLES:

sage: f = CuspForms(11, 2).0
sage: f.parent()
Cuspidal subspace of dimension 1 of Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field
sage: f.q_expansion(6)
q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6)
sage: eps = DirichletGroup(3).0
sage: eps.parent()
Group of Dirichlet characters modulo 3 with values in Cyclotomic Field of order 2 and degree 1
sage: f_eps = f.twist(eps)
sage: f_eps.parent()
Cuspidal subspace of dimension 9 of Modular Forms space of dimension 16 for Congruence Subgroup Gamma0(99) of weight 2 over Cyclotomic Field of order 2 and degree 1
sage: f_eps.q_expansion(6)
q + 2*q^2 + 2*q^4 - q^5 + O(q^6)

Modular forms without character are supported:

sage: M = ModularForms(Gamma1(5), 2)
sage: f = M.gen(0); f
1 + 60*q^3 - 120*q^4 + 240*q^5 + O(q^6)
sage: chi = DirichletGroup(2)[0]
sage: f.twist(chi)
60*q^3 + 240*q^5 + O(q^6)

The base field of the twisted form is extended if necessary:

sage: E4 = ModularForms(1, 4).gen(0)
sage: E4.parent()
Modular Forms space of dimension 1 for Modular Group SL(2,Z) of weight 4 over Rational Field
sage: chi = DirichletGroup(5)[1]
sage: chi.base_ring()
Cyclotomic Field of order 4 and degree 2
sage: E4_chi = E4.twist(chi)
sage: E4_chi.parent()
Modular Forms space of dimension 10, character [-1] and weight 4 over Cyclotomic Field of order 4 and degree 2

REFERENCES:

AUTHORS:

  • L. J. P. Kilford (2009-08-28)
  • Peter Bruin (2015-03-30)
class sage.modular.modform.element.ModularFormElement_elliptic_curve(parent, E)

Bases: sage.modular.modform.element.ModularFormElement

A modular form attached to an elliptic curve over \(\QQ\).

atkin_lehner_eigenvalue(d=None, embedding=None)

Return the result of the Atkin-Lehner operator \(W_d\) on self.

INPUT:

  • d – a positive integer exactly dividing the level \(N\) of self, i.e. \(d\) divides \(N\) and is coprime to \(N/d\). (Defaults to \(d = N\) if not given.)
  • embedding – ignored (but accepted for compatibility with Newform.atkin_lehner_action())

OUTPUT:

The Atkin-Lehner eigenvalue of \(W_d\) on self. This is either \(1\) or \(-1\).

EXAMPLES:

sage: EllipticCurve('57a1').newform().atkin_lehner_eigenvalue()
1
sage: EllipticCurve('57b1').newform().atkin_lehner_eigenvalue()
-1
sage: EllipticCurve('57b1').newform().atkin_lehner_eigenvalue(19)
1
elliptic_curve()

Return elliptic curve associated to self.

EXAMPLES:

sage: E = EllipticCurve('11a')
sage: f = E.modular_form()
sage: f.elliptic_curve()
Elliptic Curve defined by y^2 + y = x^3 - x^2 - 10*x - 20 over Rational Field
sage: f.elliptic_curve() is E
True
class sage.modular.modform.element.ModularForm_abstract

Bases: sage.structure.element.ModuleElement

Constructor for generic class of a modular form. This should never be called directly; instead one should instantiate one of the derived classes of this class.

atkin_lehner_eigenvalue(d=None, embedding=None)

Return the eigenvalue of the Atkin-Lehner operator \(W_d\) acting on self.

INPUT:

  • d – a positive integer exactly dividing the level \(N\) of self, i.e. \(d\) divides \(N\) and is coprime to \(N/d\) (default: \(d = N\))
  • embedding – (optional) embedding of the base ring of self into another ring

OUTPUT:

The Atkin-Lehner eigenvalue of \(W_d\) on self. This is returned as an element of the codomain of embedding if specified, and in (a suitable extension of) the base field of self otherwise.

If self is not an eigenform for \(W_d\), a ValueError is raised.

See also

sage.modular.hecke.module.HeckeModule_free_module.atkin_lehner_operator() (especially for the conventions used to define the operator \(W_d\)).

EXAMPLES:

sage: CuspForms(1, 12).0.atkin_lehner_eigenvalue()
1
sage: CuspForms(2, 8).0.atkin_lehner_eigenvalue()
Traceback (most recent call last):
...
NotImplementedError: Don't know how to compute Atkin-Lehner matrix acting on this space (try using a newform constructor instead)
base_ring()

Return the base_ring of self.

EXAMPLES:

sage: (ModularForms(117, 2).13).base_ring()
Rational Field
sage: (ModularForms(119, 2, base_ring=GF(7)).12).base_ring()
Finite Field of size 7
character(compute=True)

Return the character of self. If compute=False, then this will return None unless the form was explicitly created as an element of a space of forms with character, skipping the (potentially expensive) computation of the matrices of the diamond operators.

EXAMPLES:

sage: ModularForms(DirichletGroup(17).0^2,2).2.character()
Dirichlet character modulo 17 of conductor 17 mapping 3 |--> zeta8

sage: CuspForms(Gamma1(7), 3).gen(0).character()
Dirichlet character modulo 7 of conductor 7 mapping 3 |--> -1
sage: CuspForms(Gamma1(7), 3).gen(0).character(compute = False) is None
True
sage: M = CuspForms(Gamma1(7), 5).gen(0).character()
Traceback (most recent call last):
...
ValueError: Form is not an eigenvector for <3>
cm_discriminant()

Return the discriminant of the CM field associated to this form. An error will be raised if the form isn’t of CM type.

EXAMPLES:

sage: Newforms(49, 2)[0].cm_discriminant()
-7
sage: CuspForms(1, 12).gen(0).cm_discriminant()
Traceback (most recent call last):
...
ValueError: Not a CM form
coefficients(X)

The coefficients a_n of self, for integers n>=0 in the list X. If X is an Integer, return coefficients for indices from 1 to X.

This function caches the results of the compute function.

cuspform_lseries(*args, **kwds)

Deprecated: Use lseries() instead. See trac ticket #16917 for details.

group()

Return the group for which self is a modular form.

EXAMPLES:

sage: ModularForms(Gamma1(11), 2).gen(0).group()
Congruence Subgroup Gamma1(11)
has_cm()

Return whether the modular form self has complex multiplication.

OUTPUT:

Boolean

See also

  • cm_discriminant() (to return the CM field)
  • sage.schemes.elliptic_curves.ell_rational_field.has_cm()

EXAMPLES:

sage: G = DirichletGroup(21); eps = G.0 * G.1
sage: Newforms(eps, 2)[0].has_cm()
True

This example illustrates what happens when candidate_characters(self) is the empty list.

sage: M = ModularForms(Gamma0(1), 12)
sage: C = M.cuspidal_submodule()
sage: Delta = C.gens()[0]
sage: Delta.has_cm()
False

We now compare the function has_cm between elliptic curves and their associated modular forms.

sage: E = EllipticCurve([-1, 0])
sage: f = E.modular_form()
sage: f.has_cm()
True
sage: E.has_cm() == f.has_cm()
True

Here is a non-cm example coming from elliptic curves.

sage: E = EllipticCurve('11a')
sage: f = E.modular_form()
sage: f.has_cm()
False
sage: E.has_cm() == f.has_cm()
True
level()

Return the level of self.

EXAMPLES:

sage: ModularForms(25,4).0.level()
25
lseries(embedding=0, prec=53, max_imaginary_part=0, max_asymp_coeffs=40, conjugate=None)

Return the L-series of the weight k cusp form \(f\) on \(\Gamma_0(N)\).

This actually returns an interface to Tim Dokchitser’s program for computing with the L-series of the cusp form.

INPUT:

  • embedding - either an embedding of the coefficient field of self into \(\CC\), or an integer \(i\) between 0 and D-1 where D is the degree of the coefficient field (meaning to pick the \(i\)-th embedding). (Default: 0)
  • prec - integer (bits precision). Default: 53.
  • max_imaginary_part - real number. Default: 0.
  • max_asymp_coeffs - integer. Default: 40.
  • conjugate – deprecated synonym for embedding.

For more information on the significance of the last three arguments, see dokchitser.

Note

If an explicit embedding is given, but this embedding is specified to smaller precision than prec, it will be automatically refined to precision prec.

OUTPUT:

The L-series of the cusp form, as a sage.lfunctions.dokchitser.Dokchitser object.

EXAMPLES:

sage: f = CuspForms(2,8).newforms()[0]
sage: L = f.lseries()
sage: L
L-series associated to the cusp form q - 8*q^2 + 12*q^3 + 64*q^4 - 210*q^5 + O(q^6)
sage: L(1)
0.0884317737041015
sage: L(0.5)
0.0296568512531983

As a consistency check, we verify that the functional equation holds:

sage: abs(L.check_functional_equation()) < 1.0e-20
True

For non-rational newforms we can specify an embedding of the coefficient field:

sage: f = Newforms(43, names='a')[1]
sage: K = f.hecke_eigenvalue_field()
sage: phi1, phi2 = K.embeddings(CC)
sage: L = f.lseries(embedding=phi1)
sage: L
L-series associated to the cusp form q + a1*q^2 - a1*q^3 + (-a1 + 2)*q^5 + O(q^6), a1=-1.41421356237310
sage: L(1)
0.620539857407845
sage: L = f.lseries(embedding=1)
sage: L(1)
0.921328017272472

For backward-compatibility, conjugate is accepted as a synonym for embedding:

sage: f.lseries(conjugate=1)
doctest:...: DeprecationWarning: The argument 'conjugate' for 'lseries' is deprecated -- use the synonym 'embedding'
See http://trac.sagemath.org/19668 for details.
L-series associated to the cusp form q + a1*q^2 - a1*q^3 + (-a1 + 2)*q^5 + O(q^6), a1=1.41421356237310

An example with a non-real coefficient field (\(\QQ(\zeta_3)\) in this case):

sage: f = Newforms(Gamma1(13), 2, names='a')[0]
sage: f.lseries(embedding=0)(1)
0.298115272465799 - 0.0402203326076734*I
sage: f.lseries(embedding=1)(1)
0.298115272465799 + 0.0402203326076732*I

We compute with the L-series of the Eisenstein series \(E_4\):

sage: f = ModularForms(1,4).0
sage: L = f.lseries()
sage: L(1)
-0.0304484570583933
sage: L = eisenstein_series_lseries(4)
sage: L(1)
-0.0304484570583933

Consistency check with delta_lseries (which computes coefficients in pari):

sage: delta = CuspForms(1,12).0
sage: L = delta.lseries()
sage: L(1)
0.0374412812685155
sage: L = delta_lseries()
sage: L(1)
0.0374412812685155

We check that trac ticket #5262 is fixed:

sage: E = EllipticCurve('37b2')
sage: h = Newforms(37)[1]
sage: Lh = h.lseries()
sage: LE = E.lseries()
sage: Lh(1), LE(1)
(0.725681061936153, 0.725681061936153)
sage: CuspForms(1, 30).0.lseries().eps
-1.00000000000000

We check that trac ticket #25369 is fixed:

sage: f5 = Newforms(Gamma1(4), 5, names='a')[0]; f5
q - 4*q^2 + 16*q^4 - 14*q^5 + O(q^6)
sage: L5 = f5.lseries()
sage: abs(L5.check_functional_equation()) < 1e-15
True
sage: abs(L5(4) - (gamma(1/4)^8/(3840*pi^2)).n()) < 1e-15
True

We can change the precision (in bits):

sage: f = Newforms(389, names='a')[0]
sage: L = f.lseries(prec=30)
sage: abs(L(1)) < 2^-30
True
sage: L = f.lseries(prec=53)
sage: abs(L(1)) < 2^-53
True
sage: L = f.lseries(prec=100)
sage: abs(L(1)) < 2^-100
True

sage: f = Newforms(27, names='a')[0]
sage: L = f.lseries()
sage: L(1)
0.588879583428483
padded_list(n)

Return a list of length n whose entries are the first n coefficients of the q-expansion of self.

EXAMPLES:

sage: CuspForms(1,12).0.padded_list(20)
[0, 1, -24, 252, -1472, 4830, -6048, -16744, 84480, -113643, -115920, 534612, -370944, -577738, 401856, 1217160, 987136, -6905934, 2727432, 10661420]
period(M, prec=53)

Return the period of self with respect to \(M\).

INPUT:

  • self – a cusp form \(f\) of weight 2 for \(Gamma_0(N)\)
  • M – an element of \(\Gamma_0(N)\)
  • prec – (default: 53) the working precision in bits. If \(f\) is a normalised eigenform, then the output is correct to approximately this number of bits.

OUTPUT:

A numerical approximation of the period \(P_f(M)\). This period is defined by the following integral over the complex upper half-plane, for any \(\alpha\) in \(\Bold{P}^1(\QQ)\):

\[P_f(M) = 2 \pi i \int_\alpha^{M(\alpha)} f(z) dz.\]

This is independent of the choice of \(\alpha\).

EXAMPLES:

sage: C = Newforms(11, 2)[0]
sage: m = C.group()(matrix([[-4, -3], [11, 8]]))
sage: C.period(m)
-0.634604652139776 - 1.45881661693850*I

sage: f = Newforms(15, 2)[0]
sage: g = Gamma0(15)(matrix([[-4, -3], [15, 11]]))
sage: f.period(g)  # abs tol 1e-15
2.17298044293747e-16 - 1.59624222213178*I

If \(E\) is an elliptic curve over \(\QQ\) and \(f\) is the newform associated to \(E\), then the periods of \(f\) are in the period lattice of \(E\) up to an integer multiple:

sage: E = EllipticCurve('11a3')
sage: f = E.newform()
sage: g = Gamma0(11)([3, 1, 11, 4])
sage: f.period(g)
0.634604652139777 + 1.45881661693850*I
sage: omega1, omega2 = E.period_lattice().basis()
sage: -2/5*omega1 + omega2
0.634604652139777 + 1.45881661693850*I

The integer multiple is 5 in this case, which is explained by the fact that there is a 5-isogeny between the elliptic curves \(J_0(5)\) and \(E\).

The elliptic curve \(E\) has a pair of modular symbols attached to it, which can be computed using the method sage.schemes.elliptic_curves.ell_rational_field.EllipticCurve_rational_field.modular_symbol(). These can be used to express the periods of \(f\) as exact linear combinations of the real and the imaginary period of \(E\):

sage: s = E.modular_symbol(sign=+1)
sage: t = E.modular_symbol(sign=-1, implementation="sage")
sage: s(3/11), t(3/11)
(1/10, 1/2)
sage: s(3/11)*omega1 + t(3/11)*2*omega2.imag()*I
0.634604652139777 + 1.45881661693850*I

ALGORITHM:

We use the series expression from [Cre1997], Chapter II, Proposition 2.10.3. The algorithm sums the first \(T\) terms of this series, where \(T\) is chosen in such a way that the result would approximate \(P_f(M)\) with an absolute error of at most \(2^{-\text{prec}}\) if all computations were done exactly.

Since the actual precision is finite, the output is currently not guaranteed to be correct to prec bits of precision.

petersson_norm(embedding=0, prec=53)

Compute the Petersson scalar product of f with itself:

\[\langle f, f \rangle = \int_{\Gamma_0(N) \backslash \mathbb{H}} |f(x + iy)|^2 y^k\, \mathrm{d}x\, \mathrm{d}y.\]

Only implemented for N = 1 at present. It is assumed that \(f\) has real coefficients. The norm is computed as a special value of the symmetric square L-function, using the identity

\[\langle f, f \rangle = \frac{(k-1)! L(\mathrm{Sym}^2 f, k)}{2^{2k-1} \pi^{k+1}}\]

INPUT:

  • embedding: embedding of the coefficient field into \(\RR\) or \(\CC\), or an integer \(i\) (interpreted as the \(i\)-th embedding) (default: 0)
  • prec (integer, default 53): precision in bits

EXAMPLES:

sage: CuspForms(1, 16).0.petersson_norm()
verbose -1 (...: dokchitser.py, __call__) Warning: Loss of 2 decimal digits due to cancellation
2.16906134759063e-6

The Petersson norm depends on a choice of embedding:

sage: set_verbose(-2, "dokchitser.py") # disable precision-loss warnings
sage: F = Newforms(1, 24, names='a')[0]
sage: F.petersson_norm(embedding=0)
0.000107836545077234
sage: F.petersson_norm(embedding=1)
0.000128992800758160
prec()

Return the precision to which self.q_expansion() is currently known. Note that this may be 0.

EXAMPLES:

sage: M = ModularForms(2,14)
sage: f = M.0
sage: f.prec()
0

sage: M.prec(20)
20
sage: f.prec()
0
sage: x = f.q_expansion() ; f.prec()
20
q_expansion(prec=None)

The \(q\)-expansion of the modular form to precision \(O(q^\text{prec})\). This function takes one argument, which is the integer prec.

EXAMPLES:

We compute the cusp form \(\Delta\):

sage: delta = CuspForms(1,12).0
sage: delta.q_expansion()
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)

We compute the \(q\)-expansion of one of the cusp forms of level 23:

sage: f = CuspForms(23,2).0
sage: f.q_expansion()
q - q^3 - q^4 + O(q^6)
sage: f.q_expansion(10)
q - q^3 - q^4 - 2*q^6 + 2*q^7 - q^8 + 2*q^9 + O(q^10)
sage: f.q_expansion(2)
q + O(q^2)
sage: f.q_expansion(1)
O(q^1)
sage: f.q_expansion(0)
O(q^0)
sage: f.q_expansion(-1)
Traceback (most recent call last):
...
ValueError: prec (= -1) must be non-negative
qexp(prec=None)

Same as self.q_expansion(prec).

See also

q_expansion()

EXAMPLES:

sage: CuspForms(1,12).0.qexp()
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)
symsquare_lseries(chi=None, embedding=0, prec=53)

Compute the symmetric square L-series of this modular form, twisted by the character \(\chi\).

INPUT:

  • chi – Dirichlet character to twist by, or None (default None, interpreted as the trivial character).
  • embedding – embedding of the coefficient field into \(\RR\) or \(\CC\), or an integer \(i\) (in which case take the \(i\)-th embedding)
  • prec – The desired precision in bits (default 53).

OUTPUT: The symmetric square L-series of the cusp form, as a sage.lfunctions.dokchitser.Dokchitser object.

EXAMPLES:

sage: CuspForms(1, 12).0.symsquare_lseries()(22)
0.999645711124771

An example twisted by a nontrivial character:

sage: psi = DirichletGroup(7).0^2
sage: L = CuspForms(1, 16).0.symsquare_lseries(psi)
sage: L(22)
0.998407750967420 - 0.00295712911510708*I

An example with coefficients not in \(\QQ\):

sage: F = Newforms(1, 24, names='a')[0]
sage: K = F.hecke_eigenvalue_field()
sage: phi = K.embeddings(RR)[0]
sage: L = F.symsquare_lseries(embedding=phi)
sage: L(5)
verbose -1 (...: dokchitser.py, __call__) Warning: Loss of 8 decimal digits due to cancellation
-3.57698266793901e19

AUTHORS:

  • Martin Raum (2011) – original code posted to sage-nt
  • David Loeffler (2015) – added support for twists, integrated into Sage library
valuation()

Return the valuation of self (i.e. as an element of the power series ring in q).

EXAMPLES:

sage: ModularForms(11,2).0.valuation()
1
sage: ModularForms(11,2).1.valuation()
0
sage: ModularForms(25,6).1.valuation()
2
sage: ModularForms(25,6).6.valuation()
7
weight()

Return the weight of self.

EXAMPLES:

sage: (ModularForms(Gamma1(9),2).6).weight()
2
class sage.modular.modform.element.Newform(parent, component, names, check=True)

Bases: sage.modular.modform.element.ModularForm_abstract

Initialize a Newform object.

INPUT:

  • parent - An ambient cuspidal space of modular forms for which self is a newform.
  • component - A simple component of a cuspidal modular symbols space of any sign corresponding to this newform.
  • check - If check is True, check that parent and component have the same weight, level, and character, that component has sign 1 and is simple, and that the types are correct on all inputs.

EXAMPLES:

sage: sage.modular.modform.element.Newform(CuspForms(11,2), ModularSymbols(11,2,sign=1).cuspidal_subspace(), 'a')
q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6)

sage: f = Newforms(DirichletGroup(5).0, 7,names='a')[0]; f[2].trace(f.base_ring().base_field())
-5*zeta4 - 5
abelian_variety()

Return the abelian variety associated to self.

EXAMPLES:

sage: Newforms(14,2)[0]
q - q^2 - 2*q^3 + q^4 + O(q^6)
sage: Newforms(14,2)[0].abelian_variety()
Newform abelian subvariety 14a of dimension 1 of J0(14)
sage: Newforms(1, 12)[0].abelian_variety()
Traceback (most recent call last):
...
TypeError: f must have weight 2
atkin_lehner_action(d=None, normalization='analytic', embedding=None)

Return the result of the Atkin-Lehner operator \(W_d\) on this form \(f\), in the form of a constant \(\lambda_d(f)\) and a normalized newform \(f'\) such that

\[f \mid W_d = \lambda_d(f) f'.\]

See atkin_lehner_eigenvalue() for further details.

EXAMPLES:

sage: f = Newforms(DirichletGroup(30).1^2, 2, names='a')[0]
sage: emb = f.base_ring().complex_embeddings()[0]
sage: for d in divisors(30):
....:     print(f.atkin_lehner_action(d, embedding=emb))
(1.00000000000000, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(-1.00000000000000*I, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(1.00000000000000*I, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(-0.894427190999916 + 0.447213595499958*I, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))
(1.00000000000000, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(-0.447213595499958 - 0.894427190999916*I, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))
(0.447213595499958 + 0.894427190999916*I, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))
(-0.894427190999916 + 0.447213595499958*I, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))

The above computation can also be done exactly:

sage: K.<z> = CyclotomicField(20)
sage: f = Newforms(DirichletGroup(30).1^2, 2, names='a')[0]
sage: emb = f.base_ring().embeddings(CyclotomicField(20, 'z'))[0]
sage: for d in divisors(30):
....:     print(f.atkin_lehner_action(d, embedding=emb))
(1, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(z^5, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(-z^5, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(-2/5*z^7 + 4/5*z^6 + 1/5*z^5 - 4/5*z^4 - 2/5*z^3 - 2/5, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))
(1, q + a0*q^2 - a0*q^3 - q^4 + (a0 - 2)*q^5 + O(q^6))
(4/5*z^7 + 2/5*z^6 - 2/5*z^5 - 2/5*z^4 + 4/5*z^3 - 1/5, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))
(-4/5*z^7 - 2/5*z^6 + 2/5*z^5 + 2/5*z^4 - 4/5*z^3 + 1/5, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))
(-2/5*z^7 + 4/5*z^6 + 1/5*z^5 - 4/5*z^4 - 2/5*z^3 - 2/5, q - a0*q^2 + a0*q^3 - q^4 + (-a0 - 2)*q^5 + O(q^6))

We can compute the eigenvalue of \(W_{p^e}\) in certain cases where the \(p\)-th coefficient of \(f\) is zero:

sage: f = Newforms(169, names='a')[0]; f
q + a0*q^2 + 2*q^3 + q^4 - a0*q^5 + O(q^6)
sage: f[13]
0
sage: f.atkin_lehner_eigenvalue(169)
-1

An example showing the non-multiplicativity of the pseudo-eigenvalues:

sage: chi = DirichletGroup(18).0^4
sage: f = Newforms(chi, 2)[0]
sage: w2, _ = f.atkin_lehner_action(2); w2
zeta6
sage: w9, _ = f.atkin_lehner_action(9); w9
-zeta18^4
sage: w18,_ = f.atkin_lehner_action(18); w18
-zeta18
sage: w18 == w2 * w9 * chi( crt(2, 9, 9, 2) )
True
atkin_lehner_eigenvalue(d=None, normalization='analytic', embedding=None)

Return the pseudo-eigenvalue of the Atkin-Lehner operator \(W_d\) acting on this form \(f\).

INPUT:

  • d – a positive integer exactly dividing the level \(N\) of \(f\), i.e. \(d\) divides \(N\) and is coprime to \(N/d\). The default is \(d = N\).

    If \(d\) does not divide \(N\) exactly, then it will be replaced with a multiple \(D\) of \(d\) such that \(D\) exactly divides \(N\) and \(D\) has the same prime factors as \(d\). An error will be raised if \(d\) does not divide \(N\).

  • normalization – either 'analytic' (the default) or 'arithmetic'; see below.

  • embedding – (optional) embedding of the coefficient field of \(f\) into another ring. Ignored if \('normalization='arithmetic'`\).

OUTPUT:

The Atkin-Lehner pseudo-eigenvalue of \(W_d\) on \(f\), as an element of the coefficient field of \(f\), or the codomain of embedding if specified.

As defined in [AL1978], the pseudo-eigenvalue is the constant \(\lambda_d(f)\) such that

..math:

f \mid W_d = \lambda_d(f) f'

where \(f'\) is some normalised newform (not necessarily equal to \(f\)).

If normalisation='analytic' (the default), this routine will compute \(\lambda_d\), using the conventions of [AL1978] for the weight \(k\) action, which imply that \(\lambda_d\) has complex absolute value 1. However, with these conventions \(\lambda_d\) is not in the Hecke eigenvalue field of \(f\) in general, so it is often necessary to specify an embedding of the eigenvalue field into a larger ring (which needs to contain roots of unity of sufficiently large order, and a square root of \(d\) if \(k\) is odd).

If normalisation='arithmetic' we compute instead the quotient

..math:

d^{k/2-1} \lambda_d(f) \varepsilon_{N/d}(d / d_0) / G(\varepsilon_d),

where \(G(\varepsilon_d)\) is the Gauss sum of the \(d\)-primary part of the nebentype of \(f\) (more precisely, of its associated primitive character), and \(d_0\) its conductor. This ratio is always in the Hecke eigenvalue field of \(f\) (and can be computed using only arithmetic in this field), so specifying an embedding is not needed, although we still allow it for consistency.

(Note that if \(k = 2\) and \(\varepsilon\) is trivial, both normalisations coincide.)

See also

  • sage.modular.hecke.module.atkin_lehner_operator() (especially for the conventions used to define the operator \(W_d\))
  • atkin_lehner_action(), which returns both the pseudo-eigenvalue and the newform \(f'\).

EXAMPLES:

sage: [x.atkin_lehner_eigenvalue() for x in ModularForms(53).newforms('a')]
[1, -1]

sage: f = Newforms(Gamma1(15), 3, names='a')[2]; f
q + a2*q^2 + (-a2 - 2)*q^3 - q^4 - a2*q^5 + O(q^6)
sage: f.atkin_lehner_eigenvalue(5)
Traceback (most recent call last):
...
ValueError: Unable to compute square root. Try specifying an embedding into a larger ring
sage: L = f.hecke_eigenvalue_field(); x = polygen(QQ); M.<sqrt5> = L.extension(x^2 - 5)
sage: f.atkin_lehner_eigenvalue(5, embedding=M.coerce_map_from(L))
1/5*a2*sqrt5
sage: f.atkin_lehner_eigenvalue(5, normalization='arithmetic')
a2

sage: Newforms(DirichletGroup(5).0^2, 6, names='a')[0].atkin_lehner_eigenvalue()
Traceback (most recent call last):
...
ValueError: Unable to compute Gauss sum. Try specifying an embedding into a larger ring
character()

The nebentypus character of this newform (as a Dirichlet character with values in the field of Hecke eigenvalues of the form).

EXAMPLES:

sage: Newforms(Gamma1(7), 4,names='a')[1].character()
Dirichlet character modulo 7 of conductor 7 mapping 3 |--> 1/2*a1
sage: chi = DirichletGroup(3).0; Newforms(chi, 7)[0].character() == chi
True
coefficient(n)

Return the coefficient of \(q^n\) in the power series of self.

INPUT:

  • n - a positive integer

OUTPUT:

  • the coefficient of \(q^n\) in the power series of self.

EXAMPLES:

sage: f = Newforms(11)[0]; f
q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6)
sage: f.coefficient(100)
-8

sage: g = Newforms(23, names='a')[0]; g
q + a0*q^2 + (-2*a0 - 1)*q^3 + (-a0 - 1)*q^4 + 2*a0*q^5 + O(q^6)
sage: g.coefficient(3)
-2*a0 - 1
element()

Find an element of the ambient space of modular forms which represents this newform.

Note

This can be quite expensive. Also, the polynomial defining the field of Hecke eigenvalues should be considered random, since it is generated by a random sum of Hecke operators. (The field itself is not random, of course.)

EXAMPLES:

sage: ls = Newforms(38,4,names='a')
sage: ls[0]
q - 2*q^2 - 2*q^3 + 4*q^4 - 9*q^5 + O(q^6)
sage: ls # random
[q - 2*q^2 - 2*q^3 + 4*q^4 - 9*q^5 + O(q^6),
q - 2*q^2 + (-a1 - 2)*q^3 + 4*q^4 + (2*a1 + 10)*q^5 + O(q^6),
q + 2*q^2 + (1/2*a2 - 1)*q^3 + 4*q^4 + (-3/2*a2 + 12)*q^5 + O(q^6)]
sage: type(ls[0])
<class 'sage.modular.modform.element.Newform'>
sage: ls[2][3].minpoly()
x^2 - 9*x + 2
sage: ls2 = [ x.element() for x in ls ]
sage: ls2 # random
[q - 2*q^2 - 2*q^3 + 4*q^4 - 9*q^5 + O(q^6),
q - 2*q^2 + (-a1 - 2)*q^3 + 4*q^4 + (2*a1 + 10)*q^5 + O(q^6),
q + 2*q^2 + (1/2*a2 - 1)*q^3 + 4*q^4 + (-3/2*a2 + 12)*q^5 + O(q^6)]
sage: type(ls2[0])
<class 'sage.modular.modform.cuspidal_submodule.CuspidalSubmodule_g0_Q_with_category.element_class'>
sage: ls2[2][3].minpoly()
x^2 - 9*x + 2
hecke_eigenvalue_field()

Return the field generated over the rationals by the coefficients of this newform.

EXAMPLES:

sage: ls = Newforms(35, 2, names='a') ; ls
[q + q^3 - 2*q^4 - q^5 + O(q^6),
q + a1*q^2 + (-a1 - 1)*q^3 + (-a1 + 2)*q^4 + q^5 + O(q^6)]
sage: ls[0].hecke_eigenvalue_field()
Rational Field
sage: ls[1].hecke_eigenvalue_field()
Number Field in a1 with defining polynomial x^2 + x - 4
is_cuspidal()

Return True. For compatibility with elements of modular forms spaces.

EXAMPLES:

sage: Newforms(11, 2)[0].is_cuspidal()
True
modsym_eigenspace(sign=0)

Return a submodule of dimension 1 or 2 of the ambient space of the sign 0 modular symbols space associated to self, base-extended to the Hecke eigenvalue field, which is an eigenspace for the Hecke operators with the same eigenvalues as this newform, and is an eigenspace for the star involution of the appropriate sign if the sign is not 0.

EXAMPLES:

sage: N = Newform("37a")
sage: N.modular_symbols(0)
Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 5 for Gamma_0(37) of weight 2 with sign 0 over Rational Field
sage: M = N.modular_symbols(0)
sage: V = N.modsym_eigenspace(1); V
Vector space of degree 5 and dimension 1 over Rational Field
Basis matrix:
[ 0  1 -1  1  0]
sage: V.0 in M.free_module()
True
sage: V=N.modsym_eigenspace(-1); V
Vector space of degree 5 and dimension 1 over Rational Field
Basis matrix:
[   0    0    0    1 -1/2]
sage: V.0 in M.free_module()
True
modular_symbols(sign=0)

Return the subspace with the specified sign of the space of modular symbols corresponding to this newform.

EXAMPLES:

sage: f = Newforms(18,4)[0]
sage: f.modular_symbols()
Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 18 for Gamma_0(18) of weight 4 with sign 0 over Rational Field
sage: f.modular_symbols(1)
Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 11 for Gamma_0(18) of weight 4 with sign 1 over Rational Field
number()

Return the index of this space in the list of simple, new, cuspidal subspaces of the full space of modular symbols for this weight and level.

EXAMPLES:

sage: Newforms(43, 2, names='a')[1].number()
1
twist(chi, level=None, check=True)

Return the twist of the newform self by the Dirichlet character chi.

If self is a newform \(f\) with character \(\epsilon\) and \(q\)-expansion

\[f(q) = \sum_{n=1}^\infty a_n q^n,\]

then the twist by \(\chi\) is the unique newform \(f\otimes\chi\) with character \(\epsilon\chi^2\) and \(q\)-expansion

\[(f\otimes\chi)(q) = \sum_{n=1}^\infty b_n q^n\]

satisfying \(b_n = \chi(n) a_n\) for all but finitely many \(n\).

INPUT:

  • chi – a Dirichlet character. Note that Sage must be able to determine a common base field into which both the Hecke eigenvalue field of self, and the field of values of chi, can be embedded.
  • level – (optional) the level \(N\) of the twisted form. By default, the algorithm tries to compute \(N\) using [AL1978], Theorem 3.1.
  • check – (optional) boolean; if True (default), ensure that the space of modular symbols that is computed is genuinely simple and new. This makes it less likely that a wrong result is returned if an incorrect level is specified.

OUTPUT:

The form \(f\otimes\chi\) as an element of the set of newforms for \(\Gamma_1(N)\) with character \(\epsilon\chi^2\).

EXAMPLES:

sage: G = DirichletGroup(3, base_ring=QQ)
sage: Delta = Newforms(SL2Z, 12)[0]; Delta
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)
sage: Delta.twist(G[0]) == Delta
True
sage: Delta.twist(G[1])  # long time (about 5 s)
q + 24*q^2 - 1472*q^4 - 4830*q^5 + O(q^6)

sage: M = CuspForms(Gamma1(13), 2)
sage: f = M.newforms('a')[0]; f
q + a0*q^2 + (-2*a0 - 4)*q^3 + (-a0 - 1)*q^4 + (2*a0 + 3)*q^5 + O(q^6)
sage: f.twist(G[1])
q - a0*q^2 + (-a0 - 1)*q^4 + (-2*a0 - 3)*q^5 + O(q^6)

sage: f = Newforms(Gamma1(30), 2, names='a')[1]; f
q + a1*q^2 - a1*q^3 - q^4 + (a1 - 2)*q^5 + O(q^6)
sage: f.twist(f.character())
Traceback (most recent call last):
...
NotImplementedError: cannot calculate 5-primary part of the level of the twist of q + a1*q^2 - a1*q^3 - q^4 + (a1 - 2)*q^5 + O(q^6) by Dirichlet character modulo 5 of conductor 5 mapping 2 |--> -1
sage: f.twist(f.character(), level=30)
q - a1*q^2 + a1*q^3 - q^4 + (-a1 - 2)*q^5 + O(q^6)

AUTHORS:

  • Peter Bruin (April 2015)
sage.modular.modform.element.delta_lseries(prec=53, max_imaginary_part=0, max_asymp_coeffs=40)

Return the L-series of the modular form Delta.

This actually returns an interface to Tim Dokchitser’s program for computing with the L-series of the modular form \(\Delta\).

INPUT:

  • prec - integer (bits precision)
  • max_imaginary_part - real number
  • max_asymp_coeffs - integer

OUTPUT:

The L-series of \(\Delta\).

EXAMPLES:

sage: L = delta_lseries()
sage: L(1)
0.0374412812685155
sage.modular.modform.element.is_ModularFormElement(x)

Return True if x is a modular form.

EXAMPLES:

sage: from sage.modular.modform.element import is_ModularFormElement
sage: is_ModularFormElement(5)
False
sage: is_ModularFormElement(ModularForms(11).0)
True