Elements of modular forms spaces#
Class hierarchy:
AUTHORS:
William Stein (2004-2008): first version
David Ayotte (2021-06): GradedModularFormElement class
- class sage.modular.modform.element.EisensteinSeries(parent, vector, t, chi, psi)#
Bases:
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.GradedModularFormElement(parent, forms_datum)#
Bases:
ModuleElement
The element class for
ModularFormsRing
. AGradedModularFormElement
is basically a formal sum of modular forms of different weight: \(f_1 + f_2 + ... + f_n\). Note that aGradedModularFormElement
is not necessarily a modular form (as it can have mixed weight components).A
GradedModularFormElement
should not be constructed directly via this class. Instead, one should use the element constructor of the parent class (ModularFormsRing
).EXAMPLES:
sage: M = ModularFormsRing(1) sage: D = CuspForms(1, 12).0 sage: M(D).parent() Ring of Modular Forms for Modular Group SL(2,Z) over Rational Field
A graded modular form can be initiated via a dictionary or a list:
sage: E4 = ModularForms(1, 4).0 sage: M({4:E4, 12:D}) # dictionary 1 + 241*q + 2136*q^2 + 6972*q^3 + 16048*q^4 + 35070*q^5 + O(q^6) sage: M([E4, D]) # list 1 + 241*q + 2136*q^2 + 6972*q^3 + 16048*q^4 + 35070*q^5 + O(q^6)
Also, when adding two modular forms of different weights, a graded modular form element will be created:
sage: (E4 + D).parent() Ring of Modular Forms for Modular Group SL(2,Z) over Rational Field sage: M([E4, D]) == E4 + D True
Graded modular forms elements for congruence subgroups are also supported:
sage: M = ModularFormsRing(Gamma0(3)) sage: f = ModularForms(Gamma0(3), 4).0 sage: g = ModularForms(Gamma0(3), 2).0 sage: M([f, g]) 2 + 12*q + 36*q^2 + 252*q^3 + 84*q^4 + 72*q^5 + O(q^6) sage: M({4:f, 2:g}) 2 + 12*q + 36*q^2 + 252*q^3 + 84*q^4 + 72*q^5 + O(q^6)
- derivative(name='E2')#
Return the derivative \(q \frac{d}{dq}\) of the given graded form.
Note that this method returns an element of a new parent, that is a quasimodular form. If the form is not homogeneous, then this method sums the derivative of each homogeneous component.
INPUT:
name
(str, default: ‘E2’) – the name of the weight 2 Eisensteinseries generating the graded algebra of quasimodular forms over the ring of modular forms.
OUTPUT: a
sage.modular.quasimodform.element.QuasiModularFormsElement
EXAMPLES:
sage: M = ModularFormsRing(1) sage: E4 = M.0; E6 = M.1 sage: dE4 = E4.derivative(); dE4 240*q + 4320*q^2 + 20160*q^3 + 70080*q^4 + 151200*q^5 + O(q^6) sage: dE4.parent() Ring of Quasimodular Forms for Modular Group SL(2,Z) over Rational Field sage: dE4.is_modular_form() False
- group()#
Return the group for which
self
is a modular form.EXAMPLES:
sage: M = ModularFormsRing(1) sage: E4 = M.0 sage: E4.group() Modular Group SL(2,Z) sage: M5 = ModularFormsRing(Gamma1(5)) sage: f = M5(ModularForms(Gamma1(5)).0); sage: f.group() Congruence Subgroup Gamma1(5)
- homogeneous_component(weight)#
Return the homogeneous component of the given graded modular form.
INPUT:
weight
– An integer corresponding to the weight of the homogeneous component of the given graded modular form.
EXAMPLES:
sage: M = ModularFormsRing(1) sage: f4 = ModularForms(1, 4).0; f6 = ModularForms(1, 6).0; f8 = ModularForms(1, 8).0 sage: F = M(f4) + M(f6) + M(f8) sage: F[4] # indirect doctest 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6) sage: F[6] # indirect doctest 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6) sage: F[8] # indirect doctest 1 + 480*q + 61920*q^2 + 1050240*q^3 + 7926240*q^4 + 37500480*q^5 + O(q^6) sage: F[10] # indirect doctest 0 sage: F.homogeneous_component(4) 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6)
- is_homogeneous()#
Return True if the graded modular form is homogeneous, i.e. if it is a modular forms of a certain weight.
An alias of this method is
is_modular_form
EXAMPLES:
sage: M = ModularFormsRing(1) sage: E4 = M.0; E6 = M.1; sage: E4.is_homogeneous() True sage: F = E4 + E6 # Not a modular form sage: F.is_homogeneous() False
- is_modular_form()#
Return True if the graded modular form is homogeneous, i.e. if it is a modular forms of a certain weight.
An alias of this method is
is_modular_form
EXAMPLES:
sage: M = ModularFormsRing(1) sage: E4 = M.0; E6 = M.1; sage: E4.is_homogeneous() True sage: F = E4 + E6 # Not a modular form sage: F.is_homogeneous() False
- is_one()#
Return “True” if the graded form is 1 and “False” otherwise
EXAMPLES:
sage: M = ModularFormsRing(1) sage: M(1).is_one() True sage: M(2).is_one() False sage: E6 = M.0 sage: E6.is_one() False
- is_zero()#
Return “True” if the graded form is 0 and “False” otherwise
EXAMPLES:
sage: M = ModularFormsRing(1) sage: M(0).is_zero() True sage: M(1/2).is_zero() False sage: E6 = M.1 sage: M(E6).is_zero() False
- q_expansion(prec=None)#
Return the \(q\)-expansion of the graded modular form up to precision
prec
(default: 6).An alias of this method is
qexp
.EXAMPLES:
sage: M = ModularFormsRing(1) sage: zer = M(0); zer.q_expansion() 0 sage: M(5/7).q_expansion() 5/7 sage: E4 = M.0; E4 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6) sage: E6 = M.1; E6 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6) sage: F = E4 + E6; F 2 - 264*q - 14472*q^2 - 116256*q^3 - 515208*q^4 - 1545264*q^5 + O(q^6) sage: F.q_expansion() 2 - 264*q - 14472*q^2 - 116256*q^3 - 515208*q^4 - 1545264*q^5 + O(q^6) sage: F.q_expansion(10) 2 - 264*q - 14472*q^2 - 116256*q^3 - 515208*q^4 - 1545264*q^5 - 3997728*q^6 - 8388672*q^7 - 16907400*q^8 - 29701992*q^9 + O(q^10)
- qexp(prec=None)#
Return the \(q\)-expansion of the graded modular form up to precision
prec
(default: 6).An alias of this method is
qexp
.EXAMPLES:
sage: M = ModularFormsRing(1) sage: zer = M(0); zer.q_expansion() 0 sage: M(5/7).q_expansion() 5/7 sage: E4 = M.0; E4 1 + 240*q + 2160*q^2 + 6720*q^3 + 17520*q^4 + 30240*q^5 + O(q^6) sage: E6 = M.1; E6 1 - 504*q - 16632*q^2 - 122976*q^3 - 532728*q^4 - 1575504*q^5 + O(q^6) sage: F = E4 + E6; F 2 - 264*q - 14472*q^2 - 116256*q^3 - 515208*q^4 - 1545264*q^5 + O(q^6) sage: F.q_expansion() 2 - 264*q - 14472*q^2 - 116256*q^3 - 515208*q^4 - 1545264*q^5 + O(q^6) sage: F.q_expansion(10) 2 - 264*q - 14472*q^2 - 116256*q^3 - 515208*q^4 - 1545264*q^5 - 3997728*q^6 - 8388672*q^7 - 16907400*q^8 - 29701992*q^9 + O(q^10)
- serre_derivative()#
Return the Serre derivative of the given graded modular form.
If
self
is a modular form of weight \(k\), then the returned modular form will be of weight \(k + 2\). If the form is not homogeneous, then this method sums the Serre derivative of each homogeneous component.EXAMPLES:
sage: M = ModularFormsRing(1) sage: E4 = M.0 sage: E6 = M.1 sage: DE4 = E4.serre_derivative(); DE4 -1/3 + 168*q + 5544*q^2 + 40992*q^3 + 177576*q^4 + 525168*q^5 + O(q^6) sage: DE4 == (-1/3) * E6 True sage: DE6 = E6.serre_derivative(); DE6 -1/2 - 240*q - 30960*q^2 - 525120*q^3 - 3963120*q^4 - 18750240*q^5 + O(q^6) sage: DE6 == (-1/2) * E4^2 True sage: f = E4 + E6 sage: Df = f.serre_derivative(); Df -5/6 - 72*q - 25416*q^2 - 484128*q^3 - 3785544*q^4 - 18225072*q^5 + O(q^6) sage: Df == (-1/3) * E6 + (-1/2) * E4^2 True sage: M(1/2).serre_derivative() 0
- to_polynomial(names='x', gens=None)#
Return a polynomial \(P(x_0,..., x_n)\) such that \(P(g_0,..., g_n)\) is equal to
self
where \(g_0, ..., g_n\) is a list of generators of the parent.INPUT:
names
– a list or tuple of names (strings), or a comma separated string. Correspond to the names of the variables;gens
– (default: None) a list of generator of the parent ofself
. If set toNone
, the list returned bygen_forms()
is used instead
OUTPUT: A polynomial in the variables
names
EXAMPLES:
sage: M = ModularFormsRing(1) sage: (M.0 + M.1).to_polynomial() x1 + x0 sage: (M.0^10 + M.0 * M.1).to_polynomial() x0^10 + x0*x1
This method is not necessarily the inverse of
from_polynomial()
since there may be some relations between the generators of the modular forms ring:sage: M = ModularFormsRing(Gamma0(6)) sage: P.<x0,x1,x2> = M.polynomial_ring() sage: M.from_polynomial(x1^2).to_polynomial() x0*x2 + 2*x1*x2 + 11*x2^2
- weight()#
Return the weight of the given form if it is homogeneous (i.e. a modular form).
EXAMPLES:
sage: D = ModularForms(1,12).0; M = ModularFormsRing(1) sage: M(D).weight() 12 sage: M.zero().weight() 0 sage: e4 = ModularForms(1,4).0 sage: (M(D)+e4).weight() Traceback (most recent call last): ... ValueError: the given graded form is not homogeneous (not a modular form)
- weights_list()#
Return the list of the weights of all the homogeneous components of the given graded modular form.
EXAMPLES:
sage: M = ModularFormsRing(1) sage: f4 = ModularForms(1, 4).0; f6 = ModularForms(1, 6).0; f8 = ModularForms(1, 8).0 sage: F4 = M(f4); F6 = M(f6); F8 = M(f8) sage: F = F4 + F6 + F8 sage: F.weights_list() [4, 6, 8] sage: M(0).weights_list() [0]
- class sage.modular.modform.element.ModularFormElement(parent, x, check=True)#
Bases:
ModularForm_abstract
,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 parentcheck
- if check isTrue
, 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\) ofself
, i.e. \(d\) divides \(N\) and is coprime to \(N/d\). (Default: \(d = N\))embedding
– ignored (but accepted for compatibility withNewform.atkin_lehner_eigenvalue()
)
OUTPUT:
The Atkin-Lehner eigenvalue of \(W_d\) on
self
. Ifself
is not an eigenform for \(W_d\), aValueError
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)
- twist(chi, level=None)#
Return the twist of the modular form
self
by the Dirichlet characterchi
.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 characterlevel
– (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:
Newform
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\) ofself
, i.e. \(d\) divides \(N\) and is coprime to \(N/d\). (Defaults to \(d = N\) if not given.)embedding
– ignored (but accepted for compatibility withNewform.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:
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\) ofself
, i.e. \(d\) divides \(N\) and is coprime to \(N/d\) (default: \(d = N\))embedding
– (optional) embedding of the base ring ofself
into another ring
OUTPUT:
The Atkin-Lehner eigenvalue of \(W_d\) on
self
. This is returned as an element of the codomain ofembedding
if specified, and in (a suitable extension of) the base field ofself
otherwise.If
self
is not an eigenform for \(W_d\), aValueError
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)
- 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
- coefficient(n)#
Return the \(n\)-th coefficient of the \(q\)-expansion of self.
INPUT:
n
(int, Integer) - A non-negative integer.
EXAMPLES:
sage: f = ModularForms(1, 12).0; f q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6) sage: f.coefficient(0) 0 sage: f.coefficient(1) 1 sage: f.coefficient(2) -24 sage: f.coefficient(3) 252 sage: f.coefficient(4) -1472
- 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.
- 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
- is_homogeneous()#
Return true. For compatibility with elements of a graded modular forms ring.
An alias of this method is
is_modular_form
.See also
- meth:
\(sage.modular.modform.element.GradedModularFormElement.is_homogeneous\)
EXAMPLES:
sage: ModularForms(1,12).0.is_homogeneous() True
- is_modular_form()#
Return true. For compatibility with elements of a graded modular forms ring.
An alias of this method is
is_modular_form
.See also
- meth:
\(sage.modular.modform.element.GradedModularFormElement.is_homogeneous\)
EXAMPLES:
sage: ModularForms(1,12).0.is_homogeneous() 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)#
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.
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 precisionprec
.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
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
EXAMPLES:
sage: CuspForms(1,12).0.qexp() q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)
- serre_derivative()#
Return the Serre derivative of the given modular form.
If
self
is of weight \(k\), then the returned modular form will be of weight \(k+2\).EXAMPLES:
sage: E4 = ModularForms(1, 4).0 sage: E6 = ModularForms(1, 6).0 sage: DE4 = E4.serre_derivative(); DE4 -1/3 + 168*q + 5544*q^2 + 40992*q^3 + 177576*q^4 + 525168*q^5 + O(q^6) sage: DE6 = E6.serre_derivative(); DE6 -1/2 - 240*q - 30960*q^2 - 525120*q^3 - 3963120*q^4 - 18750240*q^5 + O(q^6) sage: Del = ModularForms(1, 12).0 # Modular discriminant sage: Del.serre_derivative() 0 sage: f = ModularForms(DirichletGroup(5).0, 1).0 sage: Df = f.serre_derivative(); Df -1/12 + (-11/12*zeta4 + 19/4)*q + (11/6*zeta4 + 59/3)*q^2 + (-41/3*zeta4 + 239/6)*q^3 + (31/4*zeta4 + 839/12)*q^4 + (-251/12*zeta4 + 459/4)*q^5 + O(q^6)
The Serre derivative raises the weight of a modular form by \(2\):
sage: DE4.weight() 6 sage: DE6.weight() 8 sage: Df.weight() 3
The Ramanujan identities are verified (see Wikipedia article Eisenstein_series#Ramanujan_identities):
sage: DE4 == (-1/3) * E6 True sage: DE6 == (-1/2) * E4 * E4 True
- 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:
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 isTrue
, 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
- local_component(p, twist_factor=None)#
Calculate the local component at the prime \(p\) of the automorphic representation attached to this newform. For more information, see the documentation of the
LocalComponent()
function.EXAMPLES:
sage: f = Newform("49a") sage: f.local_component(7) Smooth representation of GL_2(Q_7) with conductor 7^2
- minimal_twist(p=None)#
Compute a pair \((g, chi)\) such that \(g = f \otimes \chi\), where \(f\) is this newform and \(\chi\) is a Dirichlet character, such that \(g\) has level as small as possible. If the optional argument \(p\) is given, consider only twists by Dirichlet characters of \(p\)-power conductor.
EXAMPLES:
sage: f = Newforms(575, 2, names='a')[4] sage: g, chi = f.minimal_twist(5) sage: g q + a*q^2 - a*q^3 - 2*q^4 + (1/2*a + 2)*q^5 + O(q^6) sage: chi Dirichlet character modulo 5 of conductor 5 mapping 2 |--> 1/2*a sage: f.twist(chi, level=g.level()) == g 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 characterchi
.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 ofchi
, can be embedded.level
– (optional) the level \(N\) of the twisted form. If \(N\) is not given, the algorithm tries to compute \(N\) using [AL1978], Theorem 3.1; if this is not possible, it returns an error. If \(N\) is given but incorrect, i.e. the twisted form does not have level \(N\), then this function will attempt to detect this and return an error, but it may sometimes return an incorrect answer (a newform of level \(N\) whose first few coefficients agree with those of \(f \otimes \chi\)).check
– (optional) boolean; ifTrue
(default), ensure that the space of modular symbols that is computed is genuinely simple and new. This makes it less likely, but not impossible, that a wrong result is returned if an incorrectlevel
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, algorithm=None)#
Return the L-series of the modular form \(\Delta\).
If algorithm is “gp”, this returns an interface to Tim Dokchitser’s program for computing with the L-series of the modular form \(\Delta\).
If algorithm is “pari”, this returns instead an interface to Pari’s own general implementation of L-functions.
INPUT:
prec
– integer (bits precision)max_imaginary_part
– real numbermax_asymp_coeffs
– integeralgorithm
– optional string: ‘gp’ (default), ‘pari’
OUTPUT:
The L-series of \(\Delta\).
EXAMPLES:
sage: L = delta_lseries() sage: L(1) 0.0374412812685155 sage: L = delta_lseries(algorithm='pari') 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