Elements of modular forms spaces

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

TESTS:

sage: [ [ f.character() == chi for f in EisensteinForms(chi).eisenstein_series() ] for chi in DirichletGroup(17) ]
[[True], [], [True, True], [], [True, True], [], [True, True], [], [True, True], [], [True, True], [], [True, True], [], [True, True], []]

sage: [ [ f.character() == chi for f in EisensteinForms(chi).eisenstein_series() ] for chi in DirichletGroup(16) ]
[[True, True, True, True, True], [], [True, True], [], [True, True, True, True], [], [True, 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)

Return the eigenvalue of the Atkin-Lehner operator W_d acting on this modular form (which is either 1 or -1), or None if this form is not an eigenvector for this operator.

EXAMPLE:

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(prec=53, max_imaginary_part=0, max_asymp_coeffs=40)

Return the L-series of the weight \(k\) modular form \(f\) on \(\mathrm{SL}_2(\ZZ)\).

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

INPUT:

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

OUTPUT:

The L-series of the modular form.

EXAMPLES:

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

sage: f = ModularForms(1,4).0
sage: L = f.modform_lseries()
sage: L(1)
-0.0304484570583933
class sage.modular.modform.element.ModularFormElement_elliptic_curve(parent, E)

Bases: sage.modular.modform.element.ModularFormElement

A modular form attached to an elliptic curve.

atkin_lehner_eigenvalue(d=None)

Calculate the eigenvalue of the Atkin-Lehner operator W_d acting on this form. If d is None, default to the level of the form. As this form is attached to an elliptic curve, we can read this off from the root number of the curve if d is the level.

EXAMPLE:

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)

Return the eigenvalue of the Atkin-Lehner operator W_d acting on self (which is either 1 or -1), or None if this form is not an eigenvector for this operator. If d is not given or is None, use d = the level.

EXAMPLES:

sage: sage.modular.modform.element.ModularForm_abstract.atkin_lehner_eigenvalue(CuspForms(2, 8).0)
Traceback (most recent call last):
...
NotImplementedError
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>
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.

TESTS:

sage: e = DirichletGroup(11).gen()
sage: f = EisensteinForms(e, 3).eisenstein_series()[0]
sage: f.coefficients([0,1])
[15/11*zeta10^3 - 9/11*zeta10^2 - 26/11*zeta10 - 10/11,
1]
sage: f.coefficients([0,1,2,3])
[15/11*zeta10^3 - 9/11*zeta10^2 - 26/11*zeta10 - 10/11,
1,
4*zeta10 + 1,
-9*zeta10^3 + 1]
sage: f.coefficients([2,3])
[4*zeta10 + 1,
-9*zeta10^3 + 1]

Running this twice once revealed a bug, so we test it:

sage: f.coefficients([0,1,2,3])
[15/11*zeta10^3 - 9/11*zeta10^2 - 26/11*zeta10 - 10/11,
1,
4*zeta10 + 1,
-9*zeta10^3 + 1]
cuspform_lseries(prec=53, max_imaginary_part=0, max_asymp_coeffs=40)

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:

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

OUTPUT:

The L-series of the cusp form.

EXAMPLES:

sage: f = CuspForms(2,8).newforms()[0]
sage: L = f.cuspform_lseries()
sage: L(1)
0.0884317737041015
sage: L(0.5)
0.0296568512531983

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

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

We check that #5262 is fixed:

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

Return the group for which self is a modular form.

EXAMPLES:

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

Return the level of self.

EXAMPLES:

sage: ModularForms(25,4).0.level()
25
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 \(:meth:~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 a basis for the period lattice of \(E\):

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

ALGORITHM:

We use the series expression from [Cremona], 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.

REFERENCE:

[Cremona]J. E. Cremona, Algorithms for Modular Elliptic Curves. Cambridge University Press, 1997.

TESTS:

sage: C = Newforms(11, 2)[0]
sage: g = Gamma0(15)(matrix([[-4, -3], [15, 11]]))
sage: C.period(g)
Traceback (most recent call last):
...
TypeError: matrix [-4 -3]
                  [15 11]
is not an element of Congruence Subgroup Gamma0(11)
sage: f = Newforms(Gamma0(15), 4)[0]
sage: f.period(g)
Traceback (most recent call last):
...
ValueError: period pairing only defined for cusp forms of weight 2
sage: S = Newforms(Gamma1(17), 2, names='a')
sage: f = S[1]
sage: g = Gamma1(17)([18, 1, 17, 1])
sage: f.period(g)
Traceback (most recent call last):
...
NotImplementedError: period pairing only implemented for cusp forms of trivial character
sage: E = ModularForms(Gamma0(4), 2).eisenstein_series()[0]
sage: gamma = Gamma0(4)([1, 0, 4, 1])
sage: E.period(gamma)
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)
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)
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)
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)
atkin_lehner_eigenvalue(d=None)

Return the eigenvalue of the Atkin-Lehner operator W_d acting on this newform (which is either 1 or -1). A ValueError will be raised if the character of this form is not either trivial or quadratic. If d is not given or is None, then d defaults to the level of self.

EXAMPLE:

sage: [x.atkin_lehner_eigenvalue() for x in ModularForms(53).newforms('a')]
[1, -1]
sage: CuspForms(DirichletGroup(5).0, 5).newforms()[0].atkin_lehner_eigenvalue()
Traceback (most recent call last):
...
ValueError: Atkin-Lehner only leaves space invariant when character is trivial or quadratic.  In general it sends M_k(chi) to M_k(1/chi)
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
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.element.ModularFormElement'>
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
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
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

Previous topic

Eisenstein Series (optimized compiled functions)

Next topic

Hecke Operators on \(q\)-expansions

This Page