# A question about modular forms in SAGE

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)$ in SAGE 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.

Thank you very much in advance for any help.

• Ask at their dedicated Q&A site, you may get your answers sooner. – Sasha Apr 22 '12 at 19:57
• @Sasha Thanks for the suggestion, but actually I already did that more than two months ago and I didn't get any answers nor comments to the question. So I basically posted my question here. This is the link to the question ask.sagemath.org/question/1114/… – Adrián Barquero Apr 22 '12 at 19:59

Thank you for reading my book. I am not an expert in Sage, but I can tell you what I had in mind when I wrote that problem. The goal of the exercise is to work with $\Theta^6$ replicating what is done for $\Theta^4$ in Example 1.2.1 (towards the end of Section 1.2).
Showing that $\Theta^6 \in M_3(\Gamma_1(4))$ is far from trivial and in the context of Chapter 1 of the book, and more precisely for Exercise 1.4.5, you should assume that $\Theta^6\in M_3(\Gamma_1(4))$. If we assume this, we can compute a basis of the space in Sage, and just use a bit of linear algebra (again, as in Example 1.2.1) to find out what $\mathbb{C}$-linear combination of the basis elements add up to $\Theta^6$. If $M_3(\Gamma_1(4))$ is $n$-dimensional, with a basis $f_1,\ldots, f_n$, then $$\Theta^6 = \lambda_1f_1+\cdots + \lambda_nf_n,$$ for some $\lambda_i\in\mathbb{C}$. In order to find the constants $\lambda_i$, it suffices to solve a $n\times n$ system of equations that can be obtained from the first $n$ coefficients of $\Theta^6$ and those of $f_1,\ldots, f_n$.
About your specific questions: you can define in Sage $q$-expansions up to a certain precision, but the only way you can check whether a $q$-expansion corresponds to a modular form in a certain space of modular forms is precisely to do as I point out above: find a basis of the space, and check whether your form can be written as a linear combination of elements in the space... However, you can only check that this is the case up to a finite precision (say $O(q^{20})$) and you will not be able to prove in Sage that a $q$-expansion is truly in said space. You may have found compelling evidence that a $q$-expansion corresponds to a modular form of a certain space, but you will have to go back to the theory to show that the $q$-expansion is indeed a modular form, of the given weight, and modular for the appropriate congruence subgroup.
In the particular case of $\Theta^2$, you can find the proof that $\Theta^2\in M_1(\Gamma_1(4))$, for instance, in Koblitz's "Introduction to Elliptic Curves and Modular Forms", Proposition 30 of Chapter III, Section $\S 3$.