Ask Your Question

How to define an element in a space of Modular Forms and express it as a linear combination of basis elements?

asked 2012-01-28 16:34:33 -0500

Adrián Barquero gravatar image

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.

edit retag flag offensive close merge delete


Just as a note to any finding this - the author of the book answered regarding the content of the book piece at

kcrisman gravatar imagekcrisman ( 2014-11-03 13:36:42 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2012-06-21 07:00:16 -0500

Snark gravatar image

updated 2012-06-23 11:29:44 -0500

  1. 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.

edit flag offensive delete link more

answered 2017-03-27 22:55:09 -0500

dan_fulea gravatar image

Here 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

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

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


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$):

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-01-28 16:34:33 -0500

Seen: 526 times

Last updated: Mar 27