Sharedwww / periods.texOpen in CoCalc
% periods.tex

% DATE:    APRIL 1999.

\title{Computing Period Lattices of Newforms\\
\author{William Stein and Helena Verrill}
\date{April, 1999}
We give an algorithm to numerically approximate 
the period lattice and real volume of any 
modular newforms $f\in S_k(\Gamma,\C)$ 
of positive even weight.  The computation
of special values of the associated $L$-functions 
is also discussed. Numerical examples are provided. 


\section{Modular Symbols}
Let $\Gamma=\Gamma_0(N)$ or $\Gamma_1(N)$, and let 
$k$ be an even positive integer.  Let
$\cM$ be the abelian group generated by symbols
$\{\alpha,\beta\}$ with $\alpha, \beta\in\P^1(\Q)$
modulo the relations 
$$\{\alpha,\beta\}+\{\beta,\gamma\}+\{\gamma,\alpha\} = 0$$
and modulo any torsion. 

  $$V_{k-2}=\Sym^{k-2}(\Z X + \Z Y)$$
be the $\Z$-module of homogeneous polynomials in $X$ and $Y$
of degree $k-2$. 
Define a left action of $g=\abcd{a}{b}{c}{d}\in \Gamma$ on the tensor product
$V_{k-2}\tensor \cM$ by
    = P(dX-bY,-cX+aY)\tensor\{g(\alpha),g(\beta)\}.$$
The space of modular symbols of weight $k$ for $\Gamma$ is
the largest quotient of $V_{k-2}\tensor\cM$ on which $\Gamma$
acts trivially.  If we let $I = \{1-g : g\in\Gamma\}\subset\Z[\Gamma]$
$$\M_k(\Gamma) = \frac{V_{k-2}\tensor\cM}{I(V_{k-2}\tensor\cM)}
             = H_0(\Gamma,V_{k-2}\tensor\cM).$$
The cuspidal modular symbols are $\cS_k(\Gamma) = \ker(\delta)$,
 $$\delta:\M_k(\Gamma)\ra \bigoplus_{[\alpha]\in \Gamma\backslash\P^1(\Q)} 
is given by
 $$\delta(P(X,Y)\tensor\{\alpha,\beta\}) = ?.$$

The Eichler-Shimura theory gives an isomorphism
     \isom H^1(\Gamma,V_{k-2}^*\tensor\C)$$
For example, when $k=2$ the map 
$$S_2(\Gamma,\C)\ra H^1(\Gamma,\C)=\Hom(\Gamma,\C)$$
send $f(z)$ to the map $\gamma\mapsto \int_{0}^{\gamma(0)} f(z)dz$.

The cup product pairing 
$$H_0(\Gamma,V_{k-2}\tensor\cM)\cross H^1(\Gamma,V_{k-2}^*\tensor\C)
   \ra H^0(\Gamma,\C)=\C$$
gives rise to the period map we will study.

\section{Computing Periods}
Let $\Gamma=\Gamma_0(N)$ or $\Gamma_1(N)$.  In this section
we describe how to numerically approximate the period lattice 
associated to a cuspidal newform
  $$f=\sum a_n q^n \in S_k(\Gamma,\C), \qquad k\geq 2.$$
We do {\em not} require that the 
Fourier coefficients $a_n$ of $f$ lie in $\Q$, nor that the
weight equals $2$.  In the special case $k=2$ and all $a_n\in\Q$,
see \cite{cremona}.  The algorithm given only applies when 
$k$ is even, though we expect that there is a 
generalization to odd $k$. 

Let $\T=\Z[T_1,T_2,T_3,\ldots]$ denote the Hecke algebra, equipped
with its action on modular forms and modular symbols for $\Gamma$.
Set $$\p_f = \Ann_\T(f).$$
Let $f^{(1)},\ldots,f^{(d)}$ be the $\Gal(\Qbar/\Q)$ conjugates of $f$.
Let $\cM_k(\Gamma,\Q)$ be the space of modular symbols of weight
$k$ for $\Gamma$ (tensor $\Q$) and $\cS_k(\Gamma,\Z)\subset\cM_k(\Gamma,\Q)$
the subspace of integral cuspidal symbols.  
There is a pairing
$$\langle\quad,\quad\rangle : \cM_k(\Gamma,\Q)\cross S_k(\Gamma,\C) \ra \C$$
$$\langle P(X,Y)\{\alp,\beta\}, \, f \rangle 
       = 2\pi i  \int_{\alpha}^{\beta} f(z)P(z,1) dz.$$
The period map associated to $f$ is
$$\Phi_f : \cM_k(\Gamma,\Q) \ra \C^d$$
$$\Phi_f(x) = (\langle x,f^{(1)}\rangle, \ldots, \langle x,f^{(d)}\rangle).$$
   $$\Lambda_f =\Phi_f(\cS_k(\Gamma,\Z))\subset\C^d.$$

The following is an algorithm to numerically 
approximate $\Phi_f$ and $\Lambda_f$.

\item {\bf [Compute left eigenspace.]}
Compute a $\Q$-basis $\vphi_1,\ldots,\vphi_{2d}$ for
\item {\bf [Dual basis.]} Let $w_1,\ldots,w_{2d}$ be the $\Q$-basis for
$\M_k(\Gamma,\Q)[\p_f]$ dual to $\vphi_1,\ldots,\vphi_{2d}$,
so $\vphi_i(w_j)=\delta_{ij}$.  It is not
necessary to compute the $w_i$ though this could
be done by inverting the matrix whose rows are the $\vphi_i$.  
Observe that if $v\in\M_k(\Gamma,\Q)$ then
$$\langle v, f\rangle = \sum_{i=1}^{2d} \vphi_i(v) \langle w_i, f\rangle.$$
\item {\bf [Compute $\Z$-basis for $\Lambda_f$.]} 
Compute a $\Z$-basis $z_1,\ldots,z_{2d}$ 
for the lattice
    $$\{(\vphi_1(x),\ldots,\vphi_{2d}(x)) : x \in \cS_k(\Gamma,\Z) \}
               \subset \Q^{2d}.$$
\item {\bf [Find good periods.]} 
Locate $v_1,\ldots v_{2d}\in \M_k(\Gamma,\Q)$ so that
\item Each $v_i$ is of the form 
with $g=\abcd{a}{b}{c}{d}\in \Gamma$, $c>0$, and 
$$P_g(X,Y) = ((1-ad)X^2 - b(d-a)XY+b^2Y^2)^{\frac{k-2}{2}}.$$
Note that $P$ is an eigenvector for the action of $g$
on $V_{k-2}$ with eigenvalue $1$. 

{\bf Remarks:}
\item This is the step which only makes sense for even weight.
We have not yet found a replacement for odd weight.
\item It is still necessary to prove the existence of enough $g$'s.
This we have not done.  In practice a few randomly choosen $g$'s
seem to do the job. 

\item The matrix $(\vphi_i(v_j))$ is invertible. 
\item {\bf [Compute approximate periods.]} 
The form of each $v_i$ insures that we can obtain good numerical
approximations to $\langle v_i, f\rangle.$ 
Write $v_i = P_g(X,Y)\{0,g(0)\}$ with $g=\abcd{a}{b}{c}{d}$
and $c>0$. 
We have 
$\langle v_i, f\rangle = \sum_{n\geq 1} a_n c_n$, where
$$c_n=2\pi i \int_{0}^{g(0)} e^{2\pi i n z} P_g(z,1)dz .$$
To compute $c_n$, let $y_0=1/c$, $x_1=-d/c$, $x_2=a/c$.
$$c_n = 2\pi i\int_{x_1+iy_0}^{x_2+iy_0} e^{2\pi i n z} P_g(z,1) dz.$$
Let $\alp=x_1+iy_0$ and $\beta=x_2+iy_0$. 
Observe that $g(\alp)=\beta$ and (key fact) $P_g(aX+bY,cX+dY)=P_g(X,Y)$,
so $$g^{-1}(P_g(X,Y)\{x,y\}) = P_g(X,Y)\{g^{-1}(x),g^{-1}(y)\}$$ 
for any $x$ and $y$. 
We thus have
0 &=& P_g(X,Y)(\{0,g(0)\} + \{g(0),g(\alp)\} + \{g(\alp),0\})\\
  &=& P_g(X,Y)\{0,g(0)\} + P_g(X,Y)\{0,\alp\} + P_g(X,Y)\{g(\alp),0\}\\
  &=& P_g(X,Y)(\{0,g(0)\} - \{\alp,g(\alp)\})
so $P_g(X,Y)\{0,g(0)\} = P_g(X,Y)\{\alp,g(\alp)\}$.


The following formula is useful in
evaluating $c_n$.
  \int_{z_0}^{\infty} e^{2\pi i n z} z^m dz
   = e^{2\pi i n z_0} 
      \sum_{s=0}^m \left\{
          \frac{(-1)^s z_0^{m-s}}
              {(2\pi i n)^{s+1}}
          \cdot \prod_{j=(m+1)-s}^m j\right\}.$$
Since $y_0>0$, the $c_n\ra 0$ quickly.
Repeated integration by parts. 

\item {\bf [Solve for periods of dual basis.]}
We have a matrix equation
\left(\begin{matrix}\vphi_1(v_1)&\cdots &\vphi_{2d}(v_{1})\\
    \cdots &\cdots&\cdots\\
    \vphi_{1}(v_{2d})&\cdots &\vphi_{2d}(v_{2d})
  \langle w_1, f\rangle  \\
  \langle w_{2d}, f\rangle
  \langle v_1, f\rangle  \\
  \langle v_{2d}, f\rangle
Inverting we obtain numerical approximations 
$\alpha_i \sim \langle w_i, f\rangle$. 
Compute the approximations $\langle v_i, f^{(j)}\rangle$ for
each of the Galois conjugates $f^{(j)}$ of $f$ in order 
to obtain approximations
$$\alpha_i^{(j)}\sim \langle w_i, f^{(j)}\rangle\in\C,$$
for $1\leq i \leq 2d$ and $1\leq j\leq d$.
\item {\bf [Compute period map.]}
The period map 
is approximated as
$$\Phi_f(v) \sim 
\begin{matrix}\alp_1^{(1)}&\cdots &\alp_{2d}^{(1)}\\\cdots &\cdots&\cdots\\
   \alp_1^{(d)}&\cdots &\alp_{2d}^{(d)}\\\end{matrix}\right)
\item {\bf [Compute period lattice.]}
The (approximate) period lattice $\Lambda_f$ has as
basis the columns of the following product:
\begin{matrix}\alp_1^{(1)}&\cdots &\alp_{2d}^{(1)}\\\cdots &\cdots&\cdots\\
   \alp_1^{(d)}&\cdots &\alp_{2d}^{(d)}\\\end{matrix}\right)
\begin{matrix}|&\cdots &|\\z_1&\cdots &z_{2d}\\|&\cdots &|\end{matrix}\right)

\subsection{Special Values}
$$L(f,s) = \int_{0}^{\infty} f(z)z^{s-1}dz = \sum a_n n^{-s}$$
be the Mellin transform of $f$. 
We can approximate the special
value $L(A_f,1)=\prod_i L(f^{(i)}, 1)$ by observering that
$$\Phi_f(Y^{k-2}\{0,\infty\}) = (L(f^{(1)},1),\ldots,L(f^{(d)},1)).$$

\subsection{The Real Period}
The complex torus $A_f = \C^d/\Lambda_f$ is of interest.
When $k=2$ it has the structure of abelian variety with a 
good integral model, it is naturally a quotient of $\Jac(X_\Gamma)$. 

The following construction is perfectly general and makes
sense for any integer weight $k\geq 2$.   When we refer
to the BSD conjecture below, we are referring to the particular
case $k=2$. 

Assume for the rest of this section
that the Fourier coefficients of $f$ are totally real.
Then the lattice $\Lambda_f$ is invariant under complex conjugation. 
Thus we may consider the real points 
$A_f(\R)=(\C^d/\Lambda_f)^+$ of the complex torus $A_f$. 
   $$\tilde{\Omega}_f := \Vol(A_f(\R))$$ 
denote the volume of the identity component of 
$A_f(\R)$ with respect to the measure on $A_f$ induced
by the standard Lebesgue measure on $\C^d$.  Then
$$\tilde{\Omega}_f = \Vol (\R^d/\Lambda_f^+ )\cdot c_\infty$$
where $$c_\infty=\#(A_f(\R)/A_f(\R)^0)$$
is the number of connected components of $A_f(\R)$. 

$$\Omega_f = \frac{\tilde{\Omega}_f}{\Delta_f}$$
where $\Delta_f$ is the volume of the image of
the Hecke algebra in $\C^d$ by the map
$$T_p \ra (a_p^{(1)},\ldots,a_p^{(d)}).$$
{\bf Remarks:}
1) Note that $\Delta_f^2\in\Z$ though $\Delta_f$ need
not be rational. [I think...]  \\
2) $\Delta_f$ is the determinant of a change of basis matrix relating
the basis $f^{(1)},\ldots,f^{(d)}$ to an integral basis.  This
statement probably uses the duality between Hecke operators
and integral cusp forms.\\
3) Note that this $\Omega_f$ differs from the quantity
appearing in the BSD conjecture (which arises from
a Neron differential) by the ``Manin constant''
(conjecturally 1).  

Here is how to compute $\tilde{\Omega}_f$. 

\item {\bf [Compute conjugation on $Z = \Z z_1 + \cdots + \Z z_{2d}$]}
The action of complex conjugation on $\Lambda_f$ can be
computed as follows.  
Note that conjugation commutes with the period map $\Phi_f$.
If $z_i$ lifts to $x\in \cS_k(\Gamma,\Z)$, then
$$z_i^{*} = (\vphi_1(x^*),\ldots,\vphi_{2d}(x^*)).$$
Compute the matrix $C$ representing conjugation with
respect to the basis $z_1,\ldots,z_{2d}$. 

Here is how to compute $C$.  
\item Let $P$ be the matrix whose rows are the $\vphi_i$. 
Using Gauss elmination choose $2d$ linearly independent
columns $i_1,\ldots,i_{2d}$ of $P$.  Let $B$ the matrix
consisting of these $2d$ columns.
\item Let $A$ be the matrix of complex conjugation on 
$M_k(\Gamma)$ and let $A'$ be the matrix obtained by
deleting all but columns $i_1,\ldots,i_{2d}$ of $A$. 
The product $PA'$ is a matrix whose columns are the
images of the columns $i_1,\ldots,i_{2d}$ under
complex conjugation.  
\item The matrix of complex conjugation (on the column
space of $P$) with respect to the standard basis is
\item  Let $Z$ be the matrix whose columns are 
$z_1,\ldots, z_{2d}$.  Then the matrix of $C$
with respect to the basis $z_i$ is:
    $$C = Z^{-1}C'Z.$$

Compute a $\Z$-basis $b_1,\ldots, b_d$ for $Z^+=\Ker(C-I)$.

\item {\bf [Compute $\Vol(A_f(\R)^0)=\Vol(\R^d/\Lambda_f^+)$]}
$$\Vol(\R^d/\Lambda_f^+) \sim 
\det  \left\{\left(
\begin{matrix}\alp_1^{(1)}&\cdots &\alp_{2d}^{(1)}\\\cdots &\cdots&\cdots\\
   \alp_1^{(d)}&\cdots &\alp_{2d}^{(d)}\\\end{matrix}\right)
\begin{matrix}|&\cdots &|\\b_1&\cdots &b_d\\|&\cdots &|\end{matrix}\right)
Order the $b_i$ so that $\det>0$.

\item {\bf [Compute $c_{\infty}$]}
Let $\overline{C}$ be the the map induced by complex
conjugation on $\Lambda_f/2\Lambda_f = \Lambda_f\tensor\F_2$.
$$c_\infty = 2^{\dim(\ker(\overline{C} - 1)) - d}.$$
We must compute the order of the component group
$$\Psi=\frac{A_f(\R)}{A_f(\R)^0} = 
For $v\in\C^d$ denote by $\overline{v}$ its complex conjugate and
by $[v]$ its image in $\C^d/\Lambda_f$.
If $[v]\in(\C^d/\Lambda_f)^+$ then $[v]=[\overline{v}]$ so 
since $v+\overline{v}\in\R^d$ we have
$$2[v] = [v]+[\overline{v}]\in\R^d/\Lambda_f^+,$$
so $\Psi$ is annihilated by $2$. 
Thus there is $\lambda\in\Lambda_f$ so that
$2v+\lambda\in\R^d$, and so
$v+\frac{1}{2}\lambda\in\R^d$, i.e., $v$ can be written
as something in $\frac{1}{2}\Lambda_f$ plus something in $\R^d$.
This means that $\Psi$ is generated by the image of 
$$\Psi \isom \frac{(\frac{1}{2}\Lambda_f/\Lambda_f)^+}
      \isom \frac{(\Lambda_f/2\Lambda_f)^+}
               {\Lambda_f^+/2\Lambda_f^+} $$

$$\dim_{\F_2} \Psi = \dim (\Lambda_f/2\Lambda_f)^+ 
         - \dim \Lambda_f^+ / 2\Lambda_f^+
          = \dim(\ker(\overline{C} - 1)) - d.$$

\subsection{The Ratio $L(A_f,1)/\Omega_f$}
Let $F(x) = (\vphi_1(x),\ldots,\vphi_{2d}(x)).$
Let $C$ be the map on the image of $F$ induced by the $*$ involution on 
$\cS_k(\Gamma,\Z)$ and $\overline{C}$ its mod $2$ reduction.
   = [F(\cS_k(\Gamma,\Z))^+:F(\T e)]
      \cdot 2^{\dim(\ker(\overline{C} - 1)) - d}$$
where $[A:B]$ is the absolute value of the determinant of a change 
of basis matrix sending $A$ to $B$. 
In particular the ratio is a rational number.
Let $\O$ be the image of
the Hecke algebra in $\C^d$ by the map
$$T_p \ra (a_p^{(1)},\ldots,a_p^{(d)}).$$
Thus $\Delta_f = \Vol(\O)=[\Z:\O]$.
We have
&=& \frac{\langle e,f^{(1)}\rangle\cdots \langle e,f^{(d)}\rangle}
         {\Vol(\Phi_f(H_1(X_0(N),\Z))^+) / \Delta_f}\\
&=&\frac{[\Z^d : \Phi_f(e)\Z^d]}
        {[\Z^d : \Phi_f(H_1)^+][\O:\Z^d]} \\
&=&\frac{[\O : \Phi_f(e)\O]}
        {[\Z^d : \Phi_f(H_1)^+][\O:\Z^d]} \\
&=&\frac{[\Z^d : \Phi_f(e)\O]}
        {[\Z^d : \Phi_f(H_1)^+]} \\
&=&\frac{[\Z^d : \Phi_f(\T e)]}
        {[\Z^d : \Phi_f(H_1)^+]} \\
&=&[\Phi_f(H_1)^+ : \Phi_f(\T e)]\\
&=&[F(H_1)^+ : F(\T e)].


{\bf Weight 2 remark:} It is known (Mazur) that the Manin constant, which relates
our $\Omega$ to the one for the Neron model, is a unit
in $\Z[\frac{1}{2m}]$ where $m$ is the largest square
dividing the level $N$.  
The quotient of $L(A_f,1)$ by the real volume,
which appears in the BSD conjecture, a priori
a real number is in fact a rational number.

Let $f\in S_2(\Gamma_0(65),\C)$ be the unique newform
for which $a_2$ satisfies $a_2^2+2a_2-1=0$.  Letting $\alp=a_2$ we have
  $$f = q + \alpha q^2 + (\alpha+1)q^3
        +(-2\alp-1)q^4 + q^5 + (-\alp+1)q^6
        +(-2\alp)q^7 + (\alp-2)q^8+\cdots$$
As we will see, the associated quotient $A=A_f$ of $J_0(65)$ 
has analytic rank $0$. 

We first compute $\cS_2(\Gamma,\Z)\subset \cM_2(\Gamma,\Q)$.
With respect to our chosen basis, the matrix of $T_2$ on 
$\cM_2(\Gamma,\Q)$ is
$$T_2 = 
The left eigenspace corresponding to $f$ is the left kernel
of $T_2^2+2 T_2-1$ which is
The rows of $P$ are $\vphi_1,\ldots,\vphi_4$.

The lattice 
    $$\{(\vphi_1(x),\ldots,\vphi_{4}(x)) : x \in \cS_k(\Gamma,\Z) \}
               \subset \Q^{4}$$
is simply the lattice spanned by the columns of $P$, which 
is the full $\Z^4$ (observe that columns 1,2,3,5 have determinant
$2$ so span a sublattice of index $2$ in $\Z^4$, and column
7 does not lie in it).

We try several $g\in\Gamma_0(65)$:
v_1&=&\{0,\abcd{22}{1}{65}{3}(0)\} =  [0,0,0,1,0,0,0,0,0,0,1,0,-1]^t\\
v_2&=&\{0,\abcd{-32}{-1}{65}{2}(0)\}=   [0,0,-1,1,0,0,1,0,0,0,1,0,-1]^t\\
v_3&=&\{0,\abcd{-16}{-1}{65}{4}(0)\}=  [0,0,0,0,1,-1,1,0,-1,0,1,0,-1]^t\\
$$\vphi_i(v_j) = 
which has rank $4$. 

The period integrals, to 15 decimals are as follows.
\langle v_1, f\rangle&=& -1.37443706596536 + 0.768794716989823i\\
\langle v_2, f\rangle&=& -2.74887413193073 \\
\langle v_3, f\rangle&=& -1.94374753931650 \\
\langle v_4, f\rangle&=& -0.569310473351139 + 1.85603463243761i\\
\langle v_1, f^{(2)}\rangle&=& -1.15118942200858 + 3.35725985432803i\\
\langle v_2, f^{(2)}\rangle&=& -2.30237884401716\\
\langle v_3, f^{(2)}\rangle&=& 1.62802769346498\\
\langle v_4, f^{(2)}\rangle&=& 2.77921711547356 - 1.39062256407339i
Inverting the matrix $\vphi_i(v_j)$ we obtain 
$$(\alpha_i^{(j)})^t = 
 {{0.531535414512712} - {0.543619957723896}i}&{{0.212623571040667} + {2.37394120920071}i}\cr
 {{0.220169177572770} - {1.31241467471371}i}&{{-0.513318708886579} - {0.983318645127320}i}\cr


A=[1, -1, 2, -1; 0, 0, 3, -2; 0, 0, 1, -3; -1, -1, -1, -1]


\\ integral basis for image of S_2 in columns space of P
{Z=[1, 0, 0, 0; 
    1, 2, 0, 0; 
   -1,-2, 2,-1; 
    0,-2, 1, 3];}

\\ conjugation on M_2
CC = [1,0,0,0,0,0,0,0,0,0,0,0,0;

\\ The matrix of C with respect to the basis Z=[z_1,...,z_4]
C=[-1, 0, 0, 0; 
   0, -1, 0, 0;
  -1, -2, 1, 0; 
   1, 0, 0, 1];

The +1 eigenspace is:
   span z_3, z_4. 

Using the below alp matrix we obtain the real period:

alp*[z_3;z_4] = alp*[0, 0; 0, 0; 2,-1; 1, 3]
=[-0.8051265926142280223898673966  1.943747539316507071177084460]
 [-3.930406537482142877473965080  -1.628027693464980131583752011]

which has determinant

We also have
   matrank(C*Mod(1,2)-1) = 1
  c_infinity = 2.

Thus   \tilde{Omega} = 17.90097285053097658298561329.

Delta = |1    1   |  = 2*sqrt(2)
        |a2  a2bar|
  Omega = 6.328949646223367581007308099

The image of {0,oo} is simply [0,0,1,-1]~, so 

Taking the product of the two entries gives

 = 0.4520678318730976843576858890 

We also get, for free by writing [0,0,1,-1]~ in terms
of Z that the image of (0)-(oo) in A_f is rational 7 torsion.

The characteristic polynomial of T_3  on A_f is: 
so 14 is an upper bound on the torsion. 

   L(A_f,1)                                           1
  ----------   =  0.07142857142857142857143189343  ~ ----
   Omega                                              14

Using the method of graphs and my component
group formula David Kohel and I computed the tamagawa numbers and
     c5 = 7       c13 = 1

The BSD conjecture asserts that (assume it hence):

    1         [Sha] * c5 *c13                   [Sha] * 7
--------   = -------------------------   =  -------------------------
   14         [Torsion]*[Torsiondual]        [torsion]*[torsion dual]

    [Sha] = [torsion]*[torsion dual] / 2*7^2.
Thus assuming BSD, the torsion on one of A_f or A_fdual must
be 14. 

It could easily be the case that [torsion]=14, [torsion dual]=7
and [Sha]=1.  



\section{Source Code}
The following pari code can be used to compute the period
integrals $\langle P_g\{0,g(0)\}, f\rangle$. 
\\ file:
\\   Compute period integrals by integrating along a cleverly 
\\   chosen arc in the upper half plane.
\\ AUTHOR: William Stein and Helena Verrill
\\ LAST MODIFIED:    April, 1999.


\\ Compute the line integral
\\       / x2+iy0
\\      |     
\\ 2PiI*|      f(z) * z^m 
\\      |
\\      / x1+iy0
\\ where
\\  a=[a1,a2,a3,a4,...] defines the series
\\  f(z) = a1*z + a2*z^2 + a3*z^3 + ...

   c=vector(prec,n, lineval(x2+I*y0,m,n) - lineval(x1+I*y0,m,n));
   ans=sum(n=1, prec, a[n] * c[n]);
   print("Int(2*Pi*I*f(z)*", z^m,",",x1+I*y0,",",x2+I*y0,") = ",ans);

     * exp(c*z)
     * sum(s=0,m,(-1)^s*  (z^(m-s)) / (c^(s+1)) * prod(i=m-s+1,m,i));

\\ Let g be in SL_2(Z) and k be an even positive integer.
\\ This function computes an eigenvector element of 
\\   Sym^(k-2)(Z) = homogeneous poly's of degree k-2 in X and Y
\\ Which has eigenvalue +1 for g. 
\\ Note: the output is a vector of coefficients.
   ((1-g[1,1]*g[2,2])       *X^2 
         - g[1,2]*(g[2,2]-g[1,1])*X
         + g[1,2]^2 

\\ Let f be a weight k newform for Gamma_0(N) and fix
\\ g=[a,b;c,d] in Gamma_0(N) such that c>0.
\\ Let P(X,Y) be the eigenvector computed by syminvariant(g,k).
\\ This function computes the period
\\       < P(X,Y)*{0,g(0)}, f(z) > 
      print("gf_period: WARNING desired precision exceeds that of f.")

   print("gf_period: precision = ",prec);
   print("< (",P,")*{0,",if(g[2,2]==0,"oo",g[1,2]/g[2,2]),
         "}, ",sum(j=1,13,a[j]*q^j)+O(q^14)," >");



\\ quick computation of eta 
      (-1)^n * q^((3*n-1)*n/2))
     +O(q^((3*prec-1)*prec/2)) ;

\\ our favorite.
{f1(prec,    \\ eta(q^3)^8,  weight 4, level 9.
   f) =
   f = myeta(q,prec);

{f2(prec,    \\ eta(q^6)^4,  weight 2, level 36.
   f) =
   f = myeta(q,prec);

\\ list some elements of Gamma_0(N)

\bibitem[CR]{cremona} J.E. Cremona,
{\em Algorithms for modular elliptic curves, 2nd edition},
Cambridge University Press, (1997).


The matrix alpha_i^j which computes period map, when right compl with phi.

alp=[0.5315354145127126613078931891330698990 - 0.5436199577238963826250859980838456612*I, 0.2201691775727704371403309739132151733 - 1.312414674713719213072658569868641118*I, -0.6227324738798844483352409500442398090 + 3.665476401263631858808075880749397435 E-23*I, 0.4403383551455408742806145034199040494 + 3.510503045937607708297890680758835419 E-23*I; 0.2126235710406675257282129991395067099 + 2.373941209200713376138704039517591586*I, -0.5133187088865787957602987003974718253 - 0.9833186451273203717704335635086521968*I, -1.451884559854492642976877604131230096 - 2.130221455047120662019817425995001094 E-23*I, -1.026637417773157591520209871918494907 - 8.778132686392049792197488630777259782 E-24*I]