\documentclass[a4paper, 11pt]{amsart}

\newfont{\cyr}{wncyr10 scaled 1100}

\usepackage[left=2.7cm,right=2.7cm,top=3.5cm,bottom=3cm]{geometry}
\usepackage{amsthm,amssymb,amsmath,amsfonts,mathrsfs,amscd}
\usepackage[latin1]{inputenc}
\usepackage[all]{xy}
\usepackage{latexsym}
\usepackage{url}
\usepackage{longtable}
\usepackage{threeparttable}
\usepackage{algorithmic}
\usepackage{array}

\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{conjecture}[theorem]{Conjecture}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{question}[theorem]{Question}
\newtheorem{examplewr}[theorem]{Example}
\newtheorem{ass}[theorem]{Assumption}

\theoremstyle{remark}
\newtheorem{obswr}[theorem]{Observation}
\newtheorem{remarkwr}[theorem]{Remark}

\newenvironment{obs}{\begin{obswr}\begin{upshape}}{\end{upshape}\end{obswr}}
\newenvironment{remark}{\begin{remarkwr}\begin{upshape}}{\end{upshape}\end{remarkwr}}
\newenvironment{example}{\begin{examplewr}\begin{upshape}}{\end{upshape}\end{examplewr}}


\DeclareMathOperator{\dR}{dR}
\DeclareMathOperator{\sym}{Sym}
\DeclareMathOperator{\Sym}{Sym}
\DeclareMathOperator{\sgn}{sgn}
\DeclareMathOperator{\spec}{spec}
\DeclareMathOperator{\la}{la}
\DeclareMathOperator{\ab}{ab}
\DeclareMathOperator{\cx}{cx}


\DeclareMathOperator{\II}{II}
\DeclareMathOperator{\Betti}{B}




\newcommand{\etalchar}[1]{$^{#1}$}
\newcommand{\cF}{\mathcal F}
\newcommand{\cH}{\mathcal H}
\newcommand{\cC}{\mathcal C}
\newcommand{\V}{\mathcal V}
\newcommand{\E}{\mathcal E}
\newcommand{\cE}{\mathcal E}
\newcommand{\g}{\gamma}
\newcommand{\G}{\Gamma}
\newcommand{\Gap}{\Gamma_0^D(p M)}
\newcommand{\Ga}{\Gamma_0^D(M)}
\newcommand{\hGa}{\hat{\Gamma }_0(M)}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\F}{\mathbb{F}}
\newcommand{\K}{\mathbb{K}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\I}{\mathbb{I}}
\newcommand{\Ql}{\Q_{\ell}}
\newcommand{\GQ}{G_{\Q}}
\newcommand{\PP}{\mathbb{P}}
\newcommand{\Sel}{\mathrm{Sel}}
\newcommand{\Sha}{\mathrm{Sha}}
\newcommand{\Gal}{\mathrm{Gal\,}}
\newcommand{\GL}{\mathrm{GL}}
\newcommand{\Cl}{\mathrm{Cl}}
\newcommand{\Tr}{\mathrm{Tr}}
\newcommand{\Div}{\mathrm{Div}}
\newcommand{\Fil}{\mathrm{Fil}}
\newcommand{\cond}{\mathrm{cond}}
\newcommand{\Frob}{\mathrm{Frob}}
\newcommand{\End}{\mathrm{End}}
\newcommand{\Jac}{\mathrm{Jac}}
\newcommand{\disc}{\mathrm{disc}}
\newcommand{\Id}{\mathrm{Id}}
\newcommand{\MS}{\mathrm{MS}}
\newcommand{\Aut}{\mathrm{Aut}}
\newcommand{\Fr}{\mathrm{Fr}}
\newcommand{\diag}{\mathrm{diag}}
\newcommand{\Up}{\mathrm{U}_p}
\newcommand{\ord}{{\mathrm{ord}}}
\newfont{\gotip}{eufb10 at 12pt}
\newcommand{\gn}{\mbox{\gotip n}}
\newcommand{\gm}{\mbox{\gotip m}}
\newcommand{\ga}{\mbox{\gotip a}}
\newcommand{\gb}{\mbox{\gotip b}}
\newcommand{\gf}{\mbox{\gotip f}}
\newcommand{\go}{{\mathcal O}_{A_f}}
\newcommand{\OAf}{{\mathcal O}_{A_f}}
\newcommand{\gp}{\mbox{\gotip p}}
\newcommand{\gL}{\mbox{\gotip L}}
\newcommand{\gd}{\mbox{\gotip d}}
\newcommand{\cO}{{\mathcal O}}
\newcommand{\cM}{{\mathcal M}}
\newcommand{\cP}{{\mathcal P}}
\newcommand{\cL}{{\mathcal L}}
\newcommand{\cG}{{\mathcal G}}
\newcommand{\GG}{{\mathcal G}}
\newcommand{\cD}{{\mathcal D}}
\newcommand{\om}{{\omega}}
\newcommand{\ra}{\rightarrow}
\newcommand{\lra}{\longrightarrow}
\newcommand{\hra}{\hookrightarrow}
\newcommand{\qbar}{\bar\Q}
\newcommand{\Norm}{\mathrm{N}}
\newcommand{\NS}{\mathrm{NS}}
\newcommand{\SL}{{\mathrm {SL}}}
\newcommand{\SO}{{\mathrm {SO}}}
\newcommand{\n}{{\mathrm{n}}}
\newcommand{\Pic}{{\mathrm{Pic}}}
\newcommand{\CH}{{\mathrm{CH}}}
\newcommand{\AJ}{{\mathrm{AJ}}}
\newcommand{\tr}{{\mathrm{tr}}}
\newcommand{\si}{\sigma}
\newcommand{\eps}{\epsilon}
\newcommand{\ta}{{\tau}}
\newcommand{\R}{{\mathbb R}}
\newcommand{\M}{{\mathrm{M}}}
\newcommand{\HC}{\mathcal F_{\rm har}}
\newcommand{\PGL}{{\mathrm{PGL}}}
\newcommand{\Supp}{\mathrm{Supp}}
\newcommand{\ep}{\varepsilon}

\def \mint {\times \hskip -1.1em \int}

%\newcommand{\mint}{\times\!\!\!\!\!\hskip-0.3em\int}

\newcommand{\SP}{\vspace{0.5cm}}
\newcommand{\T}{\mathbb T}
\newcommand{\new}{\mathrm{new}}
\DeclareMathOperator{\Hom}{Hom} \DeclareMathOperator{\Meas}{Meas}
\newcommand{\X}{\mathbb X}
\newcommand{\Y}{\mathbb Y}
\newcommand{\U}{\mathbb U}
\newcommand{\Rat}{{\rm Rat}\bigl(\PP^1(\Q_p),\C_p\bigr)}
\newcommand{\Ker}{{\mathrm Ker}}
\newcommand{\res}{\mathrm{res}}

\newcommand{\rom}{\mathrm}
\newcommand{\fr}{\mathfrak}
\newcommand{\cl }{\mathrm{cl}}

\newcommand{\longmono}{\mbox{$\lhook\joinrel\longrightarrow$}}
\newcommand{\longleftmono}{\mbox{$\longleftarrow\joinrel\rhook$}}
\newcommand{\longepi}{\mbox{$\relbar\joinrel\twoheadrightarrow$}}
\newcommand{\mat}[4]{\left(\begin{array}{cc}#1&#2\\#3&#4\end{array}\right)}
\newcommand{\smallmat}[4]{\bigl(\begin{smallmatrix}#1&#2\\#3&#4\end{smallmatrix}\bigr)}
\newcommand{\dirlim}{\mathop{\varinjlim}\limits}
\newcommand{\invlim}{\mathop{\varprojlim}\limits}

\newcommand{\D}{\mathbb D}
\DeclareMathOperator{\Ext}{Ext}
\DeclareMathOperator{\Rep}{Rep}
\DeclareMathOperator{\mhs}{MHS}
\DeclareMathOperator{\et}{et}
\newcommand{\bbH}{\mathbb{H}}
\DeclareMathOperator{\mm}{MM}
\numberwithin{equation}{subsection}
\numberwithin{theorem}{subsection}


\include{thebibliography}

\begin{document}

\title[Computation of triple Chow-Heegner points]{The effective computation of iterated integrals and Chow-Heegner points on triple products}

\author{Henri Darmon, Michael Daub, Sam Lichtenstein and Victor Rotger}
%\contrib[with an appendix by]{William Stein}

\begin{abstract}
FIXME
\end{abstract}

\address{H. D.: Montreal, Canada}
\email{darmon@math.mcgill.ca}
\address{M. D.: Berkeley, California}
\email{mwdaub@math.berkeley.edu}
\address{S. L.: Stanford, California}
\email{saml@math.stanford.edu}
\address{V. R.: Departament de Matem\`{a}tica Aplicada II, Universitat Polit\`{e}cnica de Catalunya, C. Jordi Girona 1-3, 08034 Barcelona, Spain}
\email{victor.rotger@upc.edu}



\maketitle

\section{Introduction}

Let $E_{/\mathbf Q}$ be an elliptic curve of conductor $N$ and $f=\sum_{n\geq 1} a_n e^{2\pi i nz}\in S_2(\Gamma_0(N))$ the weight two eigenform associated to $E$ by modularity. 
The conjecture of Birch and Swinnerton-Dyer (BSD) predicts that for any number field $H$, the rank of the Mordell-Weil group $E(H)$ of $H$-rational points on $E$ is equal to the order  of vanishing $r_{\mathrm{an}}(E_{/H})$ of the L-series $L(E_{/H},s)$ at its central critical point $s=1$. In particular, this raises the question:
\begin{center}
{\em If $L(E_{/H},1)=0$, how can one construct a non-torsion rational point $P\in E(H)$?}
\end{center}
A fruitful approach to this question is afforded by the theory of {\em Heegner points} over imaginary quadratic fields $K$. Work of Gross, Zagier and Kolyvagin using this theory provides what is (at present) perhaps the best  theoretical evidence for BSD; see \cite{GZ}, \cite{Kol}, as well as the more recent \cite{Zh}.

Let $\mathfrak H^*=\{ z\in \mathbf C: \mathrm{Im}(z)>0\} \cup \mathbf P^1(\mathbf Q)$ denote the extended upper-half plane, topologized in the usual manner (\textit{cf.}, for example, \cite[Ch. 2]{DiSh}). For $z\in \mathfrak H^*$, let $\gamma_z$ be a choice of continuous path between the cusp at $\infty\in \mathbf P^1(\mathbf Q)$ and $z$.  Heegner points may be defined complex-analytically as the images of quadratic irrationalities $z\in \mathfrak H\cap K$ under the modular parametrization
\begin{equation}\label{h}
\varphi: X_0(N)(\mathbf C)\simeq \Gamma_0(N)\backslash \mathfrak H^* \lra E(\mathbf C)\simeq\mathbf{C}/\Lambda_E, \,\, z\mapsto \int_{\gamma_z} \omega_f = c \sum_{n\geq 1} \frac{a_n}{n} e^{2\pi i nz}.
\end{equation} 
Here we assume for simplicity that $E$ is the strong Weil curve in its isogeny class. Thus the regular differential form associated with $f$ is $\omega_f=2 \pi i c\cdot f(z) dz$, where $c\in \mathbf Z$ is the {\em Manin constant}, conjecturally equal to $1$ and known to be so when $N<60000$, \textit{cf.}\,\cite{St?}.

Heegner points, although {\em a priori} defined over $\mathbf C$, are known to be  algebraic. More precisely, by the theory of complex multiplication they are defined over suitable abelian extensions $H$ of the imaginary quadratic field $K$. Conversely, denoting by $\bar{\mathbf Q}$ the algebraic closure of $\mathbf Q$ in $\mathbf C$, if $z\in \mathfrak H\cap \bar{\mathbf Q}$ is such that $[\mathbf Q(z):\mathbf Q]>2$, then the image $\varphi(z)$ lies in $E(\mathbf C)\setminus E(\bar{\mathbf Q})$. (See \cite[Ch. 3]{Wa}, where it is shown  that $j(z)$ is trancendental for $z\in \mathfrak H\cap \bar{\mathbf Q}$ with $[\mathbf Q(z):\mathbf Q]>2$. Since the pair of rational functions $(j(z), j(Nz))$ give coordinates for a (singular) affine model of $X_0(N)$ over $\mathbf Q$, it follows that the class of $z$ in $X_0(N)(\mathbf C)$ is a point with transcendental coordinates. The claim follows because $\varphi$ is a finite map.)

Various attempts have been made to find other explicit analytic formulas for rational points on $E$ over number fields $H$:

\begin{itemize}

\item In \cite{BeDa} and \cite{Gr1}, the complex upper half-plane $\mathfrak H^*$ is replaced by the $p$-adic upper half-plane, regarded as a rigid analytic variety. Using Coleman's $p$-adic path integrals, this work gives formulas for (and presents explicit calculations of) $p$-adic incarnations of the {\em same} Heegner points considered in \eqref{h}.

\item Again exploiting $p$-adic path integrals,  \cite{Dar00} suggests a construction of points on $E$ defined over $\mathbf C_p$, the completion of an algebraic closure of $\mathbf Q_p$.
These {\em Stark-Heegner points} are conjectured to be $H$-rational for suitable abelian extensions of {\em real} quadratic fields $K$ for which $p$ is inert. See \cite{DaPo} for the numerical verification of these conjectures.

\item Let  $E_{/F}$ be a modular elliptic curve over a totally real number field $F$. Using cohomological constructions similar to those of \cite{Dar00}, but replacing \eqref{h} by a formula involving integrals of complex-analytic differential forms of {\em higher order} associated to Hilbert modular forms, \cite[Ch.\,VIII]{Darbook} proposes another construction of points in $E(\mathbf C)$. These points are conjectured to be defined over suitable abelian extensions $H$ of quadratic extensions $K/F$ which have exactly one non-real archimedean place. See also \cite{DaLo} for numerical calculations providing evidence for these conjectures.

\item Let $E_{/F}$ be an elliptic curve defined over a number field $F$, and assume $E$ has complex multiplication  over $\bar F$ by an imaginary quadratic field $K$. As replacements for the set of Heegner points $z\in \mathfrak H \cap K$,
\cite{BDP2} defines, for any integer $r\geq 0$, a collection of generalized Heegner cycles on a $(2r+1)$-dimensional manifold $W_r\times E^{r}$, where $W_r$ is a Kuga-Sato variety. Here the role of the modular parametrization \eqref{h} is played by Abel-Jacobi maps from the Chow groups of null-homologous cycles on $W_r\times E^{r}$
to certain generalized Jacobians.
\end{itemize}

Here we follow a different approach, using K.-T. Chen's iterated path integrals  \cite{Chen}. A
defect of the functional
\begin{align*}
\pi_1(X_0(N)(\mathbf C);\infty) &\to \mathbf C, \text{  defined by}\\
 \gamma &\mapsto \int_{\gamma} \omega_f
\end{align*}
is that it
factors through the maximal abelian quotient $H_1(X_0(N)(\mathbf C),\mathbf Z)$ of the fundamental group of the Riemann surface underlying the modular curve $X_0(N)$. Chen observed that it is nevertheless possible to obtain non-abelian information about this fundamental group using integration.
His theory of iterated integrals give rise to functionals
$$
J: \pi_1(X_0(N)(\mathbf C);\infty) \lra \mathbf C
$$
which do not necessarily factor through $H_1(X_0(N)(\mathbf C),\mathbf Z)$.

The goal of this paper is to describe an algorithm for the computation of \textit{Chow-Heegner points}, following \cite{DRS}. In this construction one replaces the integral appearing in \eqref{h} by an {\em iterated} integral of {\em two} modular forms. In order to describe it more precisely, we fix cuspidal eigenforms $f,g\in S_2(\Gamma_0(N))$ and assume $f$ is a newform with rational Fourier coefficients. To $g$ is associated 
a collection of one-dimensional algebraic cycles $T_{g,n}$ for all integers $n\geq 1$ on $X_0(N)\times X_0(N)$. Each of these cycles gives rise to a class in $\operatorname{Pic}(X_0(N))$, essentially by intersecting $T_{g,n}$ with the diagonal in $X_0(N)\times X_0(N)$,
and to an associated rational point $P_{g,n}$ of the Jacobian $J_0(N)$; the construction of $T_{g,n}$ and $P_{g,n}$ is described more precisely in \S \ref{describe1} and \S \ref{describe} below. Write  $A_f$ for the modular abelian variety attached to $f$ by the Eichler-Shimura construction.
The image $P_{g,f,n}$ of $P_{g,n}$ in $A_f(\mathbf Q)$ is called the {\em Chow-Heegner point} attached to the eigenforms $g$ and $f$ and the integer $n$.

Work of Yuan--Zhang--Zhang \cite{YZZ} gives a criterion in terms of L-functions (\textit{cf.} \cite[Corollary 1.4]{DRS}) for when the points $P_{g,f,n}$ are non-torsion, which explains why Chow-Heegner points are of interest in the context of the conjecture of Birch and Swinnerton-Dyer.

Although the Hodge class $\xi_{g,n}$ in the cohomology of $X_0(N)\times X_0(N)$ associated
to the cycle $T_{g,n}$ is easy to compute using linear algebra, the cycle $T_{g,n}$ itself is much more difficult to compute explicitly. This poses a challenge if one wishes to calculate the points $P_{g,f,n}$ numerically.
However, it is shown in \cite{DRS} that $P_{g,f,n}$ can be computed as an element of the analytic curve $A_f(\mathbf C)$ using \textit{only} the data of the Hodge class $\xi_{g,n}$, in terms of a certain iterated path integral in the sense of \cite{Chen}. This formula is amenable to numerical computation, which we have implemented using the free software package {\tt Sage} \cite{sage}. Our algorithm makes these points readily computable in practice for elliptic curves $A_f$ of small conductor.

While the analytic formula is not the only way of computing the points $P_{g,f,n}$ (see the Appendix) our approach has 
certain advantages: it applies to a broad class of eigenforms $g$, and works for arbitrary Hodge classes. In future work, we hope to extend the algorithm described below to compute Chow-Heegner points \cite{DRS2} associated to exceptional Hodge classes on products of Kuga-Sato varieties arising from CM forms. The rationality of Chow-Heegner points computed in this manner could provide numerical evidence for certain open cases of the Hodge conjecture.

\subsection*{Plan of the paper} In \S  \ref{prelim} we recall necessary facts about itegrated integrals and related ingredients for our main algorithm.
In \S  \ref{chpt} we specialize to the case of modular curves, define the points $P_{g,f,n}$ precisely, and write down an explicit analytic formula for them. In \S  \ref{alg} we describe in detail an algorithm for evaluating this formula numerically. The algorithm is illustrated with numerical examples in \S \ref{eg}, which also includes a table of triple Chow-Heegner points on rank one elliptic curves of small conductor.

% One interesting question is to determine the index $[A_f(\mathbf Q): \mathbf Z P_{g,f}]$ in terms of arithmetic invariants attached to the elliptic curve $A_f$. By BSD, this index should be related to the ``fudge factor'' connecting the derivative $L(f\otimes g\otimes g, 2)$ with the height of $P_{g,f}$; cf. \cite[Theorem 4.1]{DRS} and Yuan-Zhang-Zhang FIXME:add ref. (What is the fudge factor? Do our data match is?) The numerical data in our tables could be useful for investigating this matter.

\subsection*{Source code} Our {\tt Sage} implementation of the algorithm described in this paper can be found at http:$//$www-ma2.upc.edu/vrotger/publicacions$_-$en.html\footnote{If any of you has a website and wishes to provide a link to the code there, add the url here.}.

\subsection*{Acknowledgments}
We warmly thank the organizers of the Arizona Winter School 2001 for inviting the first and forth author to deliver a series of lectures at the meeting, for creating such an inspiring atmosphere and bringing the four of us the opportunity of working together.

\section{Preliminaries}\label{prelim}
\subsection{}\label{hdr}
%Let $F$ be a number field (we take $F = \mathbf Q$ in the sequel)  and fix an embedding $\iota:F\hookrightarrow \mathbf C$.
% Let $\bar F$ denote the algebraic closure of $F$ in $\C$ and set  $G_F:=\Gal(\bar F/F)$. 
Let $X$ be a smooth, complete algebraic curve of genus $g\geq 2$ 
over $\mathbf Q$, and let $Y=X\setminus \{ \infty\}$ be the complement of a single point in $X(\mathbf Q)$. For a smooth variety $V$ defined over $\mathbf Q$ (such as $X$ or $Y$) we denote by $V^{\mathrm{an}}$ the complex manifold
$V(\mathbf C)$ with its analytic topology.

The {\em de Rham cohomology}  $H^1_{\dR}(X^{\mathrm{an}},\mathbf C)$ 
is the cohomology of the de Rham complex of smooth $\mathbf C$-valued
 differential forms on $X^{\mathrm{an}}$. 
%
% There is a canonical identification
% $H^1_{\mathrm{Betti}}(Y^{\mathrm{an}},\mathbf Z) \otimes \mathbf C = H^1_{\mathrm{dR}}(Y^{\mathrm{an}}, \mathbf C)$
% arising from integration of smooth differential forms against smooth chains.
%
% The vector space $H^1_{\mathrm{dR}}(Y^{\mathrm{an}},\mathbf C)$  is equipped with a
% decreasing filtration $\Fil^\bullet$, the so-called {\em  Hodge filtration}, which is
%  given by
% $$ \Fil^j H^1_{\dR}(Y^{\mathrm{an}}) = \left\{
% \begin{array}{ll}
% H^1_{\dR}(Y^{\mathrm{an}}) & \mbox{ if } j \le 0,\\
% \Omega^1_{\log}(Y^{\mathrm{an}}) & \mbox{ if } j = 1,\\
% 0  & \mbox{ if } j \ge 2,
% \end{array} \right.
% $$
% where $\Omega^1_{\log}(Y^{\mathrm{an}})$ denotes the space of holomorphic differentials on $Y^{\mathrm{an}}$
%  with at worst a
% logarithmic pole at the point $\infty$. 
Since the Riemann surface $X^\mathrm{an}$ is algebraic and defined over $\mathbf Q$, there is a canonical isomorphism
$$H^1_{\dR}(X^{\mathrm{an}},\mathbf C) = H^1_{\dR}(X/F)\otimes \mathbf C.$$
Here 
\begin{equation*}%\label{deRham-comparison}
H^1_{\dR}(X/\mathbf Q) := \mathbf H^1(0\rightarrow \cO_X \rightarrow \Omega^1_X \rightarrow 0)
\end{equation*}
is the {\em algebraic de Rham cohomology} of $X/\mathbf Q$, defined as 
the hypercohomology of the de Rham complex of sheaves of
regular differential forms on $X$.

% The Hodge filtration on $H^1_{\dR}(Y/F)$  is described concretely by
% \begin{equation}
% \label{filtrationH1}
% \Fil^j H^1_{\dR}(Y/F) = \left\{ 
% \begin{array}{ll}
% H^1_{\dR}(Y/F) \simeq \Omega^{II}(Y)/dF(Y) & \mbox{ if } j\le 0, \\
% \Omega^1_{\log}(Y/F) & \mbox{ if } j = 1 \\
% 0 & \mbox{ if } j \ge 2,
% \end{array} \right.
% \end{equation}
% where 
% \begin{enumerate}
% \item
% $\Omega^{II}(Y)$ is the space 
% of  rational differential forms on $Y$ over $F$
%  with vanishing residues at all points of $Y$; 
% these are also called {\em differentials
% of the second kind} on $Y$;
% \item 
% $F(Y)$ is the field of rational functions on $Y$;
% \item 
% $\Omega^1_{\log}(Y/F) = \{ \omega \in \Omega^1(Y) 
% \quad \mbox{ with } \quad  \mathrm{ord}_\infty(\omega)\geq -1\}$, 
% where $\mathrm{ord}_P(\omega)$ 
%  denotes  the valuation of a differential
%  $\omega$ at a closed point $P$. 
% \end{enumerate}
Because $X$ is a curve, the group $H^1_{\dR}(X/\mathbf Q)$ has a particularly simple description using
$$ \Omega^1_{\mathrm{II}}(X) := \text{rational 1-forms on $X$ with vanishing residues at all points of $X$}.$$
Such 1-forms are called  \textit{differentials of the second kind} (on $X$). 
Observe that $\Omega^1_{\mathrm{II}}(X)=\Omega^1_{\mathrm{II}}(Y)$, by the residue formula.
Thus there is a canonical isomorphism
\[H^1_{\mathrm{dR}}(X/\mathbf Q) = \Omega^1_{\mathrm{II}}(Y)/\mathrm{d}\mathbf Q(X),\]
where $\mathbf Q(X)$ is the field of rational functions on $X$.
Using Riemann-Roch one sees that $\Omega^1_{\mathrm{II}}(Y)/\mathrm{d}\mathbf Q(X) \cong \Omega^1(Y)/\mathrm{d}\Gamma(Y,\mathcal O_Y)$. So $H^1_{\mathrm{dR}}(X/\mathbf Q)$ can also be computed as the space of
\textit{regular} 1-forms on $Y$, modulo exact forms. For computational purposes, the latter description is the most useful: we will compute with classes in $H^1_{\mathrm{dR}}(Y)$ using rational 1-forms on $X$, regular away from the point $\infty$.
These are amenable to computation via their Laurent expansions about $\infty$.

Later on we shall make use of the symplectic {\em Poincar\'e pairing}
\[\langle,\rangle:H^1_{\dR}(X^\mathrm{an},\mathbf C)\times H^1_{\dR}(X^\mathrm{an}, \mathbf C)\to \mathbf C,\]
defined by 
  $$\langle\omega,\eta\rangle:=\frac{1}{2\pi i}\int_X \omega\wedge \eta$$
  for (the cohomology classes of) smooth $\mathbf C$-valued 1-forms $\omega,\eta$ on $X^\mathrm{an}$.
If $\omega$ and $\eta$ are differentials of the second kind on $X$, regular away from the cusp $\infty$, then the induced pairing on $H^1_{\mathrm{dR}}(X/\mathbf Q)$
can  be computed as
\[\langle \omega,\eta\rangle = \res_\infty (F_\omega \cdot \eta) =
 -\res_\infty (\omega \cdot F_\eta),\]
where $F_\nu$ denotes a local primitive of the differential $\nu$ at $\infty$.
\subsection{}
We now turn to recalling the definition and basic properties of iterated integrals; see \cite{Chen}, \cite{Hain}, \cite{Hain2} for more details.

Fix a base point $o\in Y^{\mathrm{an}}$ and dente by $\Gamma := \pi_1(Y^{\mathrm{an}};o)$ the fundamental group
of the Riemann surface $Y^{\mathrm{an}}$.
We write $I\subset \mathbf Z[\Gamma]$  for augmentation ideal of the integral group ring of $\Gamma$.
Recall that $H_1(X^\mathrm{an},\mathbf Z) = H_1(Y^{\mathrm{an}},\mathbf Z) \cong \Gamma^{\mathrm{ab}}$,
as can be seen from the well-known presentation for the fundamental group of a Riemann surface, and that this abelian group 
is naturally identified with $I/I^2$.

\begin{definition}
The {\em path space} on $Y$ based at $o$, denoted  $\mathbf P(Y;o)$,  is  the set of
piecewise-smooth paths 
$$
\gamma:[0,1]\lra Y^{\mathrm{an}}, 
\quad  \mbox{ with  } \gamma(0)=o. $$ 
\end{definition}

Let $$\pi:{\tilde Y}\to Y^{\mathrm{an}},\qquad\text{resp.}\qquad \pi:\tilde X\to X^\mathrm{an},$$
 denote the universal covering space of  $Y^{\mathrm{an}}$ (resp. $X^\mathrm{an}$) corresponding to the basepoint $o$.
 The group $\Gamma $
 acts on $\tilde Y$ 
transitively and without fixed points, 
and the map $\gamma\mapsto \gamma(1)$  identifies
the quotient ${\tilde Y}/\Gamma$ with $Y^{\mathrm{an}}$. 

Recall a closed, $\mathbf C$-valued smooth 1-form
(resp. a meromorphic 1-form of the second kind) $\eta$
 on $X^{\mathrm{an}}$ admits a smooth (resp. meromorphic) primitive 
 $F_\eta:{\tilde X}\to \mathbf C,$
 defined by the rule
$$F_\eta(\gamma) := \int_0^1 \gamma^\ast \eta.$$

\begin{definition}
The {\em  basic iterated integral }
attached to an ordered $n$-tuple  $(\omega_1,\ldots,\omega_n)$ of smooth 1-forms on $Y^{\mathrm{an}}$ is
the function $\mathbf P(Y;o)\to \mathbf C$, denoted $\int \omega_1\cdot \omega_2\cdot\ldots\cdot \omega_n$, defined by
\begin{equation*}
\label{eqn:def-ii}
\gamma\mapsto  \int_{\gamma} \omega_1\cdot\omega_2\cdot\ldots \cdot\omega_n := \int_{\Delta}
(\gamma^*\omega_1)(t_1) (\gamma^*\omega_2)(t_2) \cdots  (\gamma^*\omega_n)(t_n),
\end{equation*}
where $\Delta$ is the simplex in $[0,1]^n$ defined by $0\le t_n \le t_{n-1} \le \cdots \le t_1 \le 1$.
The integer $n$ is called the {\em length} of this basic iterated integral.
\end{definition}
\begin{example}
When $n=2$,
the basic iterated integral attached to
 $\omega$ and $\eta$ can be computed  by the formula
$$ \int_\gamma \omega \cdot \eta =  
\int_\gamma \omega F_{\eta} = 
\int_0^1  \gamma^\ast(\omega F_{\eta}).$$
In the expression in the middle, we abusively use the same notation $\omega$ for the differential $\pi^*\omega$ on  $\tilde Y$.
The 1-form $\omega F_\eta$  is to be integrated along a lift of $\gamma$ to $\tilde Y$, which is unique once a lift of $o$ to $\tilde Y$ is specified.
\end{example}
\begin{definition}
An {\em iterated integral} 
 is  a linear combination  of basic iterated integrals, viewed as a function on $\mathbf P(Y;o)$.
Its  {\em length} is defined to be the maximum of the lengths
of its constituent basic iterated integrals. It is said to be 
{\em homotopy invariant} if its value on any path $\gamma$  depends only on the homotopy class of
$\gamma$. 
\end{definition}
A homotopy invariant iterated integrals defines a $\mathbf C$-valued function on $\Gamma$, and
by extending linearly induces a homomorphism of abelian groups $\mathbf Z[\Gamma]\to \mathbf C$.
%For each $n$, let
% $\mathrm{It.Int.}^{\le n}(Y)$ 
%denote the subspace of  homotopy invariant
%iterated integrals of length $\le n$. 
Observe that a homotopy invariant iterated integral of length $\leq n$ 
 vanishes on the $(n+1)^{\mathrm{st}}$ power $I^{n+1}$ of the augmentation ideal in $\mathbf Z[\Gamma]$, and hence gives rise to a well-defined  element of
$\operatorname{Hom}(I/I^{n+1},\mathbf C)$. 
The natural map
\begin{equation}\label{hiii}
(\text{homotopy invariant iterated integrals of length $\leq n$}) \lra \operatorname{Hom}(I/I^{n+1},\mathbf C)
\end{equation}
is an isomorphism; see, for example, \cite{Hain2}.


% The following lemma is helpful in describing $\II^{\le 2}(Y)$ concretely.
% \begin{lemma}
% Let $\eta_1$ and $\eta_2$ be  closed  $C^\infty$ 1-forms  on $Y^{\mathrm{an}}$, and let 
%  $\alpha$
%  be any smooth one-form
%  satisfying the differential equation 
% \begin{equation}
% \label{eqn:diff-hard}
%  d \alpha = \eta_1 \wedge \eta_2.
% \end{equation}
% Then we have the following.
% \begin{itemize}
% \item[(i)] The  iterated integral
% $$ J_{\eta_1\otimes\eta_2,\alpha}(\gamma) = \int_{\gamma} \eta_1 \cdot \eta_2 - \int_{\gamma} \alpha$$
% is homotopy invariant. 

% \item[(ii)] The space $\II^{\le 2}(Y)$ is spanned by
%  iterated integrals of the form $J_{\eta_1\otimes\eta_2,\alpha}$. 
% \end{itemize}
% \end{lemma}
% \begin{proof}
% % The first claim follows directly from the fact that the differential 
% % on ${\tilde Y}$ 
% % appearing in the expression
% % $$ J_{\eta_1\otimes \eta_2,\alpha}(\gamma) = \int_\gamma \eta_1 F_{\eta_2} - 
% % \alpha$$
% % is closed.

% % As for the second, given any $J\in \II^{\le 2}(Y)$ , after  writing $p(J) = \sum \omega_i \otimes \eta_i$,
% % it can be checked that
% % $$ J = \left(\sum J_{\omega_i\otimes \eta_i,\alpha_i}\right)  - J_{0,0,\alpHa}$$
% % for suitable smooth differentials $\alpha_i$ on $Y(\C)$ 
% %   and $\alpha \in H^1_{\dR}(Y(\C))$. 
% See \cite[Prop. 3.1]{Hain2}, for example.
% \end{proof}


We will be interested in numerically evaluating certain homotopy invariant iterated integrals
on $Y$ of length $\leq 2$.
Suppose $\omega$ and $\eta$ are two  differentials of the second kind on $X$, regular on $Y$, representing cohomology classes $\omega,\eta\in H^1_{\dR}(X/\mathbf Q)$ in the manner of \S \ref{hdr}.
The basic iterated integral  $\int\omega\cdot\eta$ of length 2 is not generally homotopy invariant.
But when either $\omega$ or $\eta$ is holomorphic on $X$ --- i.e., has no pole at $\infty$ ---
a suitable modification of $\int \omega \cdot \eta$ will be homotopy invariant, as we now explain.

  Recall that a differential on a Riemann surface is said to have a
 {\em logarithmic pole} at a point if its expansion in terms of a local parameter $q$
  at this point is of the form $\sum_{n=0}^\infty a_n q^n \frac{dq}{q}$.
When $\omega$ is holomorphic at $\infty$, we let $\alpha_{\omega,\eta}$ be a meromorphic 1-form on $X$ that is regular on $Y$ 
and is such that the induced differential $\omega F_{\eta}-\alpha_{\omega,\eta}$ on $\tilde X$ has at worst a logarithmic pole at (any point lying over) $\infty$. This condition is well-posed because the principal part of $\omega F_\eta$ at $\tilde x\in \tilde X$
depends only on the image $x$ of $\tilde x$; see \cite[\S 2]{DRS}.
The form $\alpha_{\omega,\eta}$ exists --- and in fact can even be taken to be algebraic and defined over $\mathbf Q$ ---  by Riemann-Roch.
If $\omega$ is not holomorphic at $\infty$ but $\eta$ is, then we define $\alpha_{\omega,\eta} := -\alpha_{\eta,\omega}$.


\begin{lemma}\label{homotopyinv}
Let $\omega$ and $\eta$ be as above, and assume that either $\omega$ or $\eta$ is holomorphic at $\infty$. Then:
\begin{itemize}{}
\item[i.] The iterated integral $J_{\omega,\eta}:= \int \omega\cdot \eta - \alpha_{\omega,\eta}$ is homotopy-invariant.
\item[ii.]Suppose that $\omega$ and $\eta$ represent integral cohomology classes.
Using \eqref{hiii}, identify $J_{\omega,\eta}$ with a homomorphism of abelian groups $I/I^3\to \mathbf C$.
The restriction of $J_{\omega,\eta}$
to $I^2/I^3$ is $\mathbf Z$-valued and can be identified with $\omega\otimes \eta$,
viewed as an element of
\[H^1(X^\mathrm{an},\mathbf Z)\otimes H^1(X^\mathrm{an},\mathbf Z) \cong (H_1(X^\mathrm{an},\mathbf Z)\otimes H_1(X^\mathrm{an},\mathbf Z))^\vee = (I/I^2 \otimes I/I^2)^\vee = (I^2/I^3)^\vee.\]
(Here $A^\vee$ denotes $\operatorname{Hom}(A,\mathbf Z)$, for any abelian group $A$.)
\end{itemize}
 \end{lemma}

\begin{proof}
The homotopy invariance of $J_{\omega,\eta}$ follows from the fact that $J_{\omega,\eta}(\gamma) = \int_\gamma \omega F_\eta - \alpha_{\omega,\eta}$,
and the 1-form on $\tilde X $ in the integrand is holomorphic when restricted to $\tilde Y$. For the second claim, see the discussion at the beginning of \S 2 of \cite{DRS}, and  \textit{loc. cit.}, Lemma 1.1(2).
\end{proof}

\begin{remarkwr}\label{alpha=0} Note that if $\omega$ and $\eta$ are both holomorphic at $\infty$, then we can take $\alpha_{\omega,\eta} = 0$.
\end{remarkwr}

Now consider an integral Hodge class $\xi \in H^1(X^\mathrm{an},\mathbf Z)\otimes H^1(X^\mathrm{an},\mathbf Z)$.
The Hodge condition implies that we can choose a basis $\{\omega_i\}$ such that when we write $\xi = \sum c_{i,j} \omega_i \otimes \omega_j$, then either $\omega_i$ or $\omega_j$ is holomorphic at $\infty$ whenever $c_{i,j} \not=0$.
By the previous lemma, the iterated integral $J_\xi = \sum J_{\omega_i,\omega_j}$
is homotopy invariant and induces a homomorphism
\[J_\xi:H_1(X^\mathrm{an},\mathbf Z) = I/I^2 \to \mathbf C/\mathbf Z.\]
Fix an auxiliary holomorphic 1-form $\rho \in  H^{1,0}(X_{\mathbf C})\subset H^1(X^\mathrm{an},\mathbf C)$.
Denote by $\Lambda$ the period lattice $\langle \int_\gamma \rho:\gamma\in H_1(X^\mathrm{an},\mathbf Z)\rangle$. The class $\gamma_\rho \in H_1(X^\mathrm{an},\mathbf C)$ that is Poincar\'e dual
to $\rho$ actually belongs to $H_1(X^\mathrm{an},\mathbf Z)\otimes \Lambda$.
Consequently $J_\xi(\gamma_\rho)$ is a well-defined element of $\mathbf C/\Lambda$.


\subsection{}\label{describe1}
Let $X_1,X_2$ denote copies of $X$, and $X_{12}$ the diagonal copy of $X$
in $X_1\times X_2$. To a codimension-1 algebraic cycle
$Z\subset X\times X = X_1\times X_2$ (defined over $\mathbf Q$) we associate the divisor class
$$D_Z= (Z\cap X_{12})-(Z\cap X_1) - (Z\cap X_2).$$
Define a corresponding degree-zero divisor class
\[P_Z = D_Z - \deg(D_Z)o\in \operatorname{Pic}^0(X).\]
(Recall that $o\in X(\mathbf Q)$ is a fixed base point.)

We now state the iterated integral formula from \cite{DRS}
for the image of $P_Z$ under the Abel-Jacobi map
\[\mathrm{AJ}_X: \operatorname{Pic}^0(X) \to  \Omega^1(X^{\mathrm{an}})^\vee/H_1(X^{\mathrm{an}},\mathbf Z).\]
Let $\epsilon_o$ be the projector on $\operatorname{Pic}(X\times X)$
defined by
\[\epsilon_o(Z) = Z - i_{1*}\pi_{1*}-i_{2*}\pi_{2*}\]
where $\pi_{1},\pi_2:X\times X\rightrightarrows X$ are the projections
and $i_1,i_2:X\rightrightarrows  X\times X$ are the inclusions of ``vertical and horizontal'' copies of $X$ over the basepoint $o$.

Let $$\mathrm{cl}(\epsilon_o-):\operatorname{Pic}(X\times X)\to  H^1(X^{\mathrm{an}},\mathbf Z)\otimes H^1(X^{\mathrm{an}}, \mathbf Z)$$
denote the composition of the cycle class map and the projector $\epsilon_o$.
(The effect of $\epsilon_0$ is to annihilate the $H^2\otimes H^0$ and $H^0\otimes H^2$
factors in the K\"unneth decomposition of the second Betti cohomology group of $X\times X$.)
Suppose $\mathrm{cl}(\epsilon_o Z)$ is represented by $\sum_{i,j} c_{i,j} \omega_i\otimes \omega_j$,
where $\omega_i$ or $\omega_j$ is holomorphic at $\infty$ whenever $c_{i,j} \not=0$. 
\begin{theorem}[\cite{DRS}, Corollary 3.6]\label{iterformula}
The image $\mathrm{AJ}_X(P_Z)\in \Omega^1(X^{\mathrm{an}})^\vee/H_1(X^{\mathrm{an}},\mathbf Z)$
is represented by the linear functional
that maps  $\rho\in \Omega^1(X^{\mathrm{an}})$
to 
\[\sum J_{\omega_i,\omega_j}(\gamma_\rho) = \sum_{i,j} c_{i,j} \int_{\gamma_\rho} (\omega_i\cdot\omega_j - \alpha_{\omega_i,\omega_j})+\deg(D_Z) \int_o^\infty \rho  \in \mathbf C,\]
where
$\gamma_\rho\in H_1(X^{\mathrm{an}},\mathbf C)$ is Poincar\'e dual
to $\rho\in H^{1,0}(X^{\mathrm{an}})\subset H^1_{\mathrm{dR}}(X^{\mathrm{an}},\mathbf C)$.\qed
\end{theorem}
% \begin{remarkwr}\label{}
%   Some remarks upon the well-definedness of the righthand side of this formula for $P_{Z,f}$ are in order. Note that while the iterated integrals $J_{\xi\otimes\xi',\alpha}$ occuring in the formula are homotopy invariant functionals on the path space of $Y(\mathbf C)$, they are being evaluated on the path $\gamma_f$. Since $\gamma_f$ is defined to be Poincar\'e dual to a certain differential $\omega_f$, it is well-defined only as an element of the quotient
% $\pi_1(X(\mathbf C),o)^{\mathrm{ab}}$ of $\pi_1(Y(\mathbf C),o)$. On the other hand, the theorem states only that the righthand side of the formula gives a well-defined value in the quotient  $\mathbf C/\Lambda_f$ of $\mathbf C$, not in $\mathbf C$ itself. 

% FIXME: Explain why the two ambiguities cancel one another to make the formula in the theorem valid on the nose.
% \end{remarkwr}

% We now describe an alternate construction of $P_Z$ in order to explain how $P_Z$
% gives rise to $F$-rational points on abelian variety quotients of $\operatorname{Jac}(X)$. 

%   one can associate a nulhomologous codimension 2 algebraic cycle $\epsilon\Delta_T \in \mathrm{CH}^2(X\times X\times X)_0$. Over the complex numbers, there is a generalized Abel-Jacobi map
%  \[\mathrm{AJ}:\mathrm{CH}^2(X^{\mathrm{an}}\times X^{\mathrm{an}}\times X^{\mathrm{an}})_0 \to J^2(X^3)\]
%  taking values in the \textit{intermediate Jacobian} $J^2(X^3)$. (FIXME: add refernece, perhaps to Voisin's book. Probably best to avoid defining $J^2(X^3)$ in this paper.) The cycle $\Pi:=\mathrm{diag}(X)\times \mathrm{diag}(X)\subset (X\times X)\times (X\times X)$, viewed as an element of $\mathrm{CH}^2(X^4)$,
%  gives rise to a map $\Phi:\mathrm{CH}^2(X^3)_0\to \mathrm{CH}^1(X)_0=\operatorname{Pic}^0(X) = (\operatorname{Jac} X)(F)$, as well as an analytic avatar of the same, $\Phi^{\mathrm{an}}:J^2(X^3)\to J^1(X)=\Omega^1(X)^\vee/ H_1(X,\mathbf Z)$, which are compatible with the generalized Abel-Jacobi map above and the classical Abel-Jacobi map $\operatorname{Pic}^0(X)\to \Omega^1(X)^\vee/H_1(X,\mathbf Z)$, in the sense that the following diagram commutes.
%  \[\xymatrix{\mathrm{CH}^2(X^3)\ar[rr]^{\mathrm{AJ}}\ar[d]_{\Phi}&&J^2(X^3)\ar[d]^{\Phi^{\mathrm{an}}}\\(\operatorname{Jac} X)(F)\ar[rr]^{\mathrm{AJ}}_{\gamma\mapsto \int_\gamma}&&\Omega^1(X)^\vee/H_1(X,\mathbf Z)}\]
%  For details (as well as generalizations) of this construction we refer to \cite{DRS1}. We mention only the result of that paper which is most relevant to our purposes. Suppose $\omega\in \Omega^1(X)$ is a holomorphic 1-form. This gives rise to an evaluation map $$\mathrm{ev}_\omega: (\operatorname{Jac}X)(\mathbf C)\stackrel{\mathrm{AJ}}{\cong}\Omega^1(X)^\vee/ H_1(X,\mathbf Z) \to \mathbf C/\Lambda_\omega$$
%  where $\Lambda_\omega=\langle \int_\gamma \omega:\gamma\in H_1(X,\mathbf Z)\rangle \subset \mathbf Z$ is the period lattice associated to $\omega$.
%  We define the point $P_{Z,\omega}^{\mathrm{an}}\in \mathbf C/\Lambda_\omega$
%  to be $\mathrm{ev}_\omega \Phi^{\mathrm{an}} \mathrm{AJ}(\epsilon\Delta_Z)$.


% Now let $\pi:\operatorname{Jac}(X)\to E$ be a homomorphism from the Jacobian of $X$
% to an elliptic curve $E_{/F}$, and assume $\ker \pi$ is connected.
% Taking $\rho = \pi^*\omega_E$ to be the pullback of the N\'eron differential on $E$



\section{Chow-Heegner points on modular curves}\label{chpt}
We now specialize the discussion of the preceding section to the case of classical modular curves $X$. We shall define certain rational points on an arbitrary elliptic curve $E_{/\mathbf Q}$ called \textit{Chow-Heegner points}, such that the corresponding points of $E(\mathbf C)\cong \mathbf C/\Lambda_E$ can be computed using iterated path integrals via Theorem \ref{iterformula}.
\subsection{}
Let $N>1$ be an integer and $X=X_0(N)$ denote the canonical model over $\mathbf Q$ of the classical modular curve of level $N$; write $J_0(N)$ for the Jacobian of $X_0(N)$.
With this choice of $X$ we place ourselves in the setup of \S  1,
taking the ground field $F$ to be $\mathbf Q$
and the point $\infty\in X(\mathbf Q)$ to be the usual cusp at infinity.
Thus $Y:= X_0(N)-\{\infty\}$. (Note that $Y$ differs from the usual open modular curve $Y_0(N)$.) 
For the moment we do not specify the basepoint $o\in Y^{\mathrm{an}}$ used for topological constructions.

We write $S_2(\Gamma_0(N))$ for the space of cuspidal weight 2 modular forms for $\Gamma_0(N)$.
This space is canonically isomorphic to the vector space $\Omega^1(X^\mathrm{an})$ of holomorphic 1-forms
on $X$, via the map which associates to a modular form $f:\mathfrak H^*\to \mathbf C$
the 1-form $\omega_f = 2\pi i f(z)\operatorname{d}z$ on $X$.
We recall that if $f$ has Fourier expansion $\sum_{n\geq 1} a_n q^n$
then a Laurent expansion for $\omega_f$ near $\infty$ is given by $\sum_{n\geq 1} a_n q^n \frac{\operatorname{d}q}{q}$.



% Let $\{ \omega_{f_1,1}, ..., \omega_{f_1,n_1},..., \omega_{f_r,1}, ..., \omega_{f_r,n_r}\}$ a basis of the space $H^0(X,\Omega^1)$ of regular differential forms on $X$ over $\Q$, which we label in such a way that, for any given normalized (primitive or not) eigenform $f\in S_2(\Gamma_0(N))$, the $f$-isotypical subspace is $H^0(X,\Omega^1)[f]=\langle \omega_{f,1}, ..., \omega_{f,n} \rangle$. With these notations, $n$ is equal to the degree of the number field $\Q_f$ generated by the fourier coefficients of $f$. And the genus of $X$ is equal to $n_1+...+n_r$. 

% For each such $f$, there exists a collection $\{ \eta_{f,1}, ..., \eta_{f,n}\}$ of differential forms of the second kind on $X$ with a single pole at the cusp at infinity such that $$H^1_{\dR}(X/\Q)[f]=\langle\omega_{f,1}, ..., \omega_{f,n}, \eta_{f,1}, ..., \eta_{f,n}\rangle$$ and 
% \begin{equation*}\label{poincare}
% \langle \omega_{f,i},\eta_{f,j}\rangle =\delta_{ij}.
% \end{equation*}

%  Here, for any differential form of the second kind $\eta$ on $X$ we write $\tilde\eta$ for the local primitive of $\eta$ about $\infty$, normalized so that $\tilde\eta(\infty)=0$. 

% Note that the choice of each $\eta_{f,i}$ is unique up to exact forms $dh$, where $h$ is a rational function on $X$ with a single pole at $\infty$. (FIXME: Is this really true? For example, if $f$ has rational fourier coefficients, and $\omega_f$,$\eta_f$ form a symplectic basis, then so do $\omega_f$, $\eta_f+c\omega_f$ for any constant $c$. I think all we are saying here is that given the cohomology class of $\eta_{f,i}$, the differential form representing it is well-defined up to exact forms.)

\subsection{}\label{describe}
Let $E$ be an elliptic curve over $\mathbf Q$ of conductor $N_E$ dividing $N$. Its isogeny class corresponds to a newform $f\in S_2(\Gamma_0(N_E))$ with rational Fourier coefficients, which gives rise to a \textit{modular parametrization} $\pi_E: J_0(N_E) \to E$, a morphism of abelian varieties defined over $\mathbf Q$.

For the ease of exposition, we will assume throughout that $\ker \pi_E$ is connected. In this case, assuming the Manin constant $c=1$, the N\'eron lattice of $E$ coincides with the period lattice $\Lambda_f$ of the differential $\omega_f = 2\pi if(z)\mathrm{d}z\in \Omega^1(X_0(N_E)^{\mathrm{an}})$ corresponding to $f$.

The map $\pi_E$ can be computed on complex points explicitly, using the Abel-Jacobi  isomorphism $$\mathrm{AJ}_X:J_0(N_E)(\mathbf C)\cong \Omega^1(X_0(N_E)^{\mathrm{an}})^\vee/H_1(X_0(N_E)^{\mathrm{an}},\mathbf Z),$$ the Weierstrass uniformization $W:\mathbf C/\Lambda_f\cong E(\mathbf C)$, and the analytic parametrization $$\pi_E^\mathrm{an}:\Omega^1(X_0(N_E)^\mathrm{an})^\vee/H_1(X_0(N_E)^\mathrm{an},\mathbf Z) \to \mathbf C/\Lambda_f.$$
The map $\pi_E^\mathrm{an}$ sends the coset of a functional on $\Omega^1(X_0(N_E)^\mathrm{an})$ to the evaluation of that functional at $\omega_f$.
Thus for $P_{\mathbf C}\in J_0(N_E)(\mathbf C)$ we have
\begin{equation}\label{modularparam}\pi_{E,\mathbf C}(P_{\mathbf C}) = W(\pi_E^\mathrm{an}(\mathrm{AJ}_{X_0(N_E)}(P_{\mathbf C}))) = W(\mathrm{AJ}_{X_0(N_E)}(P_{\mathbf C})(\omega_f)).\end{equation}

For each divisor $d$ of $N/N_E$ there is a degeneracy map $\pi_d: X_0(N) \to X_0(N_E)$ which induces by the Albanese universal property a morphism of abelian varieties $\pi_d: J_0(N) \to J_0(N_E)$, which we denote with the same symbol. Put $\pi^d_{E}=\pi_E \cdot \pi_d: J_0(N) \to E$ for the composition of $\pi_d$ with $\pi_E$. When $d=1$, $\pi_1$ is the projection arising from the natural inclusion $\Gamma_0(N)\subseteq \Gamma_0(N_E)$ and we shall simply write $\pi^1_{E}=\pi_E$; it will be clear from the context whether the source of this map is $J_0(N)$ or $J_0(N_E)$. 

Let $\mathbf T = \mathbf Q[\ldots,T_n,\ldots]$ be the Hecke algebra of level $N$, and let $\mathbf T_0$ denote the subalgebra generated by Hecke operators prime to the level $N$. Then 
$$
\mathbf T_0  \simeq \prod_{h} K_{h} \subseteq \mathbf T  \simeq \prod_{h} L_{h} 
$$ 
where $h$ runs over Galois conjugacy classes of newforms of all levels $M$ dividing $N$, $K_{h} = \mathbf Q(\{a_n(h)\}_{n\geq 1})$ is the number field generated by the Hecke eigenvalues of $h$, and, if $N_h\mid N$ stands for the level of $h$, $L_h$ is isomorphic to a product of finite field extensions of $K_h$, of degree $[L_h:K_h] =\sigma(N/N_h)$, the number of factors of $N/N_h$ (cf.\,\cite{Ka}, \cite[Ch.\,14]{RiSt}). The endomorphism algebra $\End^0(\Jac(X)):=\mathbf Q\otimes \End (\Jac(X))$ contains the Hecke algebra $\mathbf T_0$ as its center and $\mathbf T$ as a maximal commutative subalgebra (and $\End^0(\Jac(X))\simeq \mathbf T \simeq \mathbf T_0$ only when $N$ is prime), as 
\begin{equation}
\End^0(\Jac(X)) = \langle \T, \{ \delta_d\}_{d\mid \sigma(N/N_h)}\rangle\simeq \prod_h M_{\sigma(N/N_h)}(K_h),
\end{equation}
where $\delta_d$ are the degeneracy operators as defined e.g. in \cite{Ka}.

\begin{definition}
For a divisor $M$ of $N$ and a newform $g \in S_2(\Gamma_0(M))$, denote by 
$$
T_g \in \mathbf T_0  \cong \prod_{h} K_{h}
$$
the idempotent with 1 in the $K_g$ component and 0 elsewhere. 

We shall also view $T_g$ as an idempotent of $\mathbb T $ and of $\End^0(\Jac(X))$ by the natural inclusion, so that $\mathbf T[g]:=T_g \cdot \mathbf T = L_g$ and $\End^0(\Jac(X))[g]:=T_g\cdot \End^0(\Jac(X)) = M_{\sigma(N/M)}(K_g)$. 


\end{definition}

There are natural isomorphisms 
\begin{equation}\label{corr-iso}
\End(\Jac(X))\otimes \Q \simeq \mathrm{Corr}(X):= \Pic(X\times X)\otimes \Q /( \pi_1^*\Pic(X)\otimes \Q \oplus \pi_2^* \Pic(X)\otimes \Q ).
\end{equation}

Under these identifications, an endomorphism $T\in \End^0(\Jac(X))$ is associated to a divisor class in $\operatorname{Pic}(X\times X) \otimes\mathbf Q$, which we also denote by the same symbol, and is well-defined only up to horizontal and vertical divisors.


In \S \ref{describe1} a point $P_T\in \operatorname{Pic}^0(X) = J_0(N)(\mathbf Q)$ was
attached to a divisor $T$ on $X\times X$; this point only depends on the class of $T$ in $ \Pic(X\times X)\otimes \Q /( \pi_1^*\Pic(X)\otimes \Q \oplus \pi_2^* \Pic(X)\otimes \Q )$.
This construction gives rise to a map
\begin{eqnarray*}
\operatorname{Pic}(X\times X)\otimes \mathbf Q&\to& J_0(N)(\mathbf Q)\otimes \mathbf Q\\
T&\mapsto& P_T.\end{eqnarray*}

Note that both these divisor classes and the projector $\epsilon_o$ depend on the basepoint $o$,
so we must now specify a particular choice of $o$.
In the following definition, \textit{we fix the choice of basepoint $o$
to be the cusp $0\in X$}, which is distinct from $\infty$ because $N>1$.

\begin{definition}\label{gf}
For an operator $T\in \End^0(\Jac(X))[g]$ and a divisor $d$ of $N/N_E$, define the Chow-Heegner point
$$
P_{T,f^{(d)}} = \pi^d_E(P_T) \in E(\mathbf Q)\otimes \mathbf Q
$$

When we take $d=1$ we shall just write $P_{T,f}$ for $P_{T,f^{(d)}}$; in addition, the Chow-Heegner point associated with $T=T_g$ and $d=1$ shall be denoted $P_{g,f}$.

For any positive integer $n$, define $T_{g,n} := T_g \cdot T_n \in \mathbf T $ as the product of $T_g$ and $T_n$, and define 
$$
P_{g,f,n} := P_{T_{g,n},f}.
$$
\end{definition}

Note that $P_{g,f}=P_{g,f,1}$ and $P_{g,f,n} = a_n(g)P_{g,f}$ if eigenvalue $a_n(g)$ of $T_n$ acting on the $g$-isotypic component is rational. Thus, the points $P_{g,f,n}$ for $n>1$ are only of interest when $g$ has irrational Fourier coefficients or is an oldform.
For a general discussion of the notion of Chow-Heegner point, of which the construction above is a special case, see the introduction of \cite{BDP2} and \cite{DRS}. 


\begin{remarkwr}\label{pointrelations}
To avoid the troublesome tensor products with $\mathbf Q$ in the definition of the above Chow-Heegner points $P_{T,f^{(d)}}$,
one must work with an actual algebraic cycle on $X\times X$, as opposed to $T$ which is merely a $\mathbf Q$-linear combination of such cycles.
Define the ``denominator'' $d_T$ of $T\in \mathbf T$ to be the smallest positive integer such that $d_{T} T$ lies in the integral Hecke algebra $\mathbf T_{\mathbf Z} := \mathbf Z[\ldots,T_n,\ldots]$. Then $d_T P_{T,f^{(d)}}$ belongs to $E(\mathbf Q)$; see also \S \ref{denom}.

However, we regard $d_{g,n} P_{g,f,n}$ as well-defined only modulo the torsion subgroup $E(\mathbf Q)^{\mathrm{tor}}$.
The reason for this is that to obtain a computable formula for $P_{g,f,n}$
one can take the basepoint $o$ to be \textit{any} cusp other than $\infty$. There being no distinguished choice, 
one is left with an ambiguity valued in the image in $E(\mathbf Q)$ of the (torsion) cuspidal subgroup of $J_0(N)$;
see \eqref{pgf} below and the subsequent remarks.

\end{remarkwr}


\begin{theorem}[\cite{DRS}, Corollary 1.4]\label{DRS1.4}
Assume that the local signs $\varepsilon_p(g,g,f)$ of Garrett's triple product L-function $L(g,g,f,s)$ are $+1$ at the primes $p\mid N$.
Then the module of points 
$$
\underline{P}_{g,f} := \langle P_{T,f^{(d)}}, T\in \End^0(\Jac(X))[g] \rangle_{d\mid \frac{N}{N_E}} \subseteq E(\mathbf Q)\otimes \mathbf Q
$$ 
is nonzero
(or equivalently, there is at least one point $\sum_{d\mid N/N_E} n_d \pi^d_E(d_T P_{T})\in E(\mathbf Q)$ for some $T$ and integers $n_d$ which is non-torsion) if and only if the following conditions hold:
\begin{itemize}
\item[i.] $L(f,1)=0$,
\item[ii.] $L'(f,1)\neq 0$, and
\item[iii.] $L(f\otimes \operatorname{Sym}^2(g),2)\neq 0$.
\end{itemize}
\end{theorem}

%\begin{remark} If $g$ is not a newform with rational Fourier coefficients, the point $P_{g,f}$  can be zero even when the conditions of the above theorem are satisfied. In general, one expects $P_{g,f,n}$ to be nonzero for some %value of $n$ if and only if conditions i-iii hold.\footnote{FIXME: Is this right?}
%\end{remark}



\subsection{}

The aim of this section is to explain how to explicitly compute the slightly smaller submodule
$$
\underline{P}_{\mathbf T[g],f} := \{ P_{T,f}, T\in \mathbf T[g] \} = \langle P_{g,f,n}\rangle_{n\geq 1} \subseteq  \underline{P}_{g,f}
$$
of the Mordell-Weil group $E(\mathbf Q)\otimes \mathbf Q$ of $E$.

Theorem \ref{iterformula} gives rise to an explicit formula for  a triple Chow-Heegner point $P_{g,f,n}$ in terms of iterated integrals. This formula is stated in terms of  the components of the cohomology class $\mathrm{cl}(\epsilon_o T_{g,n})\in H^1_{\dR}(X/\mathbf Q)^{\otimes2}$ expressed as a sum of pure tensors. In this section we find an explicit formula for $\mathrm{cl}(\epsilon_o T_{g,n})$.

The action of the Hecke algebra $\mathbf T_0$ on modular forms extends to an action on the de Rham cohomology of $X$. Under this action, we have
$$H^1_{\mathrm{dR}}(X/\mathbf Q) \cong H^1_{\mathrm{dR}}(X/\mathbf Q)[g_1] \oplus \cdots \oplus H^1_{\mathrm{dR}}(X/\mathbf Q)[g_n],$$
indexed by Galois conjugacy classes of newforms of all levels $M$ dividing $N$. Let $g\in S_2(\Gamma_0(M))$ be a newform and suppose $\{\omega_{g,1},\ldots,\omega_{g,2k}\}$ is a collection of differentials of the second kind on $X$ representing a basis for $H^1_{\dR}(X/\mathbf Q)[g]$. Write $T_n\omega_{g,i} = \sum_j a_{ij}^n\omega_{g,j}$, and denote by $A_n$ and $B$ the matrices $(a_{ij}^n)_{1\leq i,j\leq 2k}$ and $(\langle \omega_{g,i}, \omega_{g,j} \rangle)_{1\leq i,j\leq 2k}$, respectively, where $\langle~,~\rangle$ denotes the Poincare pairing. Then we have the following:


\begin{lemma}\label{hodgeclass}
$\mathrm{cl}(\epsilon_o T_{g,n}) = \sum_{i,j} c_{ij}^n \omega_{g,i} \otimes \omega_{g,j}$, where $(c_{ij}^n)_{1\leq i,j\leq 2k} = -B^{-1}A_n$.
\end{lemma}
\begin{proof}
%By definition $T_g$ is a correspondence that acts on $H^1(X^\mathrm{an}, \mathbf C)$
%as the idempotent projector onto $H^1(X^\mathrm{an}, \mathbf C)[g]$. 
%The $H^2\otimes H^0$ and $H^0\otimes H^2$ K\"unneth components of $\mathrm{cl}(T_g)$ act trivially on $H^1(X)$. (See \cite[11.5.1]{BL}, for example.)
%Thus $\mathrm{cl}(\epsilon_o T_g)\in H^1(X^\mathrm{an}, \mathbf Q)\otimes H^1(X^\mathrm{an}, \mathbf Q)$ also acts by projecting onto $H^1(X^\mathrm{an}, \mathbf C)[g]$.
%The action on $H^1_{\mathrm{dR}}(X^\mathrm{an}, \mathbf C)$ of a correspondence $Z\subset X\times X$ whose cycle class is in $H^1\otimes H^1$ K\"unneth component can be written down explicitly using the Poincar\'e pairing.
%Thus one can compute using the projector property that  $\mathrm{cl}(\epsilon_o T_g) = \sum_{i,j} \langle b_i, b_j\rangle b_i\otimes b_j$ for \textit{any} basis $\{b_1,\ldots, b_{2k}\}$ of $H^1_\mathrm{dR}(X^\mathrm{an}, \mathbf C)[g]$. From this the claim follows immediately.

The projector $\epsilon_o$ acts on $H^2_{\dR}(X \times X)$ by annihilating the $H^0_{\dR}(X) \otimes H^2_{\dR}(X)$ and $H^2_{\dR}(X) \otimes H^0_{\dR}(X)$ components of the K\"unneth decomposition, so we have $\mathrm{cl}(\epsilon_o T_{g,n}) \in H^1_{\dR}(X) \otimes H^1_{\dR}(X)$. Note from the definition that $T_{g,n}$ acts on $H^1_{\dR}(X)[h]$ as $T_n$ if $h=g$ and 0 otherwise, so $\mathrm{cl}(\epsilon_o T_{g,n})$ is equal to the image of $T_n$ under the identification:
$$\End(H^1_{\dR}(X)[g]) \simeq H^1_{\dR}(X)[g]^{\vee}\otimes H^1_{\dR}(X)[g] \simeq H^1_{\dR}(X)[g] \otimes H^1_{\dR}(X)[g]$$
The first map is the canonical isomorphism of finite dimensional vector spaces, and the second is induced from the inverse of the identification $H^1_{\dR}(X)[g] \simeq H^1_{\dR}(X)[g]^{\vee}$ via the map $v \mapsto (w \mapsto \langle v,w\rangle)$. The remainder of the proof is a straightforward exercise in linear algebra, and is left to the reader.
\end{proof}

Combining the previous results, we obtain the following formula for $P_{g,f,n}$. Let $\gamma_f$ be the Poincar\'e dual of $\omega_f$
and let $\omega_{g,1},\ldots, \omega_{g,2k}$
be differentials of the second kind that give rise to a symplectic basis for the $g$-isotypic $\mathbf Q$-subspace 
$H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$. That is, for $1 \leq i \leq k$ we have $\langle \omega_{g,i}, \omega_{g,i+k} \rangle = 1$ and $\langle \omega_{g,i},\omega_{g,j}\rangle = 0$ for $j\not= i+k$. Assume moreover that this basis is adapted to the Hodge filtration, in the sense that the 1-forms $\omega_{g,1},\ldots,\omega_{g,k}$ are assumed to be regular at $\infty$. Since $H^0(X,\Omega^1(X/\mathbf Q))[g]\subset H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$ is a maximal isotropic subspace with respect to the Poincar\'e pairing, we can simply take any basis $\omega_{g,1},\ldots, \omega_{g,k}$ for $H^0(X,\Omega^1(X/\mathbf Q))[g] = S_2(\Gamma_0(N))[g]$ and extend it to a symplectic basis of the sort desired. Write
\begin{equation}\label{Tgn}
\mathrm{cl}(\epsilon_o T_{g,n}) = \sum_{i,j}^{2k} c^n_{ij} \omega_{g,i} \otimes \omega_{g,j}
\end{equation}
where the coefficients can be computed as in Lemma \ref{hodgeclass}. Since we chose the basis to be symplectic, the matrix $B$ is the standard symplectic matrix. Additionally, because $T_n$ preserves the holomorphic subspace of $H^1_{\dR}(X/\mathbf Q)$, then the computation of $-B^{-1}A_n$ shows that $c^n_{ij}=0$ when $k+1 \leq i,j \leq 2k$. Thus, the Hodge class in \eqref{Tgn} is of the form discussed after Remark \ref{alpha=0}.

Combining \eqref{Tgn} with \eqref{modularparam} and Theorem \ref{iterformula}, we obtain the following formula for the point $P_{g,f,n}$:
\begin{equation}\label{pgf}
P_{g,f,n} = W\left(\sum_{i,j}^{2k} c^n_{ij}\left(\int_{\gamma_f} \omega_{g,i}\cdot \omega_{g,j} - \alpha_{\omega_{g,i},\omega_{g,j}}\right)\right).
\end{equation}

Note that \eqref{pgf} omits the term $\deg(D_{T_{g,n}})\int_o^\infty \omega_f$
from the formula in Theorem \ref{iterformula}. This is justified by our choice of basepoint $o$,
for it is well-known (cf.\,e.g.\,\cite{Man}) that the difference $[\infty]-[0]$ is a torsion point of $J_0(N)(\mathbf Q)$.
Since $P_{g,f,n}$ is defined as an element of $E(\mathbf Q)\otimes \mathbf Q$, torsion can be disregarded.

We emphasize that by Lemma \ref{homotopyinv} (and the discussion immediately following it), the right-hand side of \eqref{pgf} depends only on the \textit{homology} class
$\gamma_f\in  H_1(Y^\mathrm{an}, \mathbf Z) = H_1(X^\mathrm{an},\mathbf Z)$ Poincar\'e dual to $\omega_f$.
It can therefore be evaluated by lifting $\gamma_f$ arbitrarily to an element $\tilde \gamma_f\in \pi_1(Y^\mathrm{an};o)$
and evaluating the length $\leq 2$ homotopy invariant iterated integral \eqref{pgf} on any loop in the homotopy class $\tilde\gamma_f$.

\begin{remarkwr}\label{Tg} When $n=1$, formula \eqref{pgf} greatly simplifies. In the notation of Lemma \ref{hodgeclass}, $A_1$ is the identity matrix and $B$ is the standard symplectic matrix by our choice of basis, and so if we write $\eta_{g,i}$ for $\omega_{g,i+k}$, then
$$P_{g,f} = W\left(\sum_{i=1}^k \left(\int_{\gamma_f} \omega_{g,i} \cdot \eta_{g,i} - \eta_{g,i} \cdot \omega_{g,i} - 2\alpha_{\omega_{g,i},\eta_{g,i}}\right)\right)$$
\end{remarkwr}
%  \begin{example} 
% When $g$ has \textit{rational} Fourier coefficients the $g$-isotypic component is 2-dimensional, and the above formula reads
% $$
% P_{g,f} := \int_{\gamma_f} (\omega_g\cdot \eta_g - \eta_g \cdot \omega_g) -2\int_{\gamma_f} \alpha_{\omega_g,\eta_g} =$$ $$=2(\int_{\gamma_f} \omega_g\cdot \eta_g -\int_{\gamma_f}\alpha_{\omega_g,\eta_g})-\int_{\gamma_f} (\omega_g\cdot \eta_g + \eta_g \cdot \omega_g) \in \C/\Lambda_f \sim E(\C).
% $$
% \end{example}
\subsection{}
Although $P_{g,f,n}$ is defined relative to the choice of base point $o$ as the cusp $0$ on $Y$,
it will be convenient to \textit{compute} it relative to a different choice of basepoint.
\begin{lemma}\label{basepointindependence}
The right hand side of \eqref{pgf} is independent of the choice of $o\in Y(\mathbf Q)$.
\end{lemma}
% FIXME: Should this lemma be in the preceeding section? Is the theorem from DRS valid (i.e. is the RHS of the formula for $P^{\mathrm{an}}_{Z,\omega}$ even well-defined) when $\mathrm{cl}(Z)$ is not orthogonal to $\omega$?
\begin{proof}
Changing the basepoint from $o$ to $o'$ amounts to conjugating the representative path $\gamma_f$ for the homology class Poincar\'e dual to $\omega_f$
by a path $\beta$ from $o$ to $o'$. This manifestly does not affect
the value of the integral of the meromorphic 1-form $\alpha_{\omega_{g,i}, \omega_{g,j}}$. Thus the issue is whether we have an identity
\begin{equation}\label{basepoint}
  \int_{\gamma_f} \omega_{g,i} \cdot \omega_{g,j} \stackrel{?}{=}\int_{\beta\gamma_f\beta^{-1}} \omega_{g,i}\cdot \omega_{g,j}.
\end{equation}
But by \cite[Exer. 8]{Hain}, for any 1-forms $\omega,\eta$, loop $\gamma$, and path $\beta$,  we have
\begin{equation}\label{cobp}
\int_{\beta\gamma\beta^{-1}} \omega\cdot\eta = \int_\gamma \omega\cdot \eta + \left|\begin{smallmatrix}\int_\gamma \omega&\int_\gamma \eta\\
\int_\beta \omega&\int_\beta \eta\end{smallmatrix}\right|.  
\end{equation}
In our situation, the determinants expressing the difference between the two sides of \eqref{basepoint} vanish. Indeed, $\int_{\gamma_f} \omega_{g,i} = \langle \omega_f, \omega_{g,i}\rangle = 0$,
since the decomposition into isotypic components for the action of the Hecke algebra is orthogonal with respect to the Poincar\'e pairing.
\end{proof}

% However, the point $P_{g,f}$ {\em does depend} on the choice of the cusp $\infty$ we chose in order to define the open curve $Y\subset X= X_0(N)$. (Note that in general $X_0(N)$ has several cusps.)
% We should keep this in mind, and if necessary we may actually write it as $P_{\infty, g;f}$. 

\section{Algorithm for effective computation of triple Chow-Heegner points}\label{alg}
We now turn to the question of numerically evaluating formula \eqref{pgf} for a triple Chow-Heegner point $P_{g,f,n}\in E(\mathbf Q)\otimes\mathbf Q$ for an  elliptic curve $E = E_f$. We retain all the notation from \S \S \ref{prelim}--\ref{chpt}.
% \begin{remarkwr}\label{}
% Some of the previous assumptions could be relaxed: there are rational points $P_{g_1;g_2;f}\in J_0(N)(\mathbf Q)$ associated to any 3-tuple of modular forms
% (whose respective weights satisfy a certain combinatorial condition).
% Relaxing the hypothesis that $f$ has {\em rational} fourier coefficients 
% amounts to investigating the images of these rational points in an abelian variety quotient $A_f$ of $J_0(N)$ which has dimension $>1$.
%  Relaxing the  assumption that $E$ has rank 1 is only of moderate interest: 
% by \cite{DRS1}, when $E$ has (analytic?) rank $\neq 1$, the resulting points $P_{g,f}$ are all torsion.  
%  The hypothesis on the sign of the functional equation of $g$ is made so that the sign of the functional equation of $L(\mathrm{Sym}^2(g)\otimes f,s)$ is $-1$ and thus $L'(\mathrm{Sym}^2(g)\otimes f,2)$ can be (and is expected often to be) non-zero.
% \end{remarkwr}
The following ingredients occur in the \eqref{pgf}:
\begin{itemize}
\item[1.] The Poincar\'e dual $\gamma_f\in H_1(X,\mathbf C)$
of $\omega_f\in H^1_{\dR}(X^{\mathrm{an}},\mathbf  C)$. 
\item[2.] A collection of rational differentials of the second kind $\omega_{g,1},\ldots, \omega_{g,2k}$ on $X$, regular away from $\infty$, whose images in $H^1_{\dR}(X/\mathbf Q)$ are a symplectic basis for the $g$-isotypic component $H^1_{\dR}(X/\mathbf Q)[g]$.
This basis should be adapated to the Hodge filtration on $H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$
in the sense that $\omega_{g,1},\ldots, \omega_{g, k}$ are holomorphic everywhere on $X$, including the point $\infty$.
\item[3.] The coefficients $c^n_{ij}$ arising from the action of $T_n$ on $H^1_{\dR}(X)$ with respect to the basis $\omega_{g,1},\ldots,\omega_{g,2k}$.
\item[4.] Meromorphic differentials $\alpha_{\omega_{g,i},\omega_{g,j}}$ on $X$, regular on $Y$, such that $\omega_{g,i} F_{\eta_{g,j}}-\alpha_{\omega_{g,i},\eta_{g,j}}$ has at worst a logarithmic pole at (any point lying over) $\infty$ for $1 \leq i \leq k$.
\end{itemize}
These data must be ``known'' in a sufficiently concrete form
to evaluate the iterated integrals occuring in \eqref{pgf}.
It is also desirable to know 
\begin{itemize}
\item[5.] the denominator $d_{g,n}$ of the projector
onto the $g$-isotypic component of the cohomology of $X$.
\end{itemize}
This last item will allow for the computation of a point in $E(\mathbf Q)$, as opposed to one in $E(\mathbf Q) \otimes \mathbf Q$. This section is devoted to methods of computing these five ingredients.

\subsection{Evaluating iterated integrals}\label{integration}
Let $J = \int \omega\cdot \eta -\alpha_{\omega,\eta}$ be a homotopy-invariant iterated integral of length $\leq 2$ on $Y$, expressed in terms of differentials of the second kind on $X$, regular on $Y$. We seek to compute the right-hand side of formula \eqref{pgf}, which is a $\mathbf{Q}$-linear combination of $J(\gamma)$ for various choices of $J$ and (the homotopy class of) a path $\gamma\in \pi_1(Y;o)$. As remarked earlier, \eqref{pgf} actually depends only on the homology class $\gamma_0$ of $\gamma$.
This homology class belongs to  $H_1(Y^\mathrm{an},\mathbf Z) = H_1(X^{\mathrm{an}},\mathbf Z)$, which
is the abelianization of the quotient $\pi_1(X^{\mathrm{an}},o)=\bar \Gamma_0(N)$
of $\Gamma_0(N)$ by the smallest normal subgroup containing the elliptic and parabolic elements. 

To evaluate $J(\gamma_0)$ for $\gamma_0\in H_1(Y^{\mathrm{an}},\mathbf Z)$, choose the basepoint $o$ away from the set $S$ of elliptic points on $Y_0(N)^{\mathrm{an}}\subset Y^{\mathrm{an}}$ and lift $\gamma_0$ arbitrarily to a path $\tilde \gamma \in \pi_1(Y_0(N)^{\mathrm{an}}\setminus S,o)$. For each elliptic point $x\in S$, let $e_x=|\mathrm{Stab}_{\Gamma_0(N)}(x)/\{\pm 1\}|$ denote the index of $x$ (which is either $2$ or $3$) and $\gamma_x$ be a sufficiently small counterclockwise loop around $x$. Writing $H$ for the normal subgroup of $\pi_1(Y_0(N)^{\mathrm{an}}\setminus S,o)$ generated by $\{\gamma_x^{e_x}, x \in S\}$, there is a natural isomorphism $\Gamma_0(N) \simeq \pi_1(Y_0(N)^{\mathrm{an}}-S;o)/H$. 

We may regard then $\tilde \gamma$ as an element of $\Gamma_0(N)$; this causes no ambiguity because $H$ lies in the kernel of the natural projection $H_1(Y_0(N)^{\mathrm{an}}-S,\Z)\ra H_1(Y_0(N)^{\mathrm{an}},\Z) \ra H_1(Y^{\mathrm{an}},\Z)$. The path $\tilde \gamma$ can then also be viewed as a path in $\mathfrak H$ from $\tau_0$ to $\gamma\tau_0$, where $\gamma\in \Gamma_0(N)$ is a lift
of $\gamma_0$. 

\begin{lemma}\label{l1}
Suppose $\gamma_0$ is Poincar\'e-dual to $\rho$.
As an element of $\mathbf C/\Lambda_\rho$, we have
  $$J(\gamma_0) = \int_{\tau_0}^{\gamma \tau_0} \omega F_{\eta} - \alpha_{\omega,\eta}$$
where we conflate 1-forms on $X$ with their pullbacks to $\mathfrak H^* = \mathfrak H\cup\{\infty\}$.
Moreover, $F_{\eta}$ has Laurent expansion about $\infty\in \mathfrak h^*$
given by formally integrating the Laurent expansion of $\eta$
about the cusp $\infty\in X$.
\end{lemma}
\begin{proof}
This follows from the preceding discussion, using the definition of iterated integrals and the homotopy invariance of $J$.
\end{proof}

Given any differential form $\lambda$ of the second kind on $X$, and any $\gamma\in\Gamma_0(N)$, let
$$ I(\lambda;\gamma) := \int_{\tau_0}^{\gamma\tau_0} \lambda.$$
(As above, in the righthand side of this expression $\lambda$ is conflated with its pullback to $\mathfrak H^*$.)
By the residue formula,
this expression is independent of the choice of path on the upper half-plane $\mathfrak H$  from $\tau_0$ to $\gamma\tau_0$. The $\Gamma_0(N)$-invariance of
$\lambda$ also shows that this expression is independent of the choice of  base point 
$\tau_0\in \mathfrak H$, which justifies suppressing $\tau_0$ from the notation. 

If $\lambda$ instead denotes a differential of the second kind on  $\tilde X$ then the integral above still makes sense
but depends on both the basepoint $o$ and the chosen lift of $o$ to $\tau_0\in \mathfrak H$. We will primarily be interested in evaluating such integrals in the context of \eqref{pgf}, for which the choice of basepoint is ultimately irrelevant. (This is because the Poincar\'e dual of the homology class of $\gamma$, is orthogonal
to the 1-forms in the iterated integral giving rise to the path integral we seek to evaluate; \textit{cf.} Lemma \ref{basepointindependence}.)
However, as we are about to see, for the purposes of algorithmic efficiency it is necessary to break up the path of integration into pieces that can be computed relatively quickly. The integrals over these pieces may no longer be basepoint-independent: when we express $\gamma$ as a product of computationally-amenable elements $\gamma^{(j)}\in \Gamma_0(N)$, the corresponding 
homology classes may no longer lie in (the Poincar\'e dual of) the orthogonal complement of $H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$.
Thus for a general meromorphic 1-form $\lambda$ on $\tilde X$ and a general $\gamma\in\Gamma_0(N)$, we adopt the notation
\[I_{\tau_0}(\lambda;\gamma) = \int_{\tau_0}^{\gamma\tau_0}\lambda\]
to emphase the dependence on the choice of basepoint.

By meromorphicity, for $\lambda$ as above (defined on either $X$ or $\tilde X$) the integral $I(\lambda;\gamma)$ or $I_{\tau_0}(\lambda;\gamma)$ can be computed by integrating term-wise a Laurent expansion for $\lambda$
using the fundamental theorem of calculus.
Thus, in practice, one computes the Laurent expansion for the primitive 
$F_\lambda$ about $\infty \in X$ (or a choice of $\tilde \infty\in \tilde X$ lying over $\infty$), regarded as function given by a convergent power series
in $q = e^{2\pi i \tau}$ on $\mathfrak h$, and evaluates it at $\tau_0$ and $\tau_0'=\gamma \tau_0$. The larger the imaginary parts of $\tau_0$ and $\tau'_0$ are, the faster this series converges and the fewer coefficients of the Laurent series of $\lambda$ are necessary to approximate $I(\lambda;\gamma)$ or $I_{\tau_0}(\lambda;\gamma)$ to a give degree of accuracy.
Writing $\gamma = \begin{smallmat} abcd\end{smallmat}$, it is well-known that the best compromise between $\mathrm{Im}(\tau_0)$ and $\mathrm{Im}(\tau'_0)$ is achieved when we choose $\tau_0=-\frac{d}{c} + \frac{1}{|c|} i$ (\textit{cf.}, for example, \cite[p. 35]{cremona}).
This {\em optimal basepoint for $\gamma$} will be denoted $\tau^*_\gamma$.

With this remark in mind, we take the following approach to computing $J(\gamma_0)$ as in the lemma above. First compute Laurent expansions for the differentials $\omega,\eta, \alpha_{\omega,\eta}$. Then find a ``good'' expression for the homology class $\gamma_0\in H_1(X^{\mathrm{an}},\mathbf C)$, writing it as a $\mathbf C$-linear combination of classes $\gamma_0^{(j)}\in H_1(X^{\mathrm{an}},\mathbf Z)$ that lift to elements $\gamma^{(j)}\in \Gamma_0(N)$ with small lower-left entries $cN$. Finally, calculate approximations to the integrals $I_{\tau_0}(\omega F_{\eta}; \gamma^{(j)})$ and $I(\alpha_{\omega,\eta};\gamma^{(j)})$. The appropriate linear combination of these integrals is an (approximate) representative for the coset $J(\gamma_0)\in \mathbf C/\Lambda_\rho$.)

To calculate $I(\alpha_{\omega,\eta};\gamma^{(j)})$, one is free to change the basepoint from $\tau_0$
to the optimal basepoint $\tau_j^*:=\tau_{\gamma^{(j)}}^*$ for $\gamma^{(j)}$, since $\alpha_{\omega,\eta}$ is defined on $X$
and not only on $\tilde X$. The same is \textit{not} true for $\omega F_{\eta}$.
To evaluate $I_{\tau_0}(\omega F_{\eta};\gamma^{(j)})$ we appeal to the following lemma.
\begin{lemma}\label{randomlemma}
$I_{\tau_0}(\omega F_{\eta};\gamma^{(j)}) = I_{\tau_j^*}(\omega F_{\eta}; \gamma^{(j)}) -
I(\eta;\gamma^{(j)}) \int_{\tau_0}^{\tau_j^*}\omega$.
\end{lemma}
Observe that every term on the righthand side can be computed using the fundamental theorem of calculus, evaluating power series only at the points $\tau_0$ and $\tau_j^*$. In particular, taking $\tau_0 = i/N$,
each such evaluation converges at least as fast as an evaluation at $\tau_j^*$, so this formula for the integral is ``optimally efficient''. 
\begin{proof}[Proof of Lemma \ref{randomlemma}]
Since $\lambda = \omega F_{\eta}$ is a holomorphic 1-form on $\mathfrak H$, its integral along a closed contour vanishes. Thus 
\[I_{\tau_0}(\lambda;\gamma^{(j)}) = I_{\tau_j^*}(\lambda;\gamma^{(j)}) + \int_{\tau_0}^{\tau_j^*}\lambda 
- \int_{\gamma^{(j)} \tau_0}^{\gamma^{(j)} \tau_j^*}\lambda.\]
To evaluate the second term on the righthand side, we observe
that $\omega$ comes from a 1-form on $X$, so it is $\Gamma_0(N)$-invariant; it thus pulls back to itself along the fractional linear transformation defined by
$\gamma^{(j)}$.
On the other hand,
\[I(\eta;\gamma^{(j)})=\int_{\gamma^{(j)}}\eta = F_{\eta}(\gamma^{(j)}\tau) - F_{\eta}(\tau),\qquad \text{for all }\tau\in \mathfrak H.\]
Hence $(\gamma^{(j)})^* F_{\eta} = F_{\eta} + I(\eta;\gamma^{(j)})$.
So $(\gamma^{(j)})^* \lambda = \lambda + I(\eta;\gamma^{(j)})\omega$, and we find
\[\int_{\gamma^{(j)} \tau_0}^{\gamma^{(j)} \tau_j^*}\lambda = \int_{\tau_0}^{\tau_j^*} (\gamma^{(j)})^*\lambda
= \int_{\tau_0}^{\tau_j^*}\lambda + I(\eta;\gamma^{(j)}) \int_{\tau_0}^{\tau_j^*}\omega,\]
which yields the lemma.
\end{proof}

\begin{remarkwr}\label{r1}
We warn the reader  that possibly $I_{\tau_0}(\omega F_{\eta};\gamma^{(j)}) \neq \int_{\gamma^{(j)}}\omega\cdot \eta$ (regarding $\gamma^{(j)}$ as an element of $\pi_1(Y^\mathrm{an};o)$).
Indeed, the iterated integral $\omega\cdot \eta$ need not even be homotopy invariant (!) so $\int_{\gamma^{(j)}}\omega\cdot \eta$ is ill-defined. In particular, one \textit{cannot}
relate $I_{\tau_0}(\omega F_{\eta};\gamma^{(j)})$ to $I_{\tau_j^*}(\omega F_{\eta};\gamma^{(j)})$
using the change-of-basepoint formula \eqref{cobp} for iterated integrals.
\end{remarkwr}


% This is indeed possible thanks to the following

% \begin{lemma}
% Let $\bar{\Gamma}_0(N)$ denote the quotient of $\Gamma_0(N)$ by the normal closure of the subgroup generated by elliptic and parabolic elements. Then $\bar{\Gamma}_0(N)/\bar{\Gamma}_0(N)^{ab}$ is generated by elements $\gamma = \begin{smallmat}abcd\end{smallmat}\in \Gamma_0(N)$ with $c=N$.
% \end{lemma}

% \begin{proof}
% To be given. Perhaps only works under some hypothesis on $N$ (e.g. $N$ is prime). Modify the statement accordingly if necessary.
% \end{proof}
% FIXME: I think this lemma is just false. It fails for $N=40,42,88,105$ for example. I guess it is possible it works when $N$ is prime, but that's really too restrictive for our purposes anyway. (Also I have no idea how to prove it even for prime $N$.) Regardless, we should be able to work around it, although currently the code seems to give nonsense when we modify hypgens(N) in such a way that it first tries to produce generators as in the lemma, then allows matrices with $c=2N$, then $c=3N$, etc., until a generating set is found.
% I think the issue is basepoints, but I am currently quite confused. -- Sam
% \begin{remarkwr}\label{}
%   Even when the previous lemma\footnote{Assuming we can prove it!} does not apply, there is a simple algorithm to produce a set of generators $\gamma$ as in the statement of the lemma (when such exists). Indeed, one simply iterates through hyperbolic elements of the desired form until the corresponding homology classes span the integral homology of $X_0(N)$, as can be checked via standard modular symbols algorithms. 
% \end{remarkwr}

To efficiently evaluate the integrals in \eqref{pgf} using the method just explained, it is therefore necessary to know:
\begin{itemize}{}
\item[a.] Laurent expansions about $\infty$ for a symplectic basis $\omega_{g,1},\ldots,\omega_{g,2k}$
of $H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$ and the forms $\alpha_{\omega_{g,i},\omega_{g,j}}$; and,
\item[b.]  the homology class $\gamma_f$ as a $\mathbf C$-linear combinationation
of class $\gamma_0^{(j)}$ whose lifts to $\Gamma_0(N)$ have small lower-left entries $cN$.
\end{itemize}
In the rest of this section we turn to the task of computing these data.




\subsection{Calculating a symplectic basis for $H^1_{\dR}(X/\mathbf Q)[g]$}\label{symplecticbasis}
The calculation of a basis for the de Rham cohomology can be carried out
by first writing down a modular function $u$ --- that is, a rational function on $X=X_0(N)$ --- which is regular away from $\infty$. Such a function exists by Riemann-Roch and a $q$-expansion for one such function can sometimes be computed explicitly using the Dedekind eta-function, as explained in the next subsection.

Using a modular symbol algorithm, one can compute $q$-expansions for a $\mathbf C$-basis
of $S_2(\Gamma_0(N))$ consisting of cusp forms with rational Fourier coefficients; \textit{cf.} \cite{Stn}, for example. Write $\omega_1,\ldots, \omega_{t}$ for the corresponding holomorphic 1-forms on $X$,
where for convenience we denote by $t=\dim_{\mathbf C} S_2(\Gamma_0(N))$ the genus of $X$.


Define $\eta_i=u\omega_i$, which is a differential of the second kind by the residue theorem, and let $\mathcal B = \{ \omega_1,...,\omega_{t}, \eta_1,...,\eta_{t}\}\subset H^1_{\mathrm{dR}}(X/\mathbf Q)$ be the corresponding set of cohomology classes.  A simple application of Riemann-Roch shows the following.
\begin{lemma}\label{h1basis}
  The set $\mathcal B$ is basis for $H^1_{\mathrm{dR}}(X/\mathbf Q)$ whenever $\infty$ is not a Weierstrass point on $X$ and $u$ has a pole of order $t+1$ (i.e., the smallest possible) at $\infty$. 
\end{lemma}
\begin{proof}
Since $\infty$ is not a Weierstrass point on $X$, we may assume that $\ord_\infty (\omega_i) = i-1$, and thus $\ord_\infty (\eta_i) = i-t-2$. For any differential of the second kind $\omega'$, we can find a linear combination of $\eta_1,\ldots,\eta_t$ and $dh$ for an appropriate rational function $h$ having the same principal part as $\omega'$. Thus the difference is holomorphic, and lies in the span of $\{\omega_1,\ldots,\omega_t\}$.
\end{proof}
\begin{remarkwr}\label{oggremark}
By a result of Ogg \cite{Ogg}, the cusp $\infty$ is not a Weierstrass point when the level $N$ is prime, or more generally when $N = pM$ for prime $p$ and
an integer $M\geq 1$ such that $X_0(M)$ has genus zero and $p \nmid M$. Even if $u$ has a pole of order $> g(X)+1$, the set $\mathcal B$ may still be a basis of $\mathrm H^1_{\mathrm{dR}}(X/\mathbf Q)$. This can be checked by computing the matrix for the Poincare pairing, and in every example we have computed this is the case.

When $\infty$ is a Weierstrass point, there is a rational function with a single pole at $\infty$ of order $\leq g(X)$. When $u$ is taken to be such a function, then the set $\mathcal B$ will never be a basis. Indeed, since $\infty$ is a Weierstrass point, there exists a holomorphic differential form $\omega$ with order of vanishing $\geq g(X)$ at $\infty$. Then $u\omega$ is still holomorphic, and thus lies in the span of $\{\omega_1,\ldots,\omega_t\}$. But $u\omega$ also is in the span of $\{\eta_1,\ldots,\eta_t\}$ by definition of the $\eta_i$, giving rise to a linear dependence relation. Hence, in order for $\mathcal B$ to be a basis, it is necessary for $u$ to have a pole at $\infty$ of order greater than the order of vanishing at $\infty$ of any holomorphic differential.
% For example, of the 60 squarefree values of $N$ in $[2,100]$, 26 have the property
% that the optimal $u$ has a pole of order $g(X_0(N))+1$ at infinity.
\end{remarkwr}

Given one basis $\mathcal B$ for $ H^1_{\mathrm{dR}}(X/\mathbf Q)$ --- for example, one computed as above --- it is then a matter of linear algebra to produce a better basis that is adapted to the action of the Hecke algebra. Note that the usual formula for the action of the Hecke algebra $\mathbf T_0$ on holomorphic modular forms in terms of $q$-expansions extends to \textit{weakly holomorphic modular forms} (i.e., meromorphic 1-forms on $X$
with possible poles only at the cusps), and preserves the subspace of differentials regular on $Y$.
In particular one can compute the action of $\mathbf T_0$ on any 1-form representing an element of $H^1_{\mathrm{dR}}(X/\mathbf Q)$.
Using $q$-series
for the elements of the basis $\mathcal B$, we can thus write down the
matrix $[T_p]\in\mathrm{Mat}_{2t\times 2t}(\mathbf Q)$ that describes the action of any $T_p\in \mathbf T_0$.
After identifying $H^1_{\mathrm{dR}}(X/\mathbf Q)\approx \mathbf Q^{2t}$ via the basis $\mathcal B$, by finding the eigenspaces of finitely many such matrices one can write down $\mathbf Q$-bases for each isotypic component of $H^1_{\mathrm{dR}}(X/\mathbf Q)$. As is shown in \cite{Stn}, the Hecke algebra $\mathbf T_0$ is generated as a $\mathbf Z$-module by $T_i$ for $1 \leq i \leq \frac{m}{6} - \frac{m-1}{N}$, where $m = [\Gamma(1) : \Gamma_0(N)]$. This gives an upper bound on the number of matrices needed, although in practice considerably fewer are necessary.
Using these it is simple linear algebra to produce the desired symplectic basis $\omega_{g,1},\ldots,\omega_{g,2k}$ for each isotypic component $H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$.

\begin{remarkwr}
FIXME: Add a remark about the alternative method which avoids computing Hecke actions on differentials explicitly.
(M-symbols, periods, blah blah) Note from Mike: I have been unable to implement this method without ending up with complex matrices, rather than ones with rational entries. Sage cannot compute eigenspaces of complex matrices, so I'm not sure if this method can produce explicit bases of isotypic components. The computation can be done without explicitly finding isotypic bases, but it is far less efficient.
\end{remarkwr}

\subsection{Modular units and $\eta$-products}\label{eta} 
The preceding discussion raises the question of how to compute the $q$-expansion about $\infty$ of a rational function $u$ used to write down an initial choice of basis $\mathcal B$ for $H^1_{\mathrm{dR}}(X/\mathbf Q)$.

%  When $\infty$ is not a Weierstrass point

% Having a $q$-expansion for this function $u$ -- and also knowing that $u$ has the smallest possible pole order at $\infty$ ($t+1$ in the case that $\infty$ is non-Weierstrass) -- is also relevant for the computation of the differentials $\alpha_{\omega_{g,i},\eta_{g,i}}$ explained below.

Recall that a \textit{modular unit} (for $\Gamma_0(N)$) is a modular function $u\in \mathbf \Q(X)^\times$ whose associated divisor is supported on the cusps of $X=X_0(N)$. Denote by $U$ the multiplicative group of modular units. % A certain subgroup of $U$ is amenable to explicit computations.
\begin{definition}\label{etadef}
The {\em eta group} $U_\eta$ is the subgroup of $ \mathbf Q(X)^\times$ of rational functions of the form $$u(q) =
\lambda \prod_{0<d\mid N} \eta(q^d)^{r_d},$$ where $\lambda\in \Q^\times$, $\eta(q)=q^{1/24} \prod_{n>0} (1-q^n)$ is the classical eta function
 and $\{ r_d\}_{d\mid N}$ is a collection of integers satisfying the following conditions.
\begin{itemize}
\item[i.]  $\sum_{d\mid N} r_d =0$,
\item[ii.] $\prod_{d\mid N} d^{r_d}\in \mathbf Q^\times$ is a square,
\item[iii.] $(n_d):=A_N\cdot (r_d)$ is a vector (indexed by divisors $d$ of $N$) of integers divisible by 24, where $A_N$ is the $\sigma(N)\times \sigma(N)$-matrix whose entry indexed by $(d,d')$ is $\frac{N\cdot (d,d')^2}{d d' (d',N/d')}$.
\end{itemize}
\end{definition}
Work of Newman and Ligozat shows that such functions are indeed modular units on $X$; that is, $U_\eta\subset U$. In fact more is true:

\begin{proposition}\label{QUeta}
$\mathbf{Q}\otimes_\Z U_\eta = \mathbf{Q}\otimes_\Z U$.
\end{proposition}
\begin{proof}
It easy to see that the set $\{ \frac{a}{d}:\, d\mid N, a\in (\mathbf Z/(d,N/d)\mathbf Z)^\times\}\subset \mathbf P^1(\mathbf Q)$ is a complete set of representatives of the cusps of $X$. The subspace $\mathbf Q \otimes U_\eta \subset \mathbf Q\otimes U$ coincides with $\mathbf Q\otimes U'$,
where $U'\subset U$ consists of modular units that have the same valuation at any two cusps $a/d$, $a'/d$ with the same denominator; \textit{cf.} \cite[Prop. 2]{Gonzalez}. %  Indeed, an easy computation shows that, for each $d\mid N$:
% \begin{equation}\label{orderu}
% \mbox{the order of }\, u(q) = \prod_{d\mid N} \eta(q^d)^{r_d} \, \mbox{ at cusps  }\, a/d \, \mbox{ is }\, n_d/24,
% \end{equation} 
% from which one inclusion follows. The reverse inclusion also holds because $\mathrm{det}(A_N)\in \Q^\times$.
% For example, if $N$ is square-free it follows that $\mathbf Q \otimes U_\eta=\mathbf Q\otimes U$ because in this case $(d,N/d)=1$ for all $d\mid N$ and thus the set of cusps of $X$ is $\{ \frac{1}{d}:\,d\mid N\}$.%  But in general this restriction might impose non-trivial linear conditions on $\Q\otimes U$ and $\Q\otimes U_\eta $ might be properly contained in $\Q\otimes U$.
This implies the proposition in light of the next lemma, since an element  $u\in U\subset \mathbf Q(X)$ has the same valuation at any two Galois-conjugate cusps. 
\end{proof}
\begin{lemma}\label{l2}
  Let $d|N$. Then the cusp $1/d$ is rational if and only if $(d,N/d)=1$.
More generally, the Galois orbit of the cusp $1/d$ is $\Gal(\bar \Q/\Q)\cdot \frac{1}{d} = \{ \frac{a}{d}:\, a\in (\mathbf Z/(d,N/d)\mathbf Z)^\times\}$.
\end{lemma}
\begin{proof}[Proof of the lemma]
We prove the first statement using the results of \cite[\S 1.3]{Stevens}.
Namely, it is known that the cusps of $X$ are rational over $\mathbf Q(\zeta_N)$, and the Galois action of $\Gal(\mathbf Q(\zeta_N))/\mathbf Q)\simeq (\Z/N\Z)^\times$ can be described explicitly as follows \cite[Thm. 1.3.1]{Stevens}: given $b\in  (\Z/N\Z)^\times$, let $\tau_b$ be the automorphism of $\mathbf Q(\zeta_N)$ that sends $\zeta_N\mapsto \zeta_N^b$. If $a\in \mathbf Z$ is chosen so that $a b\equiv 1\pmod N$ then $\tau_b$ sends the cusp $\frac{1}{d}$ to $\frac{1}{a d}=\frac{a}{d}$. Hence the Galois orbit of $\frac{1}{d}$ is $\{ \frac{a}{d}, a\in (\Z/N\Z)^\times\}$, and it can be shown by an elementary argument that this set of cusps is equal to $\{ \frac{a}{d}, a\in (\Z/(d,N/d)\Z)^\times \}$ in $\Gamma_0(N)\backslash \PP^1(\Q)$. 
\end{proof}

% The group $U_\eta$ is the sub-lattice in $\mathbf Q\otimes U_\eta$-vector space given by those functions whose $q$-expansion is of the form
% \begin{equation}\label{latticeUeta}
% u = \frac{1}{q^N}+\sum_{n>N} c_n q^n, \, c_n\in \Z.
% \end{equation}


% In any case, cusp $\infty$ is equivalent to $1/N$, and cusp $0$ is equivalent to $1$; since both $1$ (resp. $1/N$) is the single cusp with denominator $1$ (resp. $N$), a
By the Riemann-Roch theorem, there exist nonconstant rational functions on $X$ that are regular away from $\infty$. The proposition implies that an integer power of such a function belongs to the subgroup $U_\eta\subset U$, which yields the following.
\begin{corollary}\label{uexists}
There exists an eta product $u\in U_\eta$
that is regular away from $\infty$.\qed
\end{corollary}
It is thus possible to compute the rational function $u$ required in the compation of a basis for $H^1_{\mathrm{dR}}(X)$ as an eta product.
% to write down a basis for de Rham cohomology, a natural approach is to find a vector $(r_d)_{d|N}$ such that the corresponding eta product $u$  is of this form. By Lemma \ref{h1basis}, we do obtain a basis $\mathcal B=\{\omega_1,\ldots, \omega_{t}, u\omega_1,\ldots, u\omega_{t}\}$ in this manner if $\infty$ is non-Weierstrass and  $u$ has pole order $t+1$ at $\infty$. Generally this is not the case. (While the fact that $\infty$ is non-Weierstrass implies that there exists $w\in U$ regular away from $\infty$ and with pole order exactly $t+1$ at $\infty$, the inclusion $U_\eta\subset U$ may be strict, so it may be necessary to pass to an integer power $u = w^n$ in order to obtain a function that can be written down explicitly as an eta product.)
%  But by Remark \ref{oggremark} we can check whether $\mathcal B$ is a basis in any given case. 
%   Unfortunately, even for prime level, it not always the case that the optimal $\eta$-quotient $u$ -- that is, the $\eta$-quotient which is holomorphic away from $\infty$ with a pole of minimal order at $\infty$ -- has the smallest pole order $g(X)+1$ at $\infty$  consistent with Riemann-Roch. (While $U_\eta \otimes \mathbf Q = U\otimes \mathbf Q$ for $N$ squarefree, the inclusion $U_\eta\subset U$ thus seems to be strict most of the time, even for squarefree level.)
 A practical approach to finding the vector $(r_d)_{d|N}$ giving rise to the $u$ we seek is to apply a mixed-integer linear programming algorithm: one minimizes the pole order $-n_N$ of $u$ at $\infty$ subject to the criteria of Newman-Ligozat in Definition \ref{etadef} and the condition that the orders $n_d$ of $u$ at other cusps are non-negative. 
%\begin{remarkwr}\label{}
%By minimizing the pole order of $u$ at $\infty$, we may compute using the method of the previous subsection  a basis $\mathcal B$ for the de Rham cohomology of $X$ to a desired degree of precision using as few Fourier coefficients as possible for the cusp forms $\omega_1,\ldots,\omega_t$.
%It is desirable that this minimal pole order $-n_N$ equal $t+1$.
%This condition is relevant for the computation of
%$\alpha_{\omega_{g,i},\eta_{g,i}}$ (cf. \S \ref{compute}), as well as to apply Lemma \ref{h1basis} from the previous subsection.
%Unfortunately it does not always hold; see the discussion in \S \ref{compute}.
%\end{remarkwr}
\begin{remarkwr}\label{ueff}
To determine the complexity of the algorithm described in this paper (see \S \ref{complexity}), it is necessary to bound effectively (as a function of $N$) the order of the pole at $\infty$ of the eta quotient $u$ in Corollary \ref{uexists}. This can be done by examining the proof of Corollary \ref{uexists}.
By the Riemann-Roch theorem, there is a nonconstant rational function $w$ on $X$ that is regular on $Y$
and has a pole of order $\leq t = \text{genus}(X)$ at $\infty$.
From the formula for $\text{genus}(X)$ as a function on $N$, one can thus extract the bound $-\ord_\infty(w)= O(N\log\log N)$; \textit{cf.} for example \cite{genera}. (We adopt the convention that unless decorated with a subscript, an expression $O(-)$ denotes
a bound with an absolute implied constant.)
An examination of the proof of \cite[Prop. 2]{Gonzalez}, which was invoked to show Proposition \ref{QUeta}, 
actually gives the more precise result that $w^\mu$ belongs to $U_\eta$ for an integer $\mu = O(\det A_N)$.
Combining this with the explicit formula \cite[Prop. 1]{Gonzalez} for $\det A_N$,
one deduces  the estimate $-\ord_\infty(u) = O(N^{2\sigma_0(N)+2})$,
where $\sigma_0(N)$ denotes the number of positive divisors of $N$.
\end{remarkwr}


 \subsection{Computing the Poincar\'e dual $\gamma_f$ of $\omega_f$}\label{computepoincaredual}

Assume that $\{\gamma^{(j)}\}$ is a collection of elements of $\Gamma_0(N)$
with small lower-left entries $cN$, whose homology classes $\gamma_0^{(j)}$ generate $H_1(X^{\mathrm{an}},\mathbf Z)$. By a brute-force search it is straightforward to find such elements $\gamma^{(j)}$ in practice. (For small $N$, often one need take $c$ no greater than 2 or 3.)
% Expressing each $m_i,m_i'$ above as a $\mathbf Z$-linear combination of the $s_j$'s, we can thus efficiently compute the periods $I(\gamma_i,\omega_j)$
% and $I(\gamma_i',\omega_j)$ as linear combinations of periods $I(\sigma_i,\omega_j)$ which can be calculated using relatively few Fourier coefficients for $\omega_j$.


For any $m\in H_1(X^{\mathrm{an}},\mathbf C)$, write $\eta_m$ for the Poincar\'e dual of $c$; conversely, for any differential $\eta$ of the second kind on $X$, let $m_\eta\in H_1(X^{\mathrm{an}},\mathbf C)$ denote the Poincar\'e dual
of its cohomology class. We normalize the Poincar\'e duality isomorphism so that it is characterized by the property
\begin{equation}\label{pd}
\langle \eta_m,\eta\rangle  = \int_m \eta.
\end{equation} 

% (In \cite[Ch. III, (1.1.1)]{FK} they rather agree to say that "Poincar\'e dual" means $\int_m \eta = \int_{X_0(N)} \eta_m\wedge \eta$; we use a different convention, which differs from \cite{FK} by the factor $2\pi i$. If we stick to this, we should at least be consistent all the time. Check throughout that we didn't put a wrong factor $2\pi i$ anywhere.)

The vector space $H_1(X^{\mathrm{an}},\mathbf C)$ is also equipped an intersection product, which is related to the Poincar\'e pairing by the formula %(cf.\, \cite[Ch. III, (1.1.2)]{FK})
\begin{equation}\label{intersect}
m\cdot m_\eta = \frac{1}{2 \pi i}\langle \eta_m,\eta\rangle.
\end{equation}
The homology of $X$ also admits a natural action of the Hecke algebra, compatible with the action on cohomology via Poincar\'e duality. For any normalized eigenform $f\in S_2(\Gamma_0(N))$ and any $m\in H_1(X^{\mathrm{an}},\mathbf C)$, write $m^f\in H_1(X^{\mathrm{an}},\mathbf C)[f]$ for the projection of $m$ onto the $f$-isotypic component of homology.
Similarly, for $\eta\in H^1_{\mathrm{dR}}(X/\mathbf Q)$ write
$\eta^f$ for its projection onto the $f$-isotypic component.

We can assume that via the method described above a symplectic basis
$$\mathcal S = \{\omega_{f,1},\ldots, \omega_{f, \ell}, \eta_{f,1},\ldots, \eta_{f, \ell}\}$$ for $H^1_{\mathrm{dR}}(X/\mathbf Q)[f]$ has already been computed, where $\langle \omega_{f,i}, \eta_{f,j}\rangle = \delta_{i,j}$.

\begin{lemma}\label{fact} Fix $\gamma_1$, $\gamma_2\in \Gamma_0(N)$ and let $m_1$, $m_2\in H_1(X^{\mathrm{an}},\mathbf Z)$ denote the corresponding homology classes on $X$.
For any normalized eigenform $f\in S_2(\Gamma_0(N))$, we have
$$m_1^f\cdot m^f_2=\frac{1}{2\pi i}\sum_{i=1}^{\ell} I(\omega_{f,i};m_1)I(\eta_{f,i};m_2) - I(\omega_{f,i};m_2)I(\eta_{f,i};m_1),$$
where $\omega_f  = 2\pi i f(z)\mathrm{d}z$ is the 1-form corresponding to $f$.
\end{lemma}

\begin{proof}
Let $\eta_k=\eta_{m_k}$ and write $\eta^{f}_k=\sum c^{(k)}_i\omega_{f,i} + \sum d^{(k)}_i\eta_{f,i}$. Then we compute $m^f_1\cdot m^f_2 =  \frac{1}{2 \pi i} \langle \eta^f_1,\eta^f_2\rangle = \sum_i \frac{1}{2 \pi i} (c^{(1)}_i d^{(2)}_i-c^{(2)}_i d^{(1)}_i )= \frac{1}{2 \pi i} \sum_i (I(\omega_{f,i};\gamma_1)I(\eta_{f,i},\gamma_2)-I(\eta_{f,i};\gamma_1)I(\omega_{f,i};\gamma_2) )$. 
\end{proof}

Using \eqref{pd}, \eqref{intersect}, and Lemma \ref{fact}, we can compute the Poincar\'e dual $\gamma_f$ of $\omega_f$. Let $m_1,\ldots,m_{2\ell}$ be modular symbols giving rise to a basis of $H_1(X^{\mathrm{an}},\mathbf Z)[f]$, which can be computed using a modular symbols algorithm (\textit{cf}. \cite{Stn}). In particular, if $f$ is new, then $\ell=1$. Write $A$ for the matrix $(m_i \cdot m_j)_{1\leq i,j \leq 2\ell}$, which can be computed using Lemma \ref{fact}, and let $v$ be the column vector $(m_i \cdot m_{\omega_f})_{i=1}^{2\ell}$, which can be computed using \eqref{intersect} in conjunction with \eqref{pd}. Then the vector $A^{-1}v$ gives the coefficients expressing $m_{\omega_f}$ as a linear combination of $m_1,\ldots,m_{2\ell}$. These coefficients can then easily be converted to an expression for $\gamma_f$ as a linear combination of $\{\gamma^{(j)}_0\}$.

% Assume from now on that $f=\sum_{n=1}^\infty a_n q^n$ has {\em integral} fourier coefficients and let $E/\Q$ be the elliptic curve corresponding to $f$ by the construction of Eichler-Shimura. 
% Let us also assume that the sign in the functional equation of $L(f,s)$ is $-1$, so that $E(\Q)$ is expected to have odd rank.


%Now assume $f$ is the newform with rational Fourier coefficients that parametrizes the elliptic curve $E$, and as above denote by $\omega_f$ the corresponding holomorphic 1-form. 
%Then the $f$-isotypic components of the homology and cohomology of $X$ are two-dimensional.
%Write $\eta_f$ for the ``complementary'' form of the second kind such that $\{\omega_f,\eta_f\}$ is a symplectic basis for $H^1_{\mathrm{dR}}(X/\mathbf Q)$; in particular, $\langle \omega_f, \eta_f\rangle = 1$.
% Let $\gamma_f^+$ (resp. $\gamma_f^-$) be a generator of the plus (resp. minus) eigenspace of
%the $f$-isotypic component of $H_1(X^{\mathrm{an}},\mathbf Z)$ under the action of complex conjugation; these are unique up to sign. Since the splitting into plus and minus subspaces only takes place over $\mathbf Z[\frac{1}{2}]$, we have $\gamma_f^+\cdot \gamma_f^-\in \pm 2^{\mathbf{N}}$; after adjusting the signs if necessary, we can assume that $\gamma_f^+\cdot \gamma_f^-=2^n$ for some $n\geq 0$. This determines the pair $(\gamma_f^+, \gamma_f^-)$ up to a sign.
%
%Let $ \Omega_f^\pm = I(\omega_f,\gamma_f^\pm).$
%Note that $\Omega_f^+$ and $\Omega_f^-$ generate a lattice $\mathbf Z \Omega^+  + \mathbf Z \Omega^-\subset \mathbf C$, which is independent of the choice of the sign above
%and is commensurable with the N\'eron lattice $\Lambda_f$ of $E$. 
%Finally, let 
%$$ \gamma_f  := \frac{1}{2^{n+1}\pi i} (\Omega_f^+\gamma_f^- - \Omega_f^- \gamma_f^+)\quad \in H_1(X^{\mathrm{an}},\mathbf C)[f].$$
%
%\begin{proposition}\label{dual}
%The homology class $\gamma_f$ is Poincar\'e dual to the cohomology class of $\omega_f$.
%\end{proposition}
%
%\begin{proof}
%We only need to check \eqref{pd} for $\eta=\eta_f$, and $I(\eta_f; \gamma_f) =  1 = \langle \omega_f,\eta_f\rangle$
%by \ref{fact}.
%\end{proof}
%The preceding discussion reduces the computation of $\gamma_f$ 
%to finding the homology classes  $\gamma_f^\pm$,
%from which the periods $\Omega_f^\pm$ are readily obtained by integrating.
%The classes $\gamma_f^\pm$ can be calculated using modular symbols, for which we refer to \cite{Stn},
%and then expressed in terms of the ``good'' basis $\{\gamma^{(j)}_0\}$.


% The calculation of a basis of the first homology group $H_1(X^{\mathrm{an}},\mathbf Z)$ and the space $H^1(X,\Omega^1)$ of regular differential forms on $X$,  and the action
% of Hecke operators on these two spaces can be carried out using the standard modular
% symbol algorithms. (FIXME: add a reference to Cremona or Stein)
%  Hence, we can assume we have at our disposal 
% \begin{enumerate}
% \item[(i)] a basis $\omega_1,\ldots,\omega_{g(X)}$ of regular differentials of $X$ and 

% \item[(ii)] a collection $\{ \gamma_1,\gamma_1',...,\gamma_{g(X)},\gamma_{g(X)}' \}\subset \Gamma_0(N)$ of hyperbolic elements such that, if we choose a base point $\tau_0\in \mathfrak H$ and write $m_i$ (resp. $m'_i$) for the homology class of the projection to $X$ of any continuous path in $\mathfrak H$ from $\tau$ to $\gamma_i \tau_0$ (resp. $\gamma'_i\tau_0$), then 
% \begin{equation}
% H_1(X,\Z) = \langle m_1,m'_1,...,m_{g(X)},m'_{g(X)}\rangle_\Z.
% \end{equation}
% \end{enumerate}

% In particular we are able to compute the periods 
% \begin{equation}
% I(\gamma_i,\omega_j)=I(m_i,\omega_j), \quad I(\gamma'_i,\omega_j)=I(m'_i,\omega_j),
% \end{equation}
% and the above two basis can be found such that $I(\gamma_i,\omega_j)=I(\gamma'_i,\omega_j) = 0$ for $i\ne j$




% \subsection{Computation of iterated integrals}
%  We now turn to analyze the algorithm to compute the element 
% $$
% z_{g,f} := \int_{\gamma_f} (\omega_g\cdot \eta_g -\eta_g\cdot \omega_g).
% $$ 

% Notice that the difference between the points $P_{g,f}$ and $2 z_{g,f}$ is just the line integral $\int_{\gamma_f} \alpha = \langle \omega_f,\alpha\rangle$, which is {\em rational number} because of the definition \eqref{poincare} we gave of the Poincar\'e pairing. In the next subsection we will discuss two methods for computing this rational adjustment factor.



% In other words, 
% $$
% [z_{g,f}]=[P_{g,f}] \in \C/\langle \Lambda_f, \,\Q\rangle. 
% $$

% Hence in practice we can often exploit the following strategy: 

% \begin{itemize}


% \item The element $\gamma_f\in \C[\Gamma_0(N)]$ and the differentials of the second kind $\omega_g$, $\eta_g$ have been already computed in points (I) and (II), respectively. In (I) it was also explained how to compute $\gamma_f$ and how to choose an optimal base point for integrating. Be careful though when computing in practice these iterated integrals and choosing the base points... The way we do it will have to be explained with care in the final version of this article.

% \end{itemize}

%  Write $\tilde{\eta}_g$ for the primitive of $\eta_g$ on $\mathfrak H$.
% FIXME: Explain what we mean by the integral
% $\int_{\gamma_f} \omega_g \tilde{\eta}_g -\eta_g \tilde{\omega}_g$
% and how to compute it relatively efficiently using the Fourier expansions of $\omega_g$ and $\eta_g$
% and
% the coefficients of $\gamma_f\in (\bigoplus \mathbf Z[\gamma_i]\oplus \mathbf Z[\gamma_i])\otimes \mathbf C$, where
% the $\gamma_i$ and $\gamma_i'$ comprise our ``nice'' collection
% of hyperbolic elements of $\Gamma_0(N)$ whose images generate the integral homology of $X$. 



\subsection{Computing the adjustments $\int_{\gamma_f}\alpha$}\label{computealpha}
Write the homology class $\gamma_f$ Poincar\'e dual to $\omega_f$ as
\[\gamma_f = \sum \beta_j \gamma_0^{(j)}\]
for $\beta_j\in \mathbf C$
and homology classes $\gamma_0^{(j)}$ whose lifts $\gamma^{(j)}$ to $\Gamma_0(N)$ have small lower-left entries $cN$.
Let $\omega$ and $\eta$ be differentials of the second kind, at least one of which is regular at $\infty$. Using the methods described so far, we are already able to compute
\[z_{\omega,\eta} := \sum_j \beta_j \int_{\tau_0}^{\gamma^{(j)}\tau_0} \omega F_{\eta}.\]
We stress that the value of $z_{\omega,\eta}$ depends on $\tau_0$ and the choices we made in representing $\gamma_f$. It is simply one part of the iterated integral $J_{\omega,\eta}(\gamma_f) = \int_{\gamma_f} \omega \cdot \eta - \alpha_{\omega,\eta}$, which is independent of these choices. In this section, we describe a method for computing $J_{\omega,\eta}(\gamma_f) - z_{\omega,\eta}$. This amounts to computing the $q$-expansion of $\alpha_{\omega,\eta}$, for then we have
\[J_{\omega,\eta}(\gamma_f) - z_{\omega,\eta} = -\sum_j \beta_j \int_{\tau_0}^{\gamma^{(j)}\tau_0} \alpha_{\omega,\eta}.\]

Recall that the defining property of $\alpha_{\omega,\eta}$ is that its principal part at $\infty$ agrees with that of  $\omega F_{\eta}$ on $\tilde X$, modulo $\mathrm{d}q/q$; i.e., their difference has at worst logarithmic poles. However, note that since $\int_{\gamma_f} \lambda = 0$ for exact 1-forms $\lambda$, we may replace $\alpha_{\omega,\eta}$ by any cohomologous 1-form. The cohomology class of $\alpha_{\omega,\eta}$ is determined by the data $\langle \lambda_i, \alpha_{\omega,\eta} \rangle$, where $\lambda_1,\ldots,\lambda_{2t}$ (for $t$ the genus of $X$) form a basis of $H^1_{\dR}(X/\mathbf Q)$, so it suffices to compute these values of the Poincar\'e pairing.

We can choose $\lambda_1,\ldots,\lambda_t$ to be holomorphic. In this case, we can compute
$$\langle \lambda_i, \alpha_{\omega,\eta} \rangle = \res_\infty(F_{\lambda_i} \cdot \alpha_{\omega,\eta}) = \res_{\tilde \infty}(F_{\lambda_i}\cdot F_\eta\cdot\omega),$$
where the second equality holds because $\res_{\infty}(F_{\lambda_i}\cdot \alpha_{\omega,\eta})$
depends only on $$\mathrm{pp}_\infty(\alpha_{\omega,\eta})\mod \frac{\operatorname{d}q}{q} = \mathrm{pp}_{\tilde\infty}(\omega F_\eta).$$
% This is not true, however, when $\lambda_i$ is not holomorphic at $\infty$. But we can choose \textit{any} form $\alpha$ having this principal part, and t
%The following  shows that the data $\langle \lambda_i, \alpha\rangle$ for $i=1,\ldots,t$ is enough to guarantee that this condition holds.
\begin{lemma}\label{l3} Let $\lambda_1,\ldots,\lambda_t \in H^0(X,\Omega^1_{X/\mathbf Q})$ be a basis of regular 1-forms on $X$. Then $\alpha \in H^1_{\dR}(X/\mathbf Q)$ lies in the subspace $H^0(X,\Omega^1_{X/\mathbf Q})$ if and only if $\langle \lambda_i, \alpha\rangle = 0$ for all $1\leq i \leq t$.
\end{lemma}
\begin{proof} The subspace $H^0(X,\Omega^1_{X/\mathbf Q}) \subseteq H^1_{\dR}(X)$ is isotropic for the Poincar\'e pairing because the pairing can be computed using residues. For dimension reasons, it is maximal isotropic, and the lemma follows.
\end{proof}
By the lemma, if $\langle \lambda_i,\alpha\rangle = \langle \lambda_i, \alpha'\rangle$ for $i = 1,\ldots,t$, then $\alpha - \alpha'$ is cohomologous to a regular 1-form. Since $\alpha_{\omega,\eta}$ is only well-defined modulo $H^0(X,\Omega^1_{X/\mathbf Q})$, it follows that we can choose $\langle \lambda_i, \alpha_{\omega,\eta}\rangle$ for $i=t+1,\ldots,2t$ arbitrarily. For convenience, we choose $\langle \lambda_i,\alpha_{\omega,\eta}\rangle=0$ for $i=t+1,\ldots,2t$. Define the matrix $B = (\langle \lambda_i,\lambda_j\rangle)_{i,j=1}^{2t}$ and the vector 
$$w=(\langle \lambda_i, \alpha_{\omega,\eta}\rangle)_{i = 1}^{2t} = (\res_{\tilde\infty}(F_{\lambda_1}F_\eta\omega), \cdots, \res_{\tilde\infty}(F_{\lambda_t}F_\eta\omega),\overbrace{0,\ldots, 0}^t).$$ It then follows by elementary linear algebra that the vector $B^{-1}w$ yields the coefficients of an expression for $\alpha_{\omega,\eta}$ as a linear combination of $\lambda_1,\ldots,\lambda_{2t}$.


% So provided
% we can compute a 1-form $\lambda$ of the second kind on $X$, regular on $Y$, which 
% has the same \textit{leading term} as a given differential such as $\xi$,
% it is possible to compute $\alpha$. Indeed, simply build a suitable linear combination of these 1-forms $\lambda$ which matches the principal part of $\xi$ except for the $\mathrm{d}q/q$ term.

\subsection{Computing the coefficients $c_{ij}$}\label{Tnmatrix}
Using the methods described so far, we may compute all the integrals $\int_{\gamma_f} (\omega \cdot \eta - \alpha_{\omega,\eta})$ occuring in \eqref{pgf}. The last input needed to evaluate \eqref{pgf} is the set of coefficients $c^n_{ij}$ appearing in that formula. Using Lemma \ref{hodgeclass}, these coefficients can be computed using the matrix $A_n$ which expresses the right action of $T_n$ on $H^1_{\mathrm{dR}}(X/\mathbf Q)[g]$ with respect to the basis $\omega_{g,1},\ldots,\omega_{g,2k}$, and the matrix $B = (\langle \omega_{g,i},\omega_{g,j}\rangle)_{1\leq i,j\leq 2k}$, which by our choice of basis is the standard symplectic matrix. In section \ref{symplecticbasis}, we gave a method for computing $A_n$ using the action of $T_n$ on $q$-expansions. However, this only works if $\gcd(n,N)=1$\footnote{FIXME: I'm still not sure why this doesn't work for primes dividing the level}, so we must resort to other methods. We exploit the fact that the action of $T_n$ on $H_1(X^\math!
 rm{an},\mathbf C)[g]$ is readily computable using modular symbols; see \cite{Stn} for details. Recall that we have a Hecke-equivariant duality
$$H^1_{\dR}(X^{\mathrm{an}}, \mathbf C)[g] \times H_1(X^{\mathrm{an}},\mathbf C)[g] \to \mathbf C$$
given by the integration pairing $\langle \omega, \lambda \rangle = \int_{\gamma} \lambda$;
here the Hecke-equivariance means that $\langle T_n\omega, \alpha \rangle = \langle \omega, T_n \alpha \rangle$. 
Using modular symbols and the techniques of \cite{Stn} one can compute the matrix $B_n$ of $T_n$
acting on $H_1(X^\mathrm{an},\mathbf C)[g]$ on the left, with respect to a basis $m_1,\ldots, m_{2k}$.
 Write $Q = (\langle \omega_i, m_j\rangle )_{i,j=1}^{2k}$, which can be computed efficiently via the method explained in \S \ref{integration} (using an appropriate basis $\{m_j\}$ derived from the generators $\gamma^{(j)}_0$ for $H_1(X^\mathrm{an},\mathbf Z)$ discussed above). Then it is straightforward linear algebra to show that $A_n = QB_nQ^{-1}$. %T his calculation restricts to the $g$-isotypic component, so we can take $\omega_{g,1},\ldots,\omega_{g,2k}$ as our basis for $H^1_{\dR}(X)[g]$ and a basis of modular symbols of the $g$-isotypic component found by {\tt Sage} as our basis of $H_1(X)[g]$. Then $Q = (\int_{m_j} \omega_i)_{1 \leq i,j \leq 2k}$ is the matrix of periods of $\omega_{g,1},\ldots,\omega_{g,2k}$ against the basis $m_1,\ldots,m_{2k}$, and the modular symbols algorithm can compute the action of $T_n$ on $m_1,\ldots,m_{2k}$, yielding the matrix $B_n$.

\subsection{Computing the denominator $d_{g,n}$}\label{denom}
The final ingredient to be computed is the denominator $d_{g,n}$, or the smallest positive integer such that $d_{g,n}T_{g,n} \in \mathbf T_{\mathbf Z}$. This can be accomplished by computing a $\mathbf Z$-basis for the ($\mathbf Z$-finite free) Hecke algebra $\mathbf T_{\mathbf Z}$ as a subring of $M_{2t}(\mathbf Q)$, where $t$ is the genus of $X_0(N)$, by identifying $\mathbf T$ with an algebra of endomorphisms of the $(2t)$-dimensional $\mathbf Q$-vector space of cuspidal modular symbols of weight 2 and level $N$.%  First, we can compute a basis of modular symbols using the algorithm in {\tt Sage}. Then, we can compute the matrix of $T_i$ acting on this basis. 
As $\mathbf T_{\mathbf Z}$ is generated as an abelian group by $T_i$ for $1 \leq i \leq \frac{m}{6} - \frac{m-1}{N}$, where $m = [\Gamma(1) : \Gamma_0(N)]$, this is a finite computation. For more details on modular symbols and generating the Hecke algebra, see \cite{Stn}. Once $\mathbf T_{\mathbf Z}$ has been computed it is a simple matter to find the matrix representation of $T_{g,n}$ and  compute the smallest $d_{g,n}$ such that $d_{g,n}T_{g,n} \in \mathbf T_{\mathbf Z}$.

\subsection{Remarks on complexity}\label{complexity}
The complexity of the computations we have described
is primarily determined by
 the {\em number} $n_D$ of Fourier coefficients required
to compute $J_{\omega,\alpha}(\gamma_f)$ to a given number $D$ of digits of accuracy.
In this subsection we sketch a method for obtaining a bound on $n_D$ in terms of $N$.

\subsubsection{}
Write the Fourier expansion of $u$ as 
$$u(\tau) = \sum_{n\geq -n_0} c_n q^n, \qquad q = e^{2\pi i \tau}, \tau \in \mathfrak H.$$ 
Let the principal part of $u$ at $\infty$ be
\[\mathrm{pp}_\infty (u) = \sum_{-n_0 \leq -m \leq 0} \frac{d_m}{m} q^{-m},\qquad d_m = mc_{-m}.\]
In \cite{ono}, Bringmann and Ono prove an exact formula for the Fourier coefficients of harmonic Maass forms, of which weakly holomorphic modular functions such as $u$ are examples. To avoid introducing unnecessary notation, we state only the very special case of their result applicable to our situation. We remark that long ago Rademacher used the circle method to prove a similar exact formula for the coefficients of the $j$-function \cite{rad}, and a modification his argument would probably yield a simpler and more direct proof of the special case we require.
Using \cite[Thm. 1.1]{ono}, one can express the coefficients $c_n, n>0$ in terms of the coefficents $d_m$,
 the order-1 $I$-Bessel function $I_1(z)$,  and the Kloosterman sum
\[K(-m,n,c):=\sum_{\substack{0<v< c\\ (v,c)=1}} \exp\left(\frac{2\pi i}{c}(nv + m\bar v)\right),\]
where $\bar v$ denotes the multiplicative inverse of $v$ modulo $c$.
Namely, \textit{loc. cit.} yields the formula
\begin{equation}\label{coeff}
  c_n = 2\pi  \sum_{-n_0\leq -m \leq 0} d_m \sum_{\substack{c>0\\ c\equiv 0\pmod N}} (\tfrac{m}{n})^{1/2} \frac{K_0(-m,n,c)}{c}I_1\left(\frac{4\pi\sqrt{|mn|}}{c}\right),\qquad n>0.
\end{equation}
By Remark \ref{ueff}, we have 
\begin{equation}\label{n0est}
  n_0 = -\ord_\infty(u) \leq A_1 N^{2 \sigma_0(N) + 2},
\end{equation}
 where the constant $A_1$ is absolute and $\sigma_0$ denotes the divisor function.
We can trivially bound the numbers $d_m$ as follows.
Let $\xi_r(x) = re^{2\pi i x}$ for $0<r<1$
and set $y=-\frac{1}{2\pi}\log r>0$.
The Cauchy integral formula applied to the meromorphic function $U(q) = \sum c_n q^n$
of $q$ in the unit disk gives
\[\frac{d_m}{m} = \frac{1}{2\pi i} \int_{\xi_r} \frac{U(q)}{q^{m+1}}\operatorname{d}q = e^{2\pi m y} \int_0^1 
u(x+iy)e^{-2\pi inx}\operatorname{d}x.\]
Taking $y=1$, say, we thus have
\[|d_m| \leq m e^{2\pi m}\int_0^1 |u(x+i)|\operatorname{d}x
= m e^{2\pi i m} \int_0^1 \prod_{d|N} |\eta(dx+id)|^{r_d}\operatorname{d}x,\]
where $\eta$ is the Dedekind eta function and $(r_d)_{d|N}$ is the vector giving rise to $u$.
Recall that $\eta(z)$ is a nonvanishing holomorphic function on $\mathfrak H$,
and satisfies $|\eta(z+1)|=|\eta(z)|$. Thus there is an absolute upper bound $B$
for $\max(|\eta(z)|,|\eta(z)|^{-1})$
on the strip  $\{1-\epsilon \leq \mathrm{Im}(z) \leq N+\epsilon\}\subset\mathfrak H$.
It follows that 
\[|d_m| \leq me^{2\pi m} B^{\sum |r_d|}.\]
To control this quantity we must bound both $B$ and $\sum |r_d|$ in terms of $N$.

As regards $B$, note that since $\eta(z)$ is holomorphic on $\mathfrak H^*$,
the upper bound for $|\eta(z)|$ on the strip of interest poses no problem;
it is a constant independent of $N$.
To find a lower bound for $|\eta(z)|$ on our strip, we can make use of the Euler formula
\[ \eta(z) = e^{\pi i z/12}\left(1+\sum_{m\geq 1} q^{\frac{3m^2-m}{2}}+q^{\frac{3m^2+m}{2}}\right), \qquad q = e^{2\pi i z}.\]
From this it is straightforward to deduce a bound
$|\eta(z)|^{-1} = O(e^{\pi N/12})$, for $z$ in the strip in question.

To handle $\sum |r_d|$, we recall some results from numerical analysis.
Let $A$ be an invertible $\sigma\times\sigma$ matrix of real numbers.
We denote by $||A||_2$ the quantity $\displaystyle\sup_{x\in \mathbf R^\sigma, |x|=1} |A x|$
and by $||A||_{\max}$ the maximum of the absolute values of the matrix entries $a_{ij}$.
A result in numerical linear algebra \cite[Thm. 2.1]{M} asserts
that when $A$ has \textit{integer} entries, one can control its so-called ``condition number''
and obtain the estimate
%\[||A||_\max \leq ||A||_2 \leq \sigma ||A||_\max\]
\[||A^{-1}||_2\leq \sigma^{2+\sigma/2}||A||_{\max}^{\sigma-1}.\]
We apply this result to the matrix $A_N$ from Definition \ref{etadef}
with $\sigma = \sigma_0(N)$.
By Newman and Ligozat's result, the vector $\mathbf r = (r_d)_{d|N}$
and the vector $\mathbf n = (24\ord_{a/d}(u))_{d|N}$
(where $a/d$ is any cusp of $X_0(N)$ of denominator $d$)
satisfy $ \mathbf r = A_N^{-1}\mathbf n$.
Moreover since $u$ has a pole of order $n_0$ at infinity and no other poles,
the fact that $\div(u)$ has degree 0 implies $|\mathbf n| = O(n_0 \sqrt{\sigma_0(N)})$.
Finally, the formula for the entry of $A_N$ indexed by $(d,d')$
entails $||A_N||_{\max} \leq N^3$.
We thus have, using  \eqref{n0est},
\[\sqrt{\sum_{d|N} |r_d|} \leq \sqrt{\sum_{d|N} |r_d|^2} = |\mathbf r| \leq ||A_N^{-1}||_2 |\mathbf n|
\leq \sigma_0(N)^{\frac{\sigma_0(N)+5}{2}}n_0 N^{3(\sigma_0(N)-1)}= O(N^{\frac{11\sigma_0(N)+1}{2}}).\]
Consequently, for an absolute constant $C$
we have
\begin{eqnarray*}
  |d_m|&\ll& me^{2\pi m} e^{\pi N \sum |r_d|/12} \leq m e^{2\pi m} e^{C N^{11\sigma_0(N) + 2}}
\\ &\leq& n_0 e^{2\pi n_0} e^{C N^{11\sigma_0(N) + 2}} \\
& =& O(n_0\exp(2\pi N^{2\sigma_0(N)+2}+C N^{11\sigma_0(N)+2}))
\end{eqnarray*}
From this we deduce
\begin{equation}\label{dest}
|d_m| =O(n_0 \exp(A_0 N^{11\sigma_0(N)+2})),   
\end{equation}
for an absolute constant $A_0$.

From \eqref{coeff} and \eqref{dest}, standard estimates for Kloosterman sums, and asymptotics for the $I$-Bessel function, one obtains by the method of \cite[\S \S 5.1-2]{BrPh} the estimate
\[c_n = O(N^{5/4}n_0^{7/4} n^{-3/4} \exp(A_0 N^{11\sigma_0(N)+2} + N^{-1}4\pi \sqrt{nn_0})).\]
In light of \eqref{n0est} this yields
\begin{equation}\label{cnest}
  c_n = O(n^{-3/4} \exp(A_2 N^{11\sigma_0(N)+2}+\tfrac{4\pi\sqrt{A_1}}{N} N^{\sigma_0(N)+1} \sqrt n)),
\end{equation}
for absolute constants $A_1,A_2$.

\subsubsection{} 
The coefficients $c_n$ determine the Fourier coefficients of the 1-forms occuring in the formula \eqref{pgf}
for $P_{g,f,n}$. Unfortunately the relationship is indirect, as the construction of the 1-forms $\omega_{g,i}$ and $\alpha_{\omega_{g,i},\omega_{g,j}}$ involves multiplying $u$ against a basis of cusp forms for $\Gamma_0(N)$
and then performing a lot of linear algebra. By Deligne's proof of the Ramanujan-Petersson conjecture,
the cusp forms have $n$th coefficient of size $O_\delta(n^{\frac{1}{2}+\delta})$.
It follows that $n$th Fourier coefficient of an element of the basis $\mathcal B$
for $H^1_{\mathrm{dR}}(X/\mathbf Q)$ computed in \S \ref{symplecticbasis} has size at most
\[O(P(n) \exp(A_2 N^{11\sigma_0(N)+2}+\tfrac{4\pi\sqrt{A_1}}{N} N^{\sigma_0(N)+1} \sqrt n)),\]
for absolute constants $A_1,A_2$ and a universal polynomial $P(n)$.
To compute the 1-forms $\omega_{g,i}$ and $\alpha_{\omega_{g,i},\omega_{g,j}}$, linear algebra operations
are performed on this basis, which spans a vector space of dimension $\text{genus}(X) = O(N\log\log N)$.
It thus seems likely that a careful analysis of the linear algebra operations performed
would yield a bound 
\begin{equation}\label{final}
  O(Q(n) \exp(A_3 N^{11\sigma_0(N)+2}+\tfrac{4\pi\sqrt{A_1}}{N} N^{\sigma_0(N)+1} \sqrt n)),
\end{equation}
for the $n$th Fourier coefficient of \textit{any} 1-form integrated in the course of computing \eqref{pgf}.
Here $A_1,A_3$ are absolute constants and $Q(X)$ is a universal polynomial independent of $N$.

Suppose $\lambda$ is such a 1-form (on $X$ or $\tilde X$),
and consider the problem of integrating the pullback of $\lambda$ to $\mathfrak H^*$
along a path from $\tau_1$ to $\tau_2$. 
By the method explained in \S \ref{integration},
we can assume that $\text{im} \tau_1,\text{im}\tau_2 \geq (c_N^*\cdot N)^{-1}$,
where $c^*_N\cdot N$ is the largest of the lower-left entries
of the elements $\gamma^{(j)}\in \Gamma_0(N)$ introduced at the beginning of \S \ref{computepoincaredual}.
Recall that these consisted of a collection of elements that span $H_1(X^\mathrm{an},\mathbf Z)$
and have lower-left entries as small as possible. We do not know how to bound $c^*_N$ in terms of $N$,
although in practice it seems to be very small.

If the Laurent expansion for $\lambda$ about $\infty$ (or a lift of $\infty$ to $\tilde X$)
is $\lambda = \sum a_\lambda(n) \frac{\operatorname{d}q}{q}$,
then setting $\tau_j = x_j + iy_j$ for $j=1,2$ (where $y_j \geq (c^*_N N)^{-1}$), we have
\[\int_{\tau_1}^{\tau_2} \lambda = \sum_{n\gg -\infty} \frac{a_\lambda(n)}{n} (e^{2\pi i n x_2}e^{-2\pi n y_2}
- e^{2\pi i n x_1}e^{-2\pi n y_1}).\]
Our problem is to determine $n_D$
such that the tails of these sums are bounded by the requisite precision, say $10^{-D}$.
It clearly suffices to take for $n_D$ any $m$ such that
\[S(m):=\sum_{n\geq m} n^{-1} |a_\lambda(n)| e^{-2\pi n y} \leq 10^{-D}.\]
Granting \eqref{final}, we have
\[S(m) \ll \sum_{n\geq m} n^{-1}Q(n) \exp(A_3 N^{11\sigma_0(N)+2}+\tfrac{4\pi\sqrt{A_1}}{N} N^{\sigma_0(N)+1} \sqrt n - \tfrac{2\pi n}{Nc_N^*}).\]
For a suitable constant $A_4$, we can assume $n^{-1}Q(n)\exp(\frac{4\pi\sqrt{A_1}}{N} N^{\sigma_0(N)+1} \sqrt n)\leq \exp( \frac{A_4}{N} N^{\sigma_0(N)+1} \sqrt n)$. Thus
\begin{eqnarray*} S(m) &\ll& \exp(A_3 N^{11\sigma_0(N)+2}) \sum_{n\geq m} \exp(\frac{1}{Nc_N^*}(A_4 c_N^* N^{\sigma_0(N)+1} \sqrt n - 2\pi n))\\
&\leq&\exp(A_3 N^{11\sigma_0(N)+2})\sum_{n\geq m} e^{- n/ Nc^*_N} = \exp(A_3 N^{11\sigma_0(N)+2}) \frac{e^{- m/ N c^*_N}}{1-e^{-1/Nc^*_N}},\end{eqnarray*}
provided $m$ is large enough that $A_4 c_N^* N^{\sigma_0(N)+1} \sqrt n - 2\pi n \leq - n$
for $n\geq m$.
The latter can be ensured by requiring $m\geq A_5 c_N^{*2} N^{2\sigma_0(N)+2}$ for an absolute constant $A_5$.
It follows with a bit of algebra that provided \eqref{final} holds, we have the following estimate for $n_D$ in terms of $D$ and $N$:
\begin{equation}\label{nDest}
  n_D = O(\max\{Nc^*_N(D + N^{11\sigma_0(N)+2}),  c^{*2}_N N^{2\sigma_0(N)+2}\}),
\end{equation}
where the implied constant is absolute, as always.
%As remarked earlier, for practical purposes it seems that  $c_{\max,N}$  can be treated as a constant.

\section{Numerical examples}\label{eg}
\subsection{Example: {\bf 37a1}}\label{37}

 Take $N=37$ in the setup of our algorithm. In this setting, the space of regular differentials on $X=X_0(37)$ is spanned by $\omega_f$ and $\omega_g$,
 which are associated to elliptic curves over $\mathbf Q$ (labeled {\bf 37a1} and {\bf 37b1} in Cremona's database) of ranks $1$ and $0$, respectively.

 By computing the periods attached to $\omega_f$ and $\omega_g$, it can be checked that the
  classes of the matrices
%  $$
%  \gamma_1 = \left(\begin{array}{cc} 12 & -1 \\ 37 & -3 \end{array}\right), \quad
%  \gamma_2 = \left(\begin{array}{cc} -3 & -1 \\ 37 & 12 \end{array}\right), \quad
%  \gamma_3 = \left(\begin{array}{cc} 15 & 2 \\ 37 & 5 \end{array}\right), \quad
%  \gamma_4 = \left(\begin{array}{cc} 5 & -1 \\ -74 & 15 \end{array}\right)$$


%  The same can be said about the matrices
 $$
 \gamma_1=\begin{pmatrix}2&-1\\37 &-18\end{pmatrix}, \,\gamma_2= \begin{pmatrix}3&-1\\37 &-12\end{pmatrix}, \,\gamma_3= \begin{pmatrix}5&2\\37&15\end{pmatrix} ,\, \gamma_4=
 \begin{pmatrix}14 & 3\\ 37 &  8\end{pmatrix} 
 $$
  generate the rational homology of $X$.
These are a ``nice'' basis for the homology in the sense of the first paragraph of \S \ref{computepoincaredual}; that is, the lower left entries are exactly 37 (rather than $37c$ for $|c|>1$), so the integral $\int_\tau^{\gamma_i\tau}\lambda$ can be evaluated efficiently for any meromorphic differential 1-form $\lambda$ on $X_0(37)$ or its universal cover regular away form $\infty$, by the method of \S \ref{integration}.

 To obtain differentials of the second kind representing classes in the deRham cohomology, we consider the elements of the form 
 $$ \eta_1 = u\cdot \omega_f, \qquad \eta_2 = u\cdot \omega_g, \qquad u = \eta(q)^2\eta(q^{37})^{-2} = q^{-3} \prod_{n=1}^\infty (1-q^n)^2 (1-q^{37n})^{-2},$$
where $\eta(q)$ is the Dedekind eta function. The modular function $u$ is an example of an eta product with its only pole at $\infty$,  as considered in \S \ref{eta}.
 It is not hard to check directly (by calculating the Poincar\'e pairing on all pairs of elements) 
 that the classes of $\omega_f, \omega_g, \eta_1$ and $\eta_2$ generate the deRham cohomology
 of $X$; alternatively one could apply Lemma \ref{h1basis}.

After computing the matrix $M$ of the Hecke operator $T_2$
acting on $H^1_{\dR}(X_0(37))$ with respect to the basis $\omega_f,\omega_g,\eta_1,\eta_2$, and then determining the eigenspaces of $M$, one finds that
 \begin{eqnarray*}  
 \eta_f &=&  \frac{1}{4}(-37\omega_g+4\eta_1 -8  \eta_2), \\
 \eta_g &=&  \frac{1}{4}(37\omega_f-6\eta_1 + 10 \eta_2)
 \end{eqnarray*}
 are in  the $f$ and $g$ isotypic components of the deRham cohomology respectively. In addition these linear combinations of 1-forms have been chosen so that
$\{\omega_f,\eta_f\}$ and $\{\omega_g,\eta_g\}$ form symplectic bases for the components with respect to the Poincar\'e pairing.

When one computes the Poincar\'e dual $\gamma_f$ of $\omega_f$ as in \S \ref{computepoincaredual},
one finds (with our normalization) that it is 
\[\gamma_f = \frac{1}{2\pi i}\left(A\left([\gamma_2]-[\gamma_3]+[\gamma_4]\right)-B\left(-[\gamma_1]+2[\gamma_2]\right)\right).\]
Here 
\[A \approx (2.4513893\ldots)i,\qquad B \approx 2.9934586\ldots\]
are certain linear combinations of the periods of $f$ against a basis of $H_1(X)[f]$; see \S \ref{computepoincaredual} for a more exact description.

The method of \S \ref{computealpha} can be used to compute $\alpha_{\omega_g,\eta_g}$. However, in this case, it is easy to find $\alpha_{\omega_g,\eta_g}$ by inspection. Working with principal parts, one finds that $\mathrm{pp}_\infty(\omega_gF_{\eta_g})
\equiv \mathrm{pp}_\infty(\frac{1}{4}(\eta_1-\eta_2))\mod \frac{\mathrm{d}q}{q}$.
Thus we may take $\alpha_{\omega_g,\eta_g}=\frac{1}{4}(\eta_1-\eta_2)$.
Integrating this over $\gamma_f$ yields the rational number $\int_{\gamma_f} \alpha_{\omega_g,\eta_g}=-\frac{1}{2}$ (to many digits of precision).

Since $g$ is a rational newform, then by Remark \ref{pointrelations}, we can find all the points $P_{g,f,n}$ by only computing $P_{g,f}$. According to Remark \ref{Tg}, this amounts to computing the complex number $z_{g,f} : = \int_{\gamma_f}(\omega_g\cdot\eta_g-\eta_g\cdot\omega_g - 2\alpha_{\omega_g,\eta_g})$. The method in \S \ref{integration}, coupled with the previous paragraph, yields
\[z_{g,f} = -0.4093610\ldots + (1.2256946\ldots)i.\]
Let $W$ be the Weierstrass uniformization of $E$. Then the point $W(z_{g,f}) \in E(\mathbf C)$ does not necessarily lie in $E(\mathbf Q)$. This is because $T_{g}$ is a \textit{rational} combination of cycles, and so $W(z_{g,f})$ is a $\mathbf Q$-linear combination of points in $E(\mathbf Q)$. Thus, the image of $W(z_{g,f})$ in $E(\mathbf C) \otimes \mathbf Q$ lies in the subspace $E(\mathbf Q)\otimes \mathbf Q$. So in order to write $P_{g,f}$ as an element of this space, we must compute the ``denominator'' of $T_{g}$. As in \S \ref{denom}, one can compute using the first few Fourier coefficients of $f$ and $g$ that  the idempotent $e=(0,1)\in \mathbf Q\times \mathbf Q \simeq \mathbf T$ $(\star)$ does not belong to $\mathbf T_{\mathbf Z} \subset \mathbf T$ but $2e$ does. Here, the identification $(\star)$ associates $T_n\otimes 1\in \mathbf T$ to $(a_n(f),a_n(g))\in \mathbf Q\times \mathbf Q$. By definition, $T_{g}$ corresponds to $e$ as an element of the Hecke algebra, so it!
 s denominator is 2. Thus, we can write $P_{g,f} = W(2z_{g,f}) \otimes \frac{1}{2} \in E(\mathbf Q) \otimes \mathbf Q$. One finds that $W(2z_{g,f}) = (\frac{1357}{841}:\frac{28888}{24389}:1)$ to within 13 digits of accuracy using 350 Fourier coefficients, so
\[P_{g,f} = \left(\frac{1357}{841}:\frac{28888}{24389}:1\right) \otimes \frac{1}{2} \in E(\mathbf Q)\otimes \mathbf Q\]



\subsection{Example: {\bf 43a1}}\label{43}
Let $N=43$ and let $E$ be the elliptic curve labeled {\bf 43a1} in Cremona's database. The modular curve $X=X_0(43)$ has genus 3. There are two isotypic components of $H^1_{\dR}(X)$, one of dimension 2 corresponding to the modular form $f$ that parametrized $E$,
and another of dimension 4 corresponding to a newform $g$
with Fourier coefficients in $\mathbf Q(\sqrt2)$, associated to an abelian surface quotient of $J_0(43)$.

In this case, a linear programming algorithm identifies the eta-quotient $u$
that is modular for $\Gamma_0(43)$ of weight 0, holomorphic away from the cusp $\infty$, and with minimal pole order at $\infty$, as
\[u = \frac{\eta(q)^{4}}{\eta(q^{43})^{4}} =  q^{-7}-4q^{-6}+2q^{-5}+8q^{-4}-5q^{-3}-4q^{-2}-10q^{-1}+8+9q+14q^3+O(q^4).\]
Computing the residue pairing shows that for a basis of cuspforms with rational Fourier coefficients, corresponding to holomorphic 1-forms $\omega_f, \omega_{g,1},\omega_{g,2}$ on $X$, the collection
\[\omega_f,\omega_{g,1},\omega_{g,2},u\omega_f,u\omega_{g,1},u\omega_{g,2}\]
forms a basis for $H^1_{\dR}(X/\mathbf Q)$. By finding the matrices of a few Hecke operators with respect to this basis, one can as in the case $N=37$ produce symplectic bases
\[\omega_f,\eta_f,\qquad \text{and}\qquad \omega_{g,1},\omega_{g,2},\eta_{g,1},\eta_{g,2}\]
for $H^1_{\dR}(X)[f]$ and $H^1_{\dR}(X)[g]$ respectively.

We can compute the Poincar\'e dual $\gamma_f$ and the iterated integrals
\[\int_{\gamma_f}(\omega_{g,i} \cdot \omega_{g,j} - \alpha_{\omega_{g,i},\omega_{g,j}}), \int_{\gamma_f}(\omega_{g,i} \cdot \eta_{g,j} - \alpha_{\omega_{g,i},\eta_{g,j}}), \int_{\gamma_f}(\eta_{g,i} \cdot \omega_{g,j} - \alpha_{\eta_{g,i},\omega_{g,j}})\]
in the same manner as in the case $N=37$ with one exception. One simply cannot find $\alpha_{\omega_{g,i},\eta_{g,j}}$ by inspection. No linear combination of our chosen basis has the same principal part as $\omega_{g,i}F_{\eta_{g,j}}$, however some linear combination is cohomologous to such a form. The techniques from \S \ref{computealpha} can be used to find such a form.

Each $T_{g,n}$ gives rise to an element of $\End(H^1_{\dR}(X)[g]) \otimes \mathbf Q$. The collection of elements arising from $T_{g,n}$, $n \geq 1$ generate a subspace of dimension 2, generated by $T_{g,1}$ and $T_{g,2}$. Thus, we can effectively compute $P_{g,f,n}$ for all $n$ simply by computing $P_{g,f}$ and $P_{g,f,2}$. The formula for $P_{g,f}$ is the one given in Remark \ref{Tg}, so we have
\begin{align*}
z_{g,f} & = \int_{\gamma_f} (\omega_{g,1} \cdot \eta_{g,1} - \eta_{g,1} \cdot \omega_{g,1} - 2\alpha_{\omega_{g,1},\eta_{g,1}} + \omega_{g,2} \cdot \eta_{g,2} - \eta_{g,2}\cdot \omega_{g,2} - 2\alpha_{\omega_{g,2},\eta_{g,2}}) \\
& = -2.0768300\ldots + (2.7263648\ldots)i\end{align*}
The Hecke algebra $\mathbf T$ can be identified with $\mathbf Q \times \mathbf Q(\sqrt{2})$ via $T_n \otimes 1 \mapsto (a_n(f),a_n(g))$. Under this identification, $T_{g,1}$ corresponds to $e_1=(0,1)$, and an examination of the Fourier coefficients of $f$ and $g$ shows that $e_1$ does not lie in the image of $\mathbf T_{\mathbf Z}$, but $2e_1$ does. So, we have
$$P_{g,f} = W(2z_{g,f}) \otimes \frac{1}{2} = \left(\frac{11}{49} : -\frac{363}{343} : 1\right) \otimes \frac{1}{2} \in E(\mathbf Q) \otimes \mathbf Q.$$

Finding $P_{g,f,2}$ is a little more involved, as we must compute the matrix of $T_2$ acting on $\omega_{g,1},\omega_{g,2},\eta_{g,1},\eta_{g,2}$. Two methods for doing this were discussed in \S \ref{symplecticbasis} and \S \ref{Tnmatrix}, and either shows that $T_2 \omega_{g,1} = 2\omega_{g,2}$, $T_2 \omega_{g,2} = \omega_{g,1}$, $T_2 \eta_{g,1} = -\frac{97997}{132319}\omega_{g,2} + \eta_{g,2}$ and $T_2 \eta_{g,2} = \frac{97997}{132319} \omega_{g,1} + 2\eta_{g,1}$. So the matrix $A_2$ is given by
\[\left(\begin{array}{cccc}
0 & 2 & 0 & 0 \\
1 & 0 & 0 & 0 \\
0 & -\frac{97997}{132319} & 0 & 1 \\
\frac{97997}{132319} & 0 & 2 & 0 \end{array}\right).\]
Combining this with Lemma \ref{hodgeclass} and remembering that $\alpha_{\omega_{g,i},\omega_{g,j}} = 0$ by Remark \ref{alpha=0}, we find that
\begin{align*}
z_{g,f,2} & = -\frac{97997}{132319}\int_{\gamma_f} (\omega_{g,1}\cdot\omega_{g,2} - \omega_{g,2}\cdot\omega_{g,1}) + \int_{\gamma_f}(\omega_{g,1}\cdot\eta_{g,2} - \eta_{g,2}\cdot\omega_{g,1} - 2\alpha_{\omega_{g,1},\eta_{g,2}}) & \\
& \hspace{.45 cm}+ 2\int_{\gamma_f} (\omega_{g,2}\cdot\eta_{g,1} - \eta_{g,1}\cdot\omega_{g,2} - 2\alpha_{\omega_{g,2},\eta_{g,1}}) \\
& = 2.4055874\ldots - (1.0710898\ldots)i. \end{align*}
The cycle $T_{g,2}$ corresponds to the element $e_2 = (0,\sqrt{2})$ in $\mathbf Q \times \mathbf Q(\sqrt{2})$, which belongs to $\mathbf T_{\mathbf Z}$ by inspection of the Fourier coefficients of $f$ and $g$. Thus, we have
$$P_{g,f,2} = W(z_{g,f,2}) \otimes 1 = (-1 : 0 : 1) \otimes 1 \in E(\mathbf Q) \otimes \mathbf Q.$$


% \subsection{Example: {\tt 57a1}}
% This example illustrates that the algorithm works fine even when there are oldforms of level $N$.

% Set $N=57$.  In this case there are four isotypic components of $H^1_{\dR}(X_0(57))$, and $X_0(57)$ has genus 5. The first corresponds to the elliptic curve of rank 1 labeled {\tt 57a1} in Cremona's database;
% the second and third correspond to the other isogeny classes of elliptic curves of conductor 57,
% and the fourth is the 4-dimensional space of oldforms arising from level 19.
% The optimal eta-quotient $u$ has a pole of order 6, so we can compute all the $\alpha$-adjustment factors explicitly.
% Hecke algebra computations show
% that the projectors onto the second, third, and fourth isotypic components
% of $\mathbf T_{\mathbf Q}$ have denominators 24, 3, and 4 respectively.
% The three points $P_i = P_{g_i;f}$ corresponding to the $g_i$-isotypic components for $g_i$ distinct from $f$ (when rescaled appropriately by the aforementioned denominators) are easily seen via lattice reduction to be 
% \[P_1 \equiv 32 P \mod \Lambda_E,\]
% \[P_2 \equiv P_3 \equiv -16P \mod \Lambda_E,\]
% where $P \approx 4.71803361226...$ is the elliptic logarithm of the generator
% $p = (2:1:1)$ of $E(\mathbf Q)$.
% Note that the y-coordinate of $32p$ is a rational number whose denominator has 24 decimal digits; so $P_1$ corrsponds to a rational point of very large height.
% \subsection{$N=99$}

\subsection{Table}\label{table}
In Table \ref{tab} we report some Chow Heegner points that lie on elliptic  
 curves over $\mathbf Q$ of rank 1 and conductor $<100$. 
The format of the table is as follows. We list the strong Weil curve $E$ in each isogeny class of rank 
Let $N$ be the conductor of the curve $E$ in question, and $f\in S_2(\Gamma_0(N))$ the newform corresponding to $E$. 
The first two columns of the table list the label for $E$ in Cremona's database
and a choice of generator for $E(\mathbf Q)$, using the canonical minimal Weierstrass equation for $E$
with invariants $a_1,a_3\in \{0,1\}$ and $a_2\in \{-1,0,1\}$.

The next column indicates a Galois orbit of normalized Hecke eigenforms $g \in S_2(\Gamma_0(N))$.
The column gives the index of the orbit in question when the orbits are ordered (starting with index 0) by\footnote{FIXME: Say how. Lexicographic by $T_p$-traces for $g$ new, but when $g$ is old the scheme is more complicated...}
The case $g=f$ is omitted (often $f$ has index 0).

The fourth column gives an integer $n\geq 1$ corresponding to a Hecke operator $T_n$.
The table includes $[K_g:\mathbf Q]$ values of $n$ such that $T_g\cdot T_n$ form a $\mathbf Q$-basis for
for the direct factor $K_g$ of $\mathbf T$.
The fifth column lists $P_{g,f,n}$ as an element of $E(\mathbf Q)\otimes_{\mathbf Z}\mathbf Q$, in terms of the generator $P$ in the second column.
The sixth column gives the denominator $d_{g,n}$ defined above,
and the seventh column gives a point of $E(\mathbf Q)$ (with respect to the same Weierstrass model as above)
which represents the coset $d_{g,n} P_{g,f,n}\in E(\mathbf Q)/E(\mathbf Q)^{\mathrm{tor}}$.
(The symbol $*$ indicates that such a coset representative would take up too much space to be included in the table.
The symbol $O$ indicates that $d_{g,n}P_{g,f,n}$ is 0 modulo torsion.

FIXME: Should we include the index $I_{g,f}$ of the subgroup of $E(\mathbf Q)/E(\mathbf Q)^{\mathrm{tor}}$
generated by $\pi_E(P_Z)$ for all $Z \in \mathbf T\cap K_g \subset \mathbf T$?
If so, what is the best way to compute this index?


%  Omit the following?

% The construction of \S \S 2-3 defines a map from $K_g \cap \mathbf T \subset \mathbf T$
% to $E(\mathbf Q)/E(\mathbf Q)^{\mathrm{tor}}$, by associating to the correspondence $d_{g,n} T_{g,n} = d_{g,n} T_g \cdot T_n \subset X_0(N)\times X_0(N)$
% the point $d_{g,n} \pi_E(P_{T_{g,n}})\in E(\mathbf Q)/E(\mathbf Q)^{\mathrm{tor}}$.
% Collectively the points $d_{g,n}P_{g,f,n}$ for the indicated $[K_g:\mathbf Q]$ values of $n$
% generate the entire subgroup of $E(\mathbf Q)$ modulo torsion
% consisting of points $\pi_E(P_Z)$ defined as in \S \S 2-3
% as $Z$ ranges through 

% The last column gives the index $I_{f,g}$ of this subgroup $\langle d_{g,n} P_{g,g,}\rangle_{n\geq 1}$ of
% $\langle P \rangle = E(\mathbf Q)/E(\mathbf Q)^{\mathrm{tor}}\approx \mathbf Z$.

% . In this table, the newform $f$ which parametrizes $E$
% usually corresponds to the 0th isotypic component in this list;
% \footnote{Exceptions:
% for $E=$ {\tt 153b1}, $E$ corresponds to the 1st isotypic component, and the listed CH points correspond to components labels 0,2,3,4,5,6,7; similarly,  for $E=$ {\tt 171b1}, $E$ corresponds to the 1st isotypic component,
% and the listed CH points corresond to components labeled 0,2,3,4,5,6,7,8. FIXME: What about {\tt 92b1}, {\tt 106b1}, {\tt 176c1}, {\tt 184b1}?} the Chow-Heegner points $P_{g,f}$ correspond to the remaining components in the order listed below (via $g$ is an eigenform in the corresponding component).
% The $-\otimes\mathbf Q$ factor accounts for the denominator $d_g$ of the projector onto the corresponding isotypic component of the anemic Hecke algebra. All the curves $E$ in the list are optimal and have rank 1; they are listed by their Cremona label.  The points $P_{g,f}$ are listed as multiples of the indicated generator $P$ for $E(\mathbf Q)$ computed using {\tt Sage}.

% The last two columns indicate the number of Fourier coefficients used in the computation and a lower bound for number of decimal digits\footnote{FIXME: Or was it bits? It's whatever the parameter in {\tt gp.lindep} is.} of accuracy to which each of the points we have computed (after adjusting by the periods of the $\alpha_{\omega_{g,i},\eta_{g,i}}$) agree (modulo $\Lambda_E$) with the indicated elements of $E(\mathbf Q)\otimes \mathbf Q$.


%\renewcommand{\arraystretch}{1.1}

\begin{table}[ht]
 \caption{Chow Heegner points on curves of rank 1 and conductor $<100$}
 \label{tab}
\parbox{.45\linewidth}{
\centering
\begin{tabular}{|m{1.8cm}|m{1.8cm}|r|r|r|r|r|}
\hline
Curve $E = E_f$ &generator $P\in E(\mathbf Q)$ &
$g$ & $n$ & $P_{g,f,n}$ & $d_{g,n}$ % & $d_{g,n}P_{g,f,n}$ % & $I_{g,f,n}$
\\
\hline\hline
{\bf 37a1}& $(0,-1)$& 1 & 1& $-6P$&2 %& $(\frac{1357}{841},\frac{28888}{24389})$ %& 12
\\
\hline
{\bf 43a1}& $(0,-1)$& 1 & 1 & $4P$& 2 %& $(\frac{11}{49}, -\frac{363}{343})$%& 8 
\\         &       &   &  2 & $2P$& 1% & $(-1,0)$                           %& 2 
\\
\hline
{\bf 53a1}& $(0,-1)$& 1& 1& $-2P$ & 2
\\
&&&2 & $-8P$& 2
\\
&&&3&$4P$&2 
\\
\hline
{\bf 57a1}& $(2,1)$ & 1 & 1 & $\frac43P$& 12 % & $(-\frac{1976}{7569}, \frac{750007}{658503})$ %& 16 
\\
          &       & 2  & 1 & $-\frac{16}{3}P$ &3 %& $(-\frac{1976}{7569},-\frac{1408510}{658503})$ %&16 
\\
          &       & 3  & 1 & $-4P$ & 2 %& $(\frac{13}{9}, -\frac{28}{27})$          %& 8 
  \\
          &       &   & 3& $-4P$ & 2 %& $(\frac{13}{9}, -\frac{28}{27})$          %& 
   \\
\hline
{\bf 58a1}& $(0,-1)$& 1& 1& $4P$ & 4  %& $(\frac{50959}{12769}, -\frac{12940767}{1442897})$ %&16 
\\
          &       & 2 &  1 & 0   & 2 %& O %& 8
\\
           &      &   &  2 & $4P$ & 2 %& $(15,-64)$%&
 \\
           &      &   &  3& $4P$ & 2 %& $(15,-64)$%& 
\\
           &      &   &  4& $4P$ & 2 %& $(15,-64)$%& 
\\
 \hline
{\bf 61a1}& $(1,-1)$& 1 & 1 & $-2P$ & 2 %& $(\frac34, -\frac58)$ %&4
\\
 & & & 2 & $4P$ & 2 %& $(-\frac{111}{64}, \frac{475}{512})$ %&
\\
 &&& 3 & $-4P$ & 1 %& $(\frac34,-\frac58)$ %&
\\
\hline
{\bf 65a1}& $(-1,1)$& 1& 1& $P$ & 2 %& $(4,-10)$ %& 2
\\
          &       & & 2 & $P$ & 2 %& $(4,-10)$ %&
  \\
 && 2 & 1 & $P$ & 2 %& $(4,-10)$ %& 2
\\
 &&&2& $3P$ & 2 %& $(\frac{498436}{540225},-\frac{74002214}{397065375})$ %&
\\
\hline
{\bf 77a1} & $(2,3)$ & 1 & 1 & $\frac{12}{5}P$ & 20 
\\
 && 2 & 1 & $-\frac43P$ & 6
\\
&& 3 & 1 & $\frac43P$ & 6
\\
&&& 7 & $\frac{44}{3}P$ & 6
\\
&& 4 & 1 & $-\frac{12}{5}P$ & 10
\\
&&& 2 & $-4P$ & 2
\\
\hline
{\bf 79a1} & $(0,0)$& 1 & 1 & $-4P$ &2 
\\
&&& 2 & $-4P$& 2 
\\
&&&3 &$-4P$ & 2 
\\
&&&4 & $0$ &2
\\
&&&5 &$0$& 2
\\
\hline
{\bf 82a1}& $(0,0)$ & 1 & 1 & $0$ & 4 %& O %&4 
\\
          &       &  & 3 & $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %&
\\
          &       & 2 & 1 & $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %& 4
\\
         &       &  & 2& $0$ & 2 %& O %& 4
\\
 &       &  & 3& $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %& 4
\\
 &       &   & 4& $0$ & 2 %& O
\\
 &       &  & 5 & $4P$ & 2 %& $(\frac{1693226}{133225},\frac{1881510029}{48627125})$ %& 4
\\
 &       &  & 6& $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %& 4
\\ 
\hline

{\bf 83a1} & $(0,0)$& 1 &1 & $0$ & 2
\\
&&&2&$2P$& 2
\\
&&&3&$4P$& 2
\\
&&&4&$-4P$& 2
\\
&&&5&$-4P$& 1
\\
&&&7& $0$ &2
\\
\hline
\end{tabular}
}
\hfill
\parbox{.45\linewidth}{
\centering
\begin{tabular}{|m{1.8cm}|m{1.8cm}|r|r|r|r|r|}
\hline
Curve $E = E_f$ &generator $P\in E(\mathbf Q)$ &
$g$ & $n$ & $P_{g,f,n}$ & $d_{g,n}$ % & $d_{g,n}P_{g,f,n}$ % & $I_{g,f,n}$
\\
\hline\hline

{\bf 88a1} &$(2,-2)$ & 1 & 1 & 0 & 16
\\
&&& 3 & 0& 16
\\
&&2&1 & 0& 8
\\
&&& 2 & $8P$ & 2
\\
&&3 & 1 & 0 & 2
\\
&&& 2 & $8P$ & 2
\\
&&& 4& $16P$ & 1
\\
&&& 8 & $16P$ & 1 
\\
\hline
{\bf 89a1}&$(0,-1)$& 1 & 1 & $\frac85P$ & 5
\\[.1cm]
&& 2 & 1 &$\frac25P$ &10 \\[.1cm]
&&& 2 &$\frac{22}{5}P$&10 \\[.1cm]
&&& 3&$-\frac{16}{5}P$& 10\\[.1cm]
&&& 4 &$-\frac25P$& 10\\[.1cm]
&&& 6 &$\frac{24}5P$&10\\[.1cm]
\hline
{\bf 91a1} & $(0,0)$ & 1 & 1 & $2P$ & 4
\\
 & & 2 & 1 & $2P$ & 4
\\
 &&& 2 & $-2P$ & 2
\\
&& 3 & 1 & $4P$ & 4
\\
&&& 2 & $2P$ & 2
\\ 
&&& 3 & $6P$ & 2
\\
\hline
{\bf 91b1} & $(-1,3)$ & 0 & 1 & $0$ & 4
\\
&& 2 & 1 & $0$ & 4
\\
&&  & 2& $0$ & 2
\\
&& 3 & 1 & $0$ & 4
\\
&&& 2& $0$ & 2
\\
&&& 3& $0$& 2
\\
\hline
{\bf 92b1} & $(1,1)$ & 1 & 1 & $0$& 2
\\
&& 2 &1 & $0$ & 15
\\
&&& 2 & $0$ & 5
\\
&&3&1&$0$ & 20
\\
&&&2& $0$& 5
\\
&&&3& $0$& 4
\\
&&&4&$0$& 6
\\
&&&6&$0$&1
\\
&&&8&$0$&5
\\[.1cm]
\hline 
{\bf 99a1}& $(2,0)$ & 1& 1 & $-\frac23 P$ & 12 %& $(\frac{252307233}{12503296}, \frac{3456859444039}{44211654656})$ %&8
\\[.1cm]
          &       & 2 & 1 & $0$ & 12 %&O %& 
 \\[.1cm]
          &       & 3 & 1 & $\frac23P$ & 6 %& $(\frac{105}{64}, \frac{455}{512})$ %& 4
 \\[.1cm]
          &       & 4 & 1 & $\frac23P$ & 12 %& $(\frac{252307233}{12503296},-\frac{4329322974583}{442116511654656})$%&8 
\\[.1cm]
       &       &  &3 & $\frac83P$ & 3 %&$(\frac{252307233}{12503296},-\frac{4329322974583}{442116511654656})$%&8 
\\[.1cm]
&& 5 & 1 &  $-\frac23P$ & 6 %& $(\frac{105}{64},-\frac{897}{512})$ %&2
 \\[.1cm]
&&&  3 & $-\frac23P$ &3 %& $(3,2)$ %&
\\[.1cm]
&&& 9 & $-\frac{22}{3}P$ & 3 %& * %& 
\\[.1cm]\hline
\end{tabular}
}
\end{table}

% \begin{table}[ht]
% \caption{Chow Heegner points on curves of rank 1 and conductor $<100$}
% \label{tab}

% \begin{tabular}{|m{1.8cm}|m{1.8cm}|r|r|r|r|r|}
% \hline
% Curve $E = E_f$ &generator $P\in E(\mathbf Q)$ &
% $g$ & $n$ & $P_{g,f,n}$ & $d_{g,n}$ % & $d_{g,n}P_{g,f,n}$ % & $I_{g,f,n}$
% \\[.3cm]
% \hline\hline
% % \end{tabular}

% % \begin{tabular}[h]{|c||m{1.8cm}||rl||r|r|}
% % \hline

% {\bf 37a1}& (0,-1)& 1 & 1& $-6P$&2 %& $(\frac{1357}{841},\frac{28888}{24389})$ %& 12
% \\[.1cm]
% \hline
% {\bf 43a1}& (0,-1)& 1 & 1 & $4P$& 2 %& $(\frac{11}{49}, -\frac{363}{343})$%& 8 
% \\[.1cm]
%            &       &   &  2 & $2P$& 1% & $(-1,0)$                           %& 2 
% \\[.1cm]
% \hline
% {\bf 53a1}& (0,-1)& 1& 1& $-2P$ & 2
% \\[.1cm]
% &&&2 & $-8P$& 2
% \\[.1cm]
% &&&3&$4P$&2 
% \\[.1cm]
% \hline
% {\bf 57a1}& (2,1) & 1 & 1 & $\frac43P$& 12 % & $(-\frac{1976}{7569}, \frac{750007}{658503})$ %& 16 
% \\[.1cm]
%           &       & 2  & 1 & $-\frac{16}{3}P$ &3 %& $(-\frac{1976}{7569},-\frac{1408510}{658503})$ %&16 
% \\[.1cm]
%           &       & 3  & 1 & $-4P$ & 2 %& $(\frac{13}{9}, -\frac{28}{27})$          %& 8 
%   \\[ .1cm]
%           &       &   & 3& $-4P$ & 2 %& $(\frac{13}{9}, -\frac{28}{27})$          %& 
%    \\[ .1cm]
% \hline
% {\bf 58a1}& (0,-1)& 1& 1& $4P$ & 4  %& $(\frac{50959}{12769}, -\frac{12940767}{1442897})$ %&16 
% \\[.1cm]
%           &       & 2 &  1 & 0   & 2 %& O %& 8
% \\[.1cm]
%            &      &   &  2 & $4P$ & 2 %& $(15,-64)$%&
%  \\[.1cm]
%            &      &   &  3& $4P$ & 2 %& $(15,-64)$%& 
% \\[.1cm]
%            &      &   &  4& $4P$ & 2 %& $(15,-64)$%& 
% \\[.1cm]
%  \hline
% {\bf 61a1}& (1,-1)& 1 & 1 & $-2P$ & 2 %& $(\frac34, -\frac58)$ %&4
% \\[.1cm]
%  & & & 2 & $4P$ & 2 %& $(-\frac{111}{64}, \frac{475}{512})$ %&
% \\[.1cm]
%  &&& 3 & $-4P$ & 1 %& $(\frac34,-\frac58)$ %&
% \\[.1cm]
% \hline
% {\bf 65a1}& (-1,1)& 1& 1& $P$ & 2 %& $(4,-10)$ %& 2
% \\[.1cm]
%           &       & & 2 & $P$ & 2 %& $(4,-10)$ %&
%   \\[.1cm]
%  && 2 & 1 & $P$ & 2 %& $(4,-10)$ %& 2
% \\[.1cm]
%  &&&2& $3P$ & 2 %& $(\frac{498436}{540225},-\frac{74002214}{397065375})$ %&
% \\[.1cm]
% \hline
% {\bf 77a1} & (2,3) & 1 & 1 & $\frac{12}{5}P$ & 20 
% \\[.1cm]
%  && 2 & 1 & $-\frac43P$ & 6
% \\[.1cm]
% && 3 & 1 & $\frac43P$ & 6
% \\[.1cm]
% &&& 7 & $\frac{44}{3}P$ & 6
% \\[.1cm]
% && 4 & 1 & $-\frac{12}{5}P$ & 10
% \\[.1cm]
% &&& 2 & $-4P$ & 2
% \\[.1cm]
% \hline
% {\bf 79a1} & & 1 & 1 & $-4P$ &2 
% \\[.1cm]
% &&& 2 & $-4P$& 2 
% \\[.1cm]
% &&&3 &$-4P$ & 2 
% \\[.1cm]
% &&&4 & $0$ &2
% \\[.1cm]
% &&&5 &$0$& 2
% \\[.1cm]
% \hline

% {\bf 106b1}& (2,1) & $\frac{12}{5}P$ & 10& 24&38&1800\\
%            &       & $-\frac43 P$ & 6 & 8 && \\
%            &       & $-\frac{11}{3}P$&48& 176& & \\
%            &       & $P$ & 16 & 16& & \\
%            &       & $\frac{28}{5}P$ & 10 & 56 && \\[.1cm]
% \hline
% {\bf 122a1}& (1,-3)& $-\frac{16}{13}P$ &  26 & 32&  28& 1600\\
%            &       & $-P$ & 16 & 16 & & \\
%            &       & $P$  & 16 & 16 & & \\
%            &       & $ -\frac{36}{13}P$ & 26 & 72 & & \\[.1cm]

% \hline
% {\bf 129a1}& (1,-5)& $-\frac{16}{15}P$& 15& 16&  28& 1600 \\
%  &&$-\frac43P$&12 &16&&\\
% &&$-\frac{20}{7}P$ & 14&40&&\\
% &&$ -\frac85P$& 40&64&&\\
% &&$-\frac87P$& 14&16&&\\[.1cm]
% \hline
% {\bf 153a1}& (0,1)& $P$  & 48 & 48& 24 & 1800  \\
%            &      & $2P$ & 24 &   48&  &        \\
%            &      & 0    & 24 &    $\infty$&&        \\
%            &      & $-P$ & 48 &    48&&       \\
%            &      & $-P$ & 16 &    16&&       \\
%            &      & $-2P$& 24 &    48&&       \\
%            &      & $P$  & 16 &    16&&       \\[.1cm]
% \hline
% \hline
% {\bf 106b1}& (2,1) & $\frac{12}{5}P$ & 10& 24&38&1800\\
%            &       & $-\frac43 P$ & 6 & 8 && \\
%            &       & $-\frac{11}{3}P$&48& 176& & \\
%            &       & $P$ & 16 & 16& & \\
%            &       & $\frac{28}{5}P$ & 10 & 56 && \\[.1cm]
% \hline
% {\bf 122a1}& (1,-3)& $-\frac{16}{13}P$ &  26 & 32&  28& 1600\\
%            &       & $-P$ & 16 & 16 & & \\
%            &       & $P$  & 16 & 16 & & \\
%            &       & $ -\frac{36}{13}P$ & 26 & 72 & & \\[.1cm]

% \hline
% {\bf 129a1}& (1,-5)& $-\frac{16}{15}P$& 15& 16&  28& 1600 \\
%  &&$-\frac43P$&12 &16&&\\
% &&$-\frac{20}{7}P$ & 14&40&&\\
% &&$ -\frac85P$& 40&64&&\\
% &&$-\frac87P$& 14&16&&\\[.1cm]
% \hline
% {\bf 153a1}& (0,1)& $P$  & 48 & 48& 24 & 1800  \\
%            &      & $2P$ & 24 &   48&  &        \\
%            &      & 0    & 24 &    $\infty$&&        \\
%            &      & $-P$ & 48 &    48&&       \\
%            &      & $-P$ & 16 &    16&&       \\
%            &      & $-2P$& 24 &    48&&       \\
%            &      & $P$  & 16 &    16&&       \\[.1cm]
% \hline
% \end{tabular}



% \begin{tabular}{|m{1.8cm}|m{1.8cm}|r|r|r|r|r|}
% \hline
%  Curve $E = E_f$ &generator $P\in E(\mathbf Q)$ &
%  $g$ & $n$ & $P_{g,f,n}$ & $d_{g,n}$ % & $d_{g,n}P_{g,f,n}$ % & $I_{g,f,n}$
%  \\[.3cm]
%  \hline\hline
% % \end{tabular}
% {\bf 82a1}& (0,0) & 1 & 1 & $0$ & 4 %& O %&4 
% \\[.1cm]
%           &       &  & 3 & $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %&
% \\[.1cm]
%           &       & 2 & 1 & $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %& 4
% \\[.1cm]
%          &       &  & 2& $0$ & 2 %& O %& 4
% \\[.1cm]
%  &       &  & 3& $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %& 4
% \\[.1cm]
%  &       &   & 4& $0$ & 2 %& O
% \\[.1cm]
%  &       &  & 5 & $4P$ & 2 %& $(\frac{1693226}{133225},\frac{1881510029}{48627125})$ %& 4
% \\[.1cm]
%  &       &  & 6& $2P$ & 2 %& $(\frac{26}{25},-\frac{164}{125})$ %& 4
% \\[.1cm] 
% \hline
% {\bf 83a1}
% \\[.1cm]
% \hline
% {\bf 88a1}
% \\[.1cm]
% \hline
% {\bf 91b1}
% \\[.1cm]
% \hline
% {\bf 92b1}
% \\[.1cm]
% \hline
% {\bf 99a1}& (2,0) & 1& 1 & $-\frac23 P$ & 12 %& $(\frac{252307233}{12503296}, \frac{3456859444039}{44211654656})$ %&8
% \\[.1cm]
%           &       & 2 & 1 & $0$ & 12 %&O %& 
%  \\[.1cm]
%           &       & 3 & 1 & $\frac23P$ & 6 %& $(\frac{105}{64}, \frac{455}{512})$ %& 4
%  \\[.1cm]
%           &       & 4 & 1 & $\frac23P$ & 12 %& $(\frac{252307233}{12503296},-\frac{4329322974583}{442116511654656})$%&8 
% \\[.1cm]
%           &       &  &3 & $\frac83P$ & 3 %&$(\frac{252307233}{12503296},-\frac{4329322974583}{442116511654656})$%&8 
% \\[.1cm]
% && 5 & 1 &  $-\frac23P$ & 6 %& $(\frac{105}{64},-\frac{897}{512})$ %&2
%  \\[.1cm]
% &&&  3 & $-\frac23P$ &3 %& $(3,2)$ %&
% \\[.1cm]

% &&& 9 & $-\frac{22}{3}P$ & 3 %& * %& 
% \\[.1cm]\hline

% \end{tabular}

% \end{table}
% \begin{table}
% \begin{threeparttable}
% \caption{Some elliptic curves with only torsion Chow-Heegner points}
% \begin{tabular}[h]{|c||m{1.8cm}||r|l|c||r|r||c|}
% \hline
% Curve $E=E_f$ &generator $P\in E(\mathbf Q)$ & $P_{g,f}$& $d_g$ & $E(\mathbf Q)_{\mathrm{tor}}$ & \multicolumn{2}{m{2.1cm}|}{accuracy and \# coeff.}&reason\\[.3cm]
% \hline
% \hline
% {\tt 33a1}& rank 0& 0 & 3 & $\mathbf Z/2\oplus \mathbf Z/2$ &53& 800& OK\\[.1cm]
% \hline
% {\tt 34a1}& rank 0 &$(2,-3)$\tnote{a}& 2& $\mathbf Z/6$& 56 & 800 & OK\\[.1cm]
% \hline
% {\tt 35a1}& rank 0 &$(1,-4)$\tnote{a} & 2 & $\mathbf Z/3$ &54 & 800 & OK\\[.1cm]
% \hline
% {\tt 88a1}& (2,-2)& 3 points, all zero & -\tnote{b} & 0& 19&1600& ()\\[.1cm]
% %  $0$ & 16& 19& 1600\\
% %           &       & $0$ & 8 &   &     \\
% %           &       & $0$ & 2 &   &     \\[.1cm]
% \hline
% {\tt 92b1}& (1,1) & 3 points, all zero & -\tnote{b} & 0 & 30 &1200& ()\\[.1cm]
% % $0$ & 2& 30 & 1200\\
% %           &       & $0$ & 15 &   &     \\
% %           &       & $0$ & 20 &   &     \\[.1cm]
% \hline
% {\tt 112a1}& (0,-2)& 4 points, all zero & -\tnote{b} & $\mathbf Z/2$ &  23& 2400&()\\
%  && $\frac{1}{2}\cdot$(irrational 2-torsion point)\tnote{c}& 16& & &&\\[.1cm]
% % $0$ & 8&23&2400 \\
% %   & & $0$ & 16 & & \\
% %   & & $0$ & 8 & & \\
% %    & & $0$ & 16 & & \\  
% % & & $0$ & 16 & & \\[.1cm]
% \hline

% {\tt 117a1}& $(-\frac14,\frac{15}8)$ & 4 points, all zero & -\tnote{b} & $\mathbf Z/4$ & 23 & 1200&()\\[.1cm]
% % & $0$ & 4 & 23&1200 \\
% %            &                         & $0$ & 8 &   &     \\
% %            &                         & $0$ & 8 &   &     \\
% %            &                         & $0$ & 8 &   &     \\[.1cm]
% \hline
% {\tt 124a1}& (-2,1)& 4 points, all zero & -\tnote{b} & 0 & 30 & 1600 & ()\\[.1cm] 
% % $0$& 6 & 30 &1600 \\
% % &&0&6&&\\
% % &&0&66&&\\
% % &&0&44&&\\[.1cm]
% \hline
% {\tt 136a1}& (2,-2)& 6 points, all zero & -\tnote{b} & $\mathbf Z /2$ & 29 & 3600 & () \\[.1cm]
% % $0$& 8& 29& 3600\\
% % &&0&8&&\\
% % &&0&8&&\\
% % &&0&24&&\\
% % &&0&8&&\\
% % &&0&12&&\\[.1cm]
% \hline
% {\tt 148a1}& (-1,2) & 5 points, all zero & -\tnote{b} & 0 & 25 & 1600&()\\[.1cm]
% % &$0$& 12 & 25 & 1600 \\
% %  && 0 & 20 && \\
% %  && 0 & 12 && \\
% %  && 0 & 6 && \\
% %  && 0 & 30 && \\[.1cm]

% \hline
% {\tt 152a1}& (-1,-2)& 6 points, all zero & -\tnote{b} & 0 & 10 & 1200\\[.1cm]
% % 0 & 8 &10&1200  \\
% % && 0 & 24 &&\\
% % && 0 & 24 &&\\
% % && 0 & 16 &&\\
% % && 0 & 24 &&\\
% % && 0 & 6 &&\\
%  \hline

% {\tt 153b1}& (5,-14)& 7 points, all zero & -\tnote{b} & 0 & 25& 1800\\[.1cm]
% % $0$ & 24 & 25 & 1800 \\
% %            &        & $0$ & 24 &    &       \\
% %            &        & $0$ & 24 &    &       \\
% %            &        & $0$ & 48 &    &       \\
% %            &        & $0$ & 16 &    &       \\
% %            &        & $0$ & 24 &    &       \\
% %            &        & $0$ & 16 &    &       \\[.1cm]
% \hline
% {\tt 171b1}& (2, -5)& 8 points, all zero & -\tnote{b} & 0 & 15 & 1200\\[.1cm]
% % 0 & 24& 15 & 1200\\
% %  && 0 & 96 && \\
% % && 0 & 32 && \\
% % && 0 & 32 && \\
% % && 0 & 96 && \\
% % && 0 & 12 && \\
% % && 0 & 24 && \\
% % && 0 & 12 && \\[.1cm]

% \hline
% {\tt 172a1}&(-3,6)& 5 points, all zero &-\tnote{b}& $\mathbf Z/3$& 18 & 1400 & ()\\[.1cm]
% %$0^{12},\quad 0^{20},\quad 0^{42}$, $\quad 0^{30},\quad 0^{28}$& 16&1200\\
% \hline
% {\tt 176c1}&(1,-2)& 7 points, all zero & -\tnote{b} & 0 & 9 & 1600 \\[.1cm]
% %$0^{2^{13}},\quad 0^{2^{11}\cdot 3}, \quad 0^{2^{11}\cdot 3},\quad 0^{2^{14}}$, $\quad 0^{2^{10}\cdot 3},\quad 0^{2^{14}},\quad 0^{2^{13}}$&9&1600\\
% \hline
% {\tt 184a1}&(0,1)& 8 points, all zero & -\tnote{b} & 0 & 30 & 2400 &\\[.1cm]
% %&$0^{2^{11}},\quad0^{96},\quad0^{2^{11}\cdot 3},\quad 0^{2^8\cdot 3^2},\quad 0^{2^{11}}$, $\quad 0^{2^8},\quad 0^{2^5\cdot 3^2\cdot 5},\quad 0^{2^{12}\cdot 5}$&30&2400\\
% \hline


% \end{tabular}
% \begin{tablenotes}
% \item [a] 3-torsion point
% \item [b] various Hecke indices $d_g$ depending on $g$
% \item [c] Namely, ``$(1,1)$'' if we identify $\mathbf E[2](\mathbf C)\cong \mathbf Z/2\oplus\mathbf Z/2$.
% \end{tablenotes}
% \end{threeparttable}
% \end{table}

\subsection{Discussion}\footnote{FIXME:
Check  when possible the conditions in the theorem saying when $P_{g,f}$ is non-torsion,

Explain why quadratric twists switch the sign of the points.}

% \section{Appendix: Summary of the algorithm}



% Maybe we should include pseudocode for some of the more interesting parts of the algorithm, e.g. eta(N), hypgens(N), finding matrices of hecke operators using the Poincar\'e pairing, finding primes such that the corresponding hecke operators distinguish isotypic components of $H^1$, finding the denominator
% of the projector in $\mathbf T_{\mathbf Q}$ onto the $g$-isotypic component. 

\section{Extensions of the method}
\subsection{Allowing $f$ to be an oldform}\footnote{FIXME: to be added!}



\begin{thebibliography}{99}

\bibitem[ARS]{St?} A. Agashe, K. Ribet, W. Stein, The Manin constant, {\em Pure and Applied Mathematics Quarterly} (special issue in honor of John Coates), {\bf 2} (2006), 617--636 .

\bibitem[BD]{BeDa} M. Bertolini, H. Darmon, \emph{Heegner points, $p$-adic $L$
-functions, and the Cerednik-Drinfeld uniformization}, Invent. Math. \textbf{131} (1998), 453-491.


\bibitem[BDP1]{BDP1} M. Bertolini, H. Darmon, K. Prasanna, Generalised Heegner cycles and $p$-adic
Rankin $L$-series, submitted for publication.

\bibitem[BDP2]{BDP2} M. Bertolini, H. Darmon, K. Prasanna, Chow-Heegner points on CM elliptic curves
and values of $p$-adic $L$-series, submitted for publication.

\bibitem[BL]{BL} Ch. Birkenhake, H. Lange, \textit{Complex abelian varieties}. Grundlehren der mathematischen Wissenschaften \textbf{302}. Springer-Verlag (1992).

\bibitem[BO]{ono} K. Bringmann, K. Ono, Coefficients of harmonic weak Maass forms, \textit{Proceedings of the 2008 University of Florida conference on partitions, $q$-series, and modular forms}.

\bibitem[BrPh]{BrPh} N. Brisebarre, G. Philibert, Lower and upper bounds for the Fourier coefficients of powers of the modular invariant $j$, \textit{J. Ramanujan Math. Soc.} \textbf{20}, No. 4 (2005), 255--282. 

\bibitem[Ch]{Chen} K.-T. Chen, Iterated path integrals, {\em Bull. Amer. Math. Soc.} {\bf 83} (1977), 831--879.

\bibitem[Cr]{cremona}J. Cremona, Chapter 2: Modular Symbol Algorithms, in \textit{Algorithms for Modular Elliptic curves}. \url{http://www.warwick.ac.uk/~masgaj/book/fulltext/index.html}.

\bibitem[CWZ]{genera} J. A. Csirik, J. L. Wetherell, M. E. Zieve, On the genera of $X_0(N)$. Preprint. \url{arXiv:math/0006096}.

\bibitem[D1]{Dar00}
H. Darmon,
{\em Integration on $\cH_p\times\cH$ and arithmetic applications},
 Ann. Math. {\bf 154:3}  (2001),  589--639.

\bibitem[D2]{Darbook} H. Darmon, {\em Rational points on modular elliptic curves},
CBMS Regional Conference Series in Mathematics {\bf 101}, 
Washington, DC; by the American Mathematical Society, Providence, RI, 2004. xii+129 pp. 

\bibitem[D3]{Dar}
H. Darmon, Cycles on modular varieties and 
rational points on elliptic curves, in {\em Explicit Methods in Number Theory,
Oberwolfach reports} {\bf 6:3} (2009), 1843--1920. 

\bibitem[DL]{DaLo}
H. Darmon, A. Logan,
{\em  Periods of Hilbert modular forms and rational points on elliptic curves}.
  Int. Math. Res. Not. {\bf 40} (2003), 2153--2180.

\bibitem[DP]{DaPo} H. Darmon,  R. Pollack, {\em Efficient calculation of 
Stark-Heegner points via overconvergent modular symbols},  
Israel J. Math. {\bf 153}  (2006), 319--354. 

\bibitem[DRS]{DRS} H. Darmon, V. Rotger, I. Sols, Iterated integrals of modular forms\\ and rational points on elliptic curves, preprint 2011.

\bibitem[DRS2]{DRS2} H. Darmon, V. Rotger, I. Sols, Diagonal cycles on triple products of Kuga-Sato varieties, in progress.

\bibitem[DS]{DiSh} F. Diamond, J. Shurman, {\em A first course in modular forms}, Grad. text Math. {\bf 228}, Springer Verlag, 2005.

%\bibitem[FK]{FK} Farkas, Kra, Riemann surfaces.

\bibitem[G]{Gonzalez} J. Gonz\'alez, Equations of hyperelliptic modular curves, {\em Ann. inst. Fourier} {\bf } (), --.

\bibitem[Gr]{Gr1} M. Greenberg, {\em Heegner points and rigid analytic modular forms}, McGill Ph. D thesis, 2006.

\bibitem[Gro91]{Gross}
B. H. Gross, {\em Kolyvagin's work on modular elliptic curves} in $L$-functions and arithmetic (Durham, 1989), 235--256,
London Math. Soc. Lecture Note Ser. {\bf 153}, 
Cambridge Univ. Press, Cambridge, 1991.


\bibitem[GrZa]{GZ}
B.~Gross, D.~Zagier, Heegner points and derivatives of $L$-series, {\em Invent. Math.} {\bf 84} (1986), 225--320.

\bibitem[H1]{Hain} R. Hain, Lectures on the Hodge-de Rham theory  of the fundamental group of $\mathbf P^1 - \{0,1,\infty\}$. \url{http://math.arizona.edu/~swc/notes/files/05HainNotes.pdf}.

\bibitem[H2]{Hain2} R. Hain, The Geometry of the Mixed Hodge Structure on the Fundamental Group, {\em Proc. Symp. Pure Math.} \textbf{48} (1987), 247--282.

\bibitem[Ka]{Ka} E. Kani, Endomorphisms of Jacobians of modular curves,  {\em Archiv Math.} {\bf 91} (2008), 226 - 237. 

\bibitem[Ko]{Kol}
V.A.~Kolyvagin.
{\em Finiteness of $E(\mathbf Q)$ and $III (E,\mathbf Q)$ for a subclass of Weil curves}.
 Izv. Akad. Nauk SSSR Ser. Mat.  52  (1988),  no. 3, 670--671;  translation in
 Math. USSR-Izv.  32  (1989),  no. 3, 523--541.
 
\bibitem[Mal]{M} G. Malajovich, Condition number bounds for problems with integer coefficients.

\bibitem[Man]{Man} Ju. I. Manin, Parabolic points and zeta functions of modular curves (Russian), {\em Izv.\ Akad.\  Nauk SSSR Ser.\  Mat.\ }  {\bf 36} (1972), 19--66.

\bibitem[O]{Ogg} A. Ogg, On the Weierstrass points of $X_0(N)$, {\em Illinois J. Math.} \textbf{22} (1978), 31--35. 

\bibitem[R]{rad} Rademacher, The Fourier coefficients of the modular invariant $J(\tau)$.

\bibitem[RS]{RiSt} K. A. Ribet, W. A. Stein, {\em Lectures on modular forms and Hecke operators}, available at http://wstein.org/books.

\bibitem[S{\etalchar{+}}09]{sage}
W.\thinspace{}A. Stein et~al., \emph{{S}age {M}athematics {S}oftware ({V}ersion
  4.7.1)}, The Sage Development Team, 2011, {\tt http://www.sagemath.org}.

\bibitem[Stn]{Stn}
William Stein, \emph{Modular {F}orms, {A} {C}omputational {A}pproach}, Graduate
 Studies in Mathematics, vol.~79, American Mathematical Society, Providence,
 RI, 2007, With an appendix by Paul E.
 Gunnells,{\mbox{}\\\url{http://wstein.org/books/modform/}}. \MR{2289048}

\bibitem[Stv]{Stevens} G. Stevens, \textit{Arithmetic on modular curves}.

% \bibitem[Ya]{Ya} Y. Yang, Defining equations of modular curves, {\em Advances Math.} {\bf 204} (2006), 481-508.

%\bibitem[Zh]{Zh} S. Zhang. {\em Arithmetic of Shimura curves}. Science China Mathematics {\bf 53} (2010), 573--592.

\bibitem[Wa]{Wa} M. Waldschmidt, {\em Nombres transcendent et groups alg\'ebriques}, As\'erisque {\bf 69-70}, 1979.

\bibitem[YZZ]{YZZ}
X. Yuan, S. Zhang, W. Zhang, Triple product L-series and Gross--Schoen cycles I: split case, preprint.


\bibitem[Zh]{Zh}
S. Zhang, Heights of Heegner points on Shimura curves, {\em Ann. Math.} (2) {\bf 153:1} (2001), 27--147.


\end{thebibliography}

\end{document}

