CoCalc -- Collaborative Calculation in the Cloud
\documentclass{article}
\include{macros}
%\usepackage{fullpage}

\begin{document}
\begin{center}
{\bf \Large \sc HECKE: The Modular Forms Calculator}\vspace{1ex}\\
William A. Stein\\
\end{center}

\head{What is \hecke{}?}\hecke{} is a program for computing with
modular forms. It implements algorithms of Cremona, Hijikata,
Merel, Mestre-Oesterl\'{e}, Shimura, and others. It is completely
{\em free} software, currently available only for Linux machines
at
\begin{verbatim}
http://shimura.math.berkeley.edu/~was/Tables/hecke.html
\end{verbatim}
Unfortunately it is still in development, and quite a bit of work
remains to be done\footnote{Hecke is being written by me, with
advice from K. Buzzard and H.W. Lenstra.}. I should emphasize that
\hecke{} is {\em not} yet rock solid'' and ready for general
release, so you should be especially skeptical of the results it
gives and aware that the interface is at certain points very
primitive.  Nonetheless, \hecke{} is capable of many computations
which aren't currently possible in any other single, integrated,
publicly available, package.  The main drawbacks are that the
interface may be awkward and certain parts of the implementation
have not been properly optimized.

\head{What can \hecke{} do?} \hecke{} consists both of a \cpp{}
library and an interactive calculator.  Most of the following is
implemented.
\begin{itemize}
\item {\bf Modular forms and Hecke operators:} Computations
on the spaces  $M_k(\Gamma_1(N),\eps)$, $k\geq 2,$
over cyclotomic and finite fields.
Functions include:
\begin{itemize}
\item Computation of bases of newforms.
Within computational
limits, the level, weight, and character can be pretty
much arbitrary, with the restriction that $k\geq 2$ be
an integer.  Furthermore, all eigenforms are computed,
{\em not} just the ones with eigenvalues in $\Q$.
\item Exact computation of the rational numbers
$L(M_f,i)/\Omega_i$ where $M_f$ is a complex torus
attached to $f$ and $\Omega_i$ is a certain volume.
\item Optimal quotients $A_f$ of $J_0(N)$ associated to newforms.
(An optimal quotient is a quotient $J_0(N)\ra A_f$ with connected kernel.)
\begin{enumerate}
\item The modular degree and structure of the canonical
polarization.
\item Congruences.
\item Order of image of $(0)-(\infty)$.
\item Upper bound on torsion.
\item Tamagawa numbers of semistable quotients of $J_0(N)$
(currently only for $N$ prime).
\end{enumerate}
\item Discriminants of Hecke algebras.
\item Numerical computation of special values and period
lattices of forms of even weight $k\geq 2$, in many
(but not all) cases. When $f$ has rational Fourier
coefficients, computation of the invariants of
the associated elliptic curve over $\R$.
\end{itemize}

\item {\bf Formulas:} The classical formulas, such
as the numbers of cusps on modular curves, dimensions of spaces
of cusps forms, and computation of
$\dim S_k(\Gamma_1(N),\eps)$ for $k\geq 2$
and $\eps$ a Dirichlet character modulo $N$
(using the Hijikata trace formula).

\item {\bf Character groups of tori:}
Action of Hecke operators on the character group associated to $J_0(p)$
(using the Mestre-Oesterl\'{e} graph method).  The matrices attained
in this way are very sparse.

\item {\bf Tables:} Functions for making tables of eigenforms.

\item {\bf More:} And much more...

\end{itemize}

\hecke{} grew out of work on my thesis which involves computing
special values of $L$-functions, congruences, and verifying modularity of
certain Galois representations.  In a sense, \hecke{} is also the program
I wish had existed when I was taking my first modular forms course and
wanted to see lots of concrete examples of modular forms.
(Some of the tables computed using \hecke{} can be found at
{\tt http://shimura.math.berkeley.edu/\~{ }was/Tables}.)

In this guided tour, you will see how to use
\hecke{} to compute the action of Hecke operators,
bases of eigenforms, and obtain information about
special values of $L$-functions.

\head{Starting \hecke.} To start \hecke{}, type
{\tt hecke} at the command line.  You will see something like
\begin{verbatim}
# hecke
HECKE:  Modular Forms Calculator   Version 0.4 (June 14, 1999)
William A. Stein
Send bug reports and suggestions to was@math.berkeley.edu.
Type ? for help.
HECKE>
\end{verbatim}
Typing {\tt ?} gives a list of modes'' which include:
\begin{verbatim}
calc:      Motive calculator
exsymbols: Extended modular symbols mode
formulas:  Formula calculator
graphs:    Monodromy pairing calculator
msymbols:  Modular symbols calculator
tables:    Table making routines
\end{verbatim}
\head{Modular forms and Hecke operators calculator.}
Type {\tt msymbols} to start the modular forms and Hecke
operators calculator.
You will be asked for several bits of information which
define the space on which to work.  Answer as follows:
\begin{verbatim}
level N = 389
character chi = 0
weight k = 2
\end{verbatim}
After a brief computation the calculator interface will
print some information about $M_2(\Gamma_0(389))$ and
\begin{verbatim}
---------------------------------------------------------------
Current space:   M_2(Gamma_0(389); Q)^+, dim=33
Hecke action on: V=M_2, dim=33
---------------------------------------------------------------
M_2(389) ?
\end{verbatim}
The help system is similar to that in \pari. Typing {\tt ?} gives
a list of subtopics.
\begin{verbatim}
1: computing OPERATORS
2: setting current SPACE
3: cutting out SUBSPACES
4: computing BASIS
5: CONVERSIONS between representations
6: arithmetic INVARIANTS of torus A_V
7: INVARIANTS of Hecke algebra
8: OPTIONS
\end{verbatim}
To get an idea of what  $M_2(\Gamma_0(389))$ looks like, compute
the characteristic polynomials of several Hecke operators $T_n$.
Type {\tt t} then enter a positive integer $n$.
\begin{verbatim}
? t
Tn: Enter values of n, then q when done.
2
f2=(x-3)*(x + 2)*(x^2 -2)*(x^3 -4*x -2)*
(x^20 -3*x^19 -29*x^18 + 91*x^17 + 338*x^16 -1130*x^15
-2023*x^14 + 7432*x^13 + 6558*x^12 -28021*x^11 -10909*x^10
+ 61267*x^9 + 6954*x^8 -74752*x^7 + 1407*x^6 + 46330*x^5
-1087*x^4 -12558*x^3 -942*x^2 + 960*x + 148)*
(x^6 + 3*x^5 -2*x^4 -8*x^3 + 2*x^2 + 4*x -1);
q
\end{verbatim}
Let's compute the action of a few Hecke operators on the dimension
two factor.  Type {\tt subeigenpoly}, then select the dimension
two factor:
\begin{verbatim}
M_2(389) ? subeigenpoly
[...]
n = 2                             <---- you type this
Choose one of the following factors.
1: x+2
2: x-3
3: x^2-2
4: x^3-4*x-2
5: x^20-3*x^19-29*x^18+91*x^17+338*x^16-1130*x^15-2023*x^14+
7432*x^13+6558*x^12-28021*x^11-10909*x^10+61267*x^9+6954*x^8-
74752*x^7+1407*x^6+46330*x^5-1087*x^4-12558*x^3-942*x^2+960*x+148
6: x^6+3*x^5-2*x^4-8*x^3+2*x^2+4*x-1
7: ALL factors
Select a factor: 3               <---- you type this
\end{verbatim}

When the {\tt M\_2(389) ? } prompt appears, type {\tt opmatrix} to
turn on matrix display and {\tt opcharpoly} to turn off
computation of characteristic polynomials. Now you can compute
matrices which represent the Hecke operators on this dimension two
space:
\begin{verbatim}
M_2(389) ? t
2
T2=[2,1;-2,-2];
3
T3=[0,1;-2,-4];
6
T6=[-2,-2;4,6];
\end{verbatim}
Let $A$ denote the corresponding dimension two
optimal quotient of $J_0(389)$.
To compute the BSD value $L(A,1)/\Omega_A$, type
{\tt torusbsd}.  \hecke{} outputs $0$ along
with the first few terms of the $q$-expansion of $f$
and the discriminant of the ring $\Z[\ldots,a_n,\ldots]$.
The sign in the functional equation for the $L$-function
is minus the sign of the Atkin-Lehner involution
$W_{389}$.   To compute this involution, type {\tt actatkin}
and then enter {\tt 389} for $p$.  \hecke{} compute that
$W_{389}=+1$ on $A$, so the sign in the functional equation
is $-1$ and $L(A,1)$ is forced to vanish.

To obtain the $q$-expansion of a normalized eigenform in
our dimension two space, type {\tt basisnew} then {\tt n=7}.
The result is
\begin{verbatim}
s1=t^2-2;  s=Mod(t,t^2-2);
f1 = q + (s)*q^2 + (s-2)*q^3 + -1*q^5 + (-2*s+2)*q^6 + (-2*s-1)*q^7 + O(q^8);
\end{verbatim}
which means that a normalized newform is
$$f_1 = q +\sqrt{2}q^2 + (\sqrt{2}-2)q^3 -q^5 + (-2\sqrt{2}+2)q^6 +(-2\sqrt{2}-1)q^7 + \cdots$$
To compute the discriminant of the Hecke algebra $\T$,
type {\tt heckedisc}.  \hecke{} computes the
discriminant of the $\Z$-module generated by $T_1,\ldots,T_{ }$
and finds:
$$592456554486106225601956409404798293104261020095616213409857536000000$$
$$=2^{53} \cdot 3^4\cdot 5^6\cdot31^2\cdot 37\cdot97^2\cdot 389\cdot3881 \cdot 215517113148241 \cdot 477439237737571441$$
This is only known example in which $p \mid \disc(\T_{389})$
(there are no other such $p<12000$).

Next, compute a basis of eigenforms for
$S_4(\Gamma_0(13),\eps)$
where $\eps:(\Z/13\Z)\ra\C^*$ is a character whose image has
order $3$. Type {\tt x} to quit computing on $M_2(389)$, type
{\tt msymbols} again and enter {\tt N = 13}, {\tt chi = 3},
and {\tt k = 4}.  In a second, the status display will appear:
\begin{verbatim}
-------------------------------------------------------------------
Current space:   M_4(Gamma_0(13), eps=; Q[a]/(a^2-a+1))^+, dim=5
Hecke action on: V=M_4, dim=5
-------------------------------------------------------------------
M_4(13) ?
\end{verbatim}
(In the version you're using, the quadratic polynomial might
be in $x$ instead of $a$.)
Type {\tt basisnew}, then {\tt n = 3} to get the first $3$
terms of the $q$-expansions of a basis of newforms. Note:
only one representative from each Galois conjugacy class
of newforms is provided.   The output is
\begin{verbatim}
f1 = q + (-4*a)*q^2 + (-2*a)*q^3 + O(q^4);
s2=t^2+(-5*a)*t+(2*a-2); s=Mod(t,t^2+(-5*a)*t+(2*a-2));
f2 = q + (s)*q^2 + ((-3)*s+(5*a))*q^3 + O(q^4);
\end{verbatim}
This means that there are two (conjugacy classes of) eigenforms
$f_1$ and $f_2$.  The first is $f_1=q-4aq^2-2aq^3+\cdots$ where
$a$ is a primitive cube root of $1$, and the second is
$f_2 =q + sq^2 +(-3s+5a)q^3 +\cdots$ where $s$ is a root
of $t^2-5at+2a-2=0$.

To work in fields of characteristic other than $0$,
use the extended mode by typing {\tt exsymbols} instead of {\tt msymbols}
at the {\tt HECKE> } prompt.

The {\tt msymbols} mode is useful for computing basis of eigenforms
and the action of Hecke operators on rather general spaces of
modular forms.  It is less useful for computing specific information
about the structure of $J_0(N)$.  For that, use the {\tt calc}
mode.
Type {\tt x} to get to the {\tt HECKE>} prompt,
then type {\tt calc}.  When asked if you want to work in the fast
$+1$ quotient, typing {\tt n}. (If you type {\tt yes}, many computations
will be orders of magnitude faster, but are likely to be wrong
by a power of $2$.)
The basic syntax of a {\tt calc} mode command is as follows:
\begin{center}
{\bf [level]k[weight][isogeny class].[command][(arguments)]}
\end{center}
Omitting the weight part of the command is the same as specifying
$k=2$.
Type {\tt 125} to obtain a list of optimal quotients of
$J_0(125)$.
\begin{verbatim}
? 125
****** SUMMARIZE LEVEL.
125k2:    dim    W
A        2      +
B        2      -
C        4      -
\end{verbatim}
This means that $J_0(125)\sim A\cross B\cross C$
where $A,B,C$ are abelian varieties of dimensions
$2$, $2$, and $4$.  We can compute $L(A,1)/\Omega_A$,
$L(B,1)/\Omega_B$ and $L(C,1)/\Omega_C$:
\begin{verbatim}
? 125A.bsdratio
0
? 125B.bsdratio
2^2/5
? 125C.bsdratio
1/5
\end{verbatim}
The signs in the {\tt W} column above give the signs of the
Atkin-Lehner involution $W_{125}$.  Thus one expects, because the
level is low, that $J(\Q)\tensor\Q\isom A(\Q)\tensor\Q\ncisom \Q\oplus\Q$. This is in fact the case, though we will not prove it
here.  (I haven't yet implemented a function for computation
$L'(A,1)$, so the rank can't yet be bounded from within \hecke.)
What about the torsion?  Type {\tt 125.torsionbound(13)} to get an
upper bound on the torsion subgroup of $J_0(125)$.  Then type {\tt
125.cusporder} to compute the order of $(0)-(\infty)\in J_0(125)(\Q)$.
\begin{verbatim}
? 125.torsionbound(13)
5^2
? 125.cusporder
5^2
\end{verbatim}
We're lucky -- the lower and upper bounds match up and we conclude
that $J(\Q)\ncisom\Z^2\oplus(\Z/25\Z)$. Next type {\tt
125A.intersection(B)} to obtain the structure of the finite
abelian group $A'\intersect B'\subset J$, where $A'$, $B'$ are the
abelian varieties dual to $A$ and $B$. The answer {\tt [2,2,2,2]}
indicates that the intersection is $(\Z/2\Z)^4$.  This implies
that the corresponding newforms satisfy a congruence in
characteristic $2$. To exit {\tt calc} mode, type {\tt
$\backslash{}$q}.

This tutorial has barely scratched the surface of what is possible
using \hecke{}.  If you are interesting in learning more, talk to
me.
\end{document}

%(For more on $J_0(125)$,
%see Poluakis, D. {\em La courbe modulaire $X_0(125)$ et sa
%jacobienne}, J. Num. Theory {\bf 25} (1987), no. 1, 112--131.)

To compute the modular degree of $A$ type {\tt torusmoddeg}.
It will again ask for a factor of $T_2$; enter choice $1$.
The answer which \hecke{} returns is $2^2\cdot 3^2$.
{\em Warning:} We are really computing the action of Hecke
operators on the $+1$ subspace of $H_1(X_0(N))$ so the modular
degree can be wrong by a power of $2$; to compute the correct
modular degree it is necessary to start the modular symbols
mode using the command {\tt Modular} instead of {\tt modular}.