ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 28 Mar 2017 05:55:09 +0200How to define an element in a space of Modular Forms and express it as a linear combination of basis elements?https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/Hello, I was trying to solve Exercise 1.4.5 in Alvaro Lozano-Robledo's book *Elliptic Curves, Modular Forms and Their L-functions*, which is about representations of integers as sums of 6 squares and its relation to the theta function
$$\Theta(q) = \sum_{j = -\infty}^{\infty} q^{j^2} $$
I need to define the space of modular forms $M_3(\Gamma_1(4))$ in SAGE, which I already did and find a basis for this 2-dimensional space. I was able to this without any problems.
>But now I'm asked to write $\Theta^6(q)$ as a linear combination of the basis elements just found. This prompts me to ask some questions.
>1) How do I define $\Theta(q)$ and how do I check that $\Theta^6(q) \in M_3(\Gamma_1(4))$?
>2) How would I express $\Theta^6(q)$ as a linear combination of the basis elements?
>3) More generally, is there a way in which one can specify some q-series expansion and ask SAGE if it is in a particular space of modular forms and if it is to express it as a linear combination of the basis elements?
I've already searched in the SAGE manual but I only found how to define Eisenstein series and the like. I apologize if my questions are not very well formulated.
Thank you very much in advance for any help.Sat, 28 Jan 2012 23:34:33 +0100https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/Comment by kcrisman for <p>Hello, I was trying to solve Exercise 1.4.5 in Alvaro Lozano-Robledo's book <em>Elliptic Curves, Modular Forms and Their L-functions</em>, which is about representations of integers as sums of 6 squares and its relation to the theta function</p>
<p>$$\Theta(q) = \sum_{j = -\infty}^{\infty} q^{j^2} $$</p>
<p>I need to define the space of modular forms $M_3(\Gamma_1(4))$ in SAGE, which I already did and find a basis for this 2-dimensional space. I was able to this without any problems. </p>
<blockquote>
<p>But now I'm asked to write $\Theta^6(q)$ as a linear combination of the basis elements just found. This prompts me to ask some questions.</p>
<p>1) How do I define $\Theta(q)$ and how do I check that $\Theta^6(q) \in M_3(\Gamma_1(4))$?</p>
<p>2) How would I express $\Theta^6(q)$ as a linear combination of the basis elements?</p>
<p>3) More generally, is there a way in which one can specify some q-series expansion and ask SAGE if it is in a particular space of modular forms and if it is to express it as a linear combination of the basis elements?</p>
</blockquote>
<p>I've already searched in the SAGE manual but I only found how to define Eisenstein series and the like. I apologize if my questions are not very well formulated.</p>
<p>Thank you very much in advance for any help.</p>
https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/?comment=24765#post-id-24765Just as a note to any finding this - the author of the book answered regarding the content of the book piece at http://math.stackexchange.com/questions/135472/a-question-about-modular-forms-in-sageMon, 03 Nov 2014 20:36:42 +0100https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/?comment=24765#post-id-24765Answer by dan_fulea for <p>Hello, I was trying to solve Exercise 1.4.5 in Alvaro Lozano-Robledo's book <em>Elliptic Curves, Modular Forms and Their L-functions</em>, which is about representations of integers as sums of 6 squares and its relation to the theta function</p>
<p>$$\Theta(q) = \sum_{j = -\infty}^{\infty} q^{j^2} $$</p>
<p>I need to define the space of modular forms $M_3(\Gamma_1(4))$ in SAGE, which I already did and find a basis for this 2-dimensional space. I was able to this without any problems. </p>
<blockquote>
<p>But now I'm asked to write $\Theta^6(q)$ as a linear combination of the basis elements just found. This prompts me to ask some questions.</p>
<p>1) How do I define $\Theta(q)$ and how do I check that $\Theta^6(q) \in M_3(\Gamma_1(4))$?</p>
<p>2) How would I express $\Theta^6(q)$ as a linear combination of the basis elements?</p>
<p>3) More generally, is there a way in which one can specify some q-series expansion and ask SAGE if it is in a particular space of modular forms and if it is to express it as a linear combination of the basis elements?</p>
</blockquote>
<p>I've already searched in the SAGE manual but I only found how to define Eisenstein series and the like. I apologize if my questions are not very well formulated.</p>
<p>Thank you very much in advance for any help.</p>
https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/?answer=37101#post-id-37101Here is a partial answer, regarding only the computational part of the answer, we get explicitly the representation of $\Theta^6(q)$ in terms of the sage basis $f_1, f_2$ of the space $M =M_3(\ \Gamma_1(4)\)$. The space has dimension two, as in the print of $M$ or as `M.dimension()` shows. We check that the first some 10 000 coefficients correspond in the obvious linear combination of $f_1$ and $f_2$, after we compute the $q$-expansion of $\Theta^6$.
sage: M3 = ModularForms( Gamma1(4), 3 )
sage: M3
Modular Forms space of dimension 2 for Congruence Subgroup Gamma1(4) of weight 3 over Rational Field
sage: f1, f2 = M3.basis()
sage: f1.qexp( 10 )
1 + 12*q^2 + 64*q^3 + 60*q^4 + 160*q^6 + 384*q^7 + 252*q^8 + O(q^10)
sage: f2.qexp( 10 )
q + 4*q^2 + 8*q^3 + 16*q^4 + 26*q^5 + 32*q^6 + 48*q^7 + 64*q^8 + 73*q^9 + O(q^10)
sage: theta_qexp( 10 )^6
1 + 12*q + 60*q^2 + 160*q^3 + 252*q^4 + 312*q^5 + 544*q^6 + 960*q^7 + 1020*q^8 + 876*q^9 + O(q^10)
sage: ( f1 + 12*f2 ).qexp(10000) - theta_qexp(10000)^6
O(q^10000)
In a similar "simpler" manner we can check for the coincidence of the appropriate $q$-expansions in the space $M_1(\ \Gamma_1(4)\ )$:
sage: M1 = ModularForms( Gamma1(4), 1 )
sage: M1
Modular Forms space of dimension 1 for Congruence Subgroup Gamma1(4) of weight 1 over Rational Field
sage: f, = M1.basis()
sage: f.qexp(10000) - theta_qexp(10000)^2
O(q^10000)
As the author of the book (with the exercise, Alvaro Lozano-Robledo, Elliptic Curves, Modular Forms and Their L-functions) also mentions in the above cited link
[http://math.stackexchange.com/questions/135472/a-question-about-modular-forms-in-sage](http://math.stackexchange.com/questions/135472/a-question-about-modular-forms-in-sage)
this does not gives a proof of $\Theta^2\in M_1(\ \Gamma_1(4)\ )=M(1,\chi)$, $\chi$ being given by $\chi(d)=(-1)^{(d-1)/2}$, GTM 97, Koblitz, N. - Introduction to elliptic curves and modular forms, Proposition 30, III.ยง3.
Postlude:
However, we can use sage to support the proof as follows. Let us introduce $S$, and $T\dots$
sage: G01 = Gamma0(1)
sage: G01.gens()
(
[ 0 -1] [1 1]
[ 1 0], [0 1]
)
sage: S, T = G01.gens()
Then $T$, $S T^4 S$, and $-I$ generate $\Gamma_0(4)$, although we get an other preference...
sage: G04 = Gamma0(4)
sage: G04.gens()
(
[1 1] [ 3 -1] [-1 0]
[0 1], [ 4 -1], [ 0 -1]
)
Then we have immediately the invariance of $\Theta$ w.r.t. $T$ and $-1$, need to consider only
sage: S * T^4 * S
[-1 0]
[ 4 -1]
sage: J, C = ( S * T^4 * S ).matrix().jordan_form( transformation=True )
sage: J, C # C is the base *C*hange matrix
(
[-1 1] [0 1]
[ 0 -1], [4 0]
)
sage: C * (-T.matrix()^(-1)) * C^(-1)
[-1 0]
[ 4 -1]
sage: # J is -T^(-1)
This is the starting point for the computation:
$$
\Theta\Big|_1\ (ST^4S)
= \Theta\ \Big|_1\ C(-T)C^{-1}
= \Theta\ \Big|_1\ C\ \Big|_1\ (-T)\ \Big|_1\ C^{-1}\ ,
$$
and $\Theta$ is invariated by $C$, we need for this the transformation formula for $\theta(-1/t)$, which transfers to a transformation formula for $\Theta(z)=\theta(-2i\, z)$. (The inverse of $C$ is a scalar times $C$.)
It remains to see that $\Theta$ is holomorphic in the cusps
sage: G04.cusps()
[0, 1/2, Infinity]
and we have no problems in $\tau=\infty$, which corresponds to $q=0$, then $C$ exchange $0$ and $\infty$, and for $1/2$ (and for me) the expansion of $\theta_{01}$ is a good start. A related link (for $\theta$ instead of $\Theta$):
[http://mathoverflow.net/questions/90772/order-of-vanishing-at-the-cusps-for-the-modular-theta-function]( http://mathoverflow.net/questions/90772/order-of-vanishing-at-the-cusps-for-the-modular-theta-function) Tue, 28 Mar 2017 05:55:09 +0200https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/?answer=37101#post-id-37101Answer by Snark for <p>Hello, I was trying to solve Exercise 1.4.5 in Alvaro Lozano-Robledo's book <em>Elliptic Curves, Modular Forms and Their L-functions</em>, which is about representations of integers as sums of 6 squares and its relation to the theta function</p>
<p>$$\Theta(q) = \sum_{j = -\infty}^{\infty} q^{j^2} $$</p>
<p>I need to define the space of modular forms $M_3(\Gamma_1(4))$ in SAGE, which I already did and find a basis for this 2-dimensional space. I was able to this without any problems. </p>
<blockquote>
<p>But now I'm asked to write $\Theta^6(q)$ as a linear combination of the basis elements just found. This prompts me to ask some questions.</p>
<p>1) How do I define $\Theta(q)$ and how do I check that $\Theta^6(q) \in M_3(\Gamma_1(4))$?</p>
<p>2) How would I express $\Theta^6(q)$ as a linear combination of the basis elements?</p>
<p>3) More generally, is there a way in which one can specify some q-series expansion and ask SAGE if it is in a particular space of modular forms and if it is to express it as a linear combination of the basis elements?</p>
</blockquote>
<p>I've already searched in the SAGE manual but I only found how to define Eisenstein series and the like. I apologize if my questions are not very well formulated.</p>
<p>Thank you very much in advance for any help.</p>
https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/?answer=13740#post-id-137401. It is not really a sage question, so I'll pass (let's just say that it's a theta series, so there's a quadratic form hidden).
2. You just need $\Theta(q)=a+bq+O(q^2)$, because then in terms of basis given by sage, it will be $a$ times the first plus $b$ times the second.
3. More generally, sage gives basis in a form that makes it pretty easy to read a conjectural linear combination from the first terms of the expansion ; if you already know you got the expansion from a modular forms in the right space, that will be enough to know the equality.
EDIT: you might be interested by the method find_in_space from the modular spaces objects.Thu, 21 Jun 2012 14:00:16 +0200https://ask.sagemath.org/question/8680/how-to-define-an-element-in-a-space-of-modular-forms-and-express-it-as-a-linear-combination-of-basis-elements/?answer=13740#post-id-13740