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

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()
...
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)
...
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()

Return the character of self.

EXAMPLES:

sage: ModularForms(DirichletGroup(17).0^2,2).2.character()
Dirichlet character modulo 17 of conductor 17 mapping 3 |--> zeta8
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]
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).

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

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()
...
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)
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

Next topic

Hecke Operators on q-expansions

This Page