Integral of wedge product of two one forms on a Riemann surface I'm having trouble verifying an elementary assertion made in this answer on MathOverflow.  It seems more like a math.stackexchange question, so I'm asking it here.
Anyway, the assertion is as follows (mostly copied from the question) : "Let $X$ be a genus $g$ surface, with $a_1$, ..., $a_g$, $b_1$, ..., $b_g$ a standard basis [for $H_1(X;\mathbb{Z})$]. Let $\omega$ and $\eta$ be two one-forms. Let $(u_1, u_2, \ldots, u_{2g})$ be the integrals $(\int_{a_1} \omega, \ldots, \int_{a_g} \omega, \int_{b_1} \omega, \ldots, \int_{b_g} \omega)$. Let $(v_1, \ldots, v_{2g})$ be the same integrals for $\eta$. Now, in terms of the $u$'s and the $v$'s, what is $\int_X \omega \wedge \eta$? The answer, which I leave for you to check, is $u_1 v_{g+1} + u_2 v_{g+2} + \cdots + u_g v_{2g} - u_{g+1} v_1 - u_{g+2} v_2 - \cdots - u_{2g} v_g$."  Can anyone help me verify this?
EDIT : On MathOverflow, David Speyer applies this to the case where $\omega$ and $\eta$ are holomorphic $1$-forms, and thus closed.  Maybe this condition is necessary?  It feels like one should somehow apply Stokes's theorem to the $4g$-gon obtained as a fundamental domain for the universal cover of $X$; the $a_i$ and $b_i$ will be the boundary components.  But I don't quite see how to do this.
EDIT 2 : It's now been answered, but just in case someone comes across this later I thought I'd point out that the question as posed did not make any sense unless you assumed that $\omega$ and $\eta$ are closed -- otherwise, it would not make sense to integrate them along homology classes!
 A: If $\omega$ and $\eta$ are closed differential forms on $M$ (compact of genus $g$), then
$$\int_M \omega\wedge \eta=\sum_{i=1}^g \int_{a_i}\omega\int_{b_i}\eta-\int_{a_i}\eta\int_{b_i}\omega $$
The core of the proof is to use the decompositions (we call them harmonic decompositions)
$$\omega=\sum_{i=1}^{2g}\mu_j\alpha_j$$
and
$$\eta=\sum_{i=1}^{2g}\nu_j\alpha_j,$$
denoting by $\alpha_j$ the basis dual to the canonical homology basis $\{n_j\}:=\{a_a,\dots,a_g,b_1,\dots,b_g\}$. In other words $\int_{a_k}\alpha_j=\delta_{kj}$ and 
$\int_{b_k}\alpha_j=\delta_{rj}$, with $r=j-g$. This implies
$$\mu_j=\int_{n_j}\omega,$$
$$  \nu_j=\int_{n_j}\eta.$$
The existence of the dual basis is proven using the differential form associated to the cycles $a_i$ and $b_j$: this is a standard construction.
The harmonic decompositions for $\omega$ and $\eta$ are motivated by the following argument: the integral $\int_M \omega\wedge \eta$ is unchanged if we apply the replacement $\omega\rightarrow \omega+df$, wih $f$ $C^2$-function. Same holds for the r.h.s., as a direct computation shows.
As we can write any harmonic differential as the sum of a closed differential with an exact one (this results holds on $M$ compact), we arrive at the harmonic decompositions.
Using the harmonic decompositions, the proof of the integral formula follows once we compute the integrals of the form (called intersection numbers)
$$\int_{M}\alpha_j\wedge\alpha_k $$ 
which arise from the l.h.s. of the integral formula. The above intersection numbers are s.t.
$$\int_{M}\alpha_j\wedge\alpha_{j+g}=1 $$ 
for $j=1,\dots,g$ and
$$\int_{M}\alpha_j\wedge\alpha_{j-g}=-1 $$ 
for $j=g+1,\dots,2g$. This follows from the duality of the $\alpha_i$ with the canonical homology basis.
We are now ready to collect all results, i.e.
$$\int_M \omega\wedge \eta=\sum_{k,j=1}^{2g}\mu_j\nu_k \int_{M}\alpha_j\wedge\alpha_k=
\sum_{j=1}^{g}\mu_j\nu_{j+g} \int_{M}\alpha_j\wedge\alpha_{j+g}+
\sum_{j=g+1}^{2g}\mu_j\nu_{jg} \int_{M}\alpha_j\wedge\alpha_{j-g}=
\sum_{j=1}^{g}\mu_j\nu_{j+g} -
\sum_{j=g+1}^{2g}\mu_j\nu_{jg}=\sum_{i=1}^g \int_{a_i}\omega\int_{b_i}\eta-\int_{a_i}\eta\int_{b_i}\omega.$$
I hope this helps.
A: This can be done by hand. Let's do a torus first. Consider the torus $T$ as $[0,1]^2$ with the edges glued together and let the closed $1$-forms be $\alpha$ and $\beta$. I'll also use $\alpha$ and $\beta$ to denote the same forms on the square $[0,1]^2$ itself, without the gluing. I'll write $a$ and $b$ for the two homology classes of $T$ coming from $\{ 0 \} \times [0,1]$ and $[0,1] \times \{ 0 \}$.
Since $\alpha$ is exact, we can find some function $f$ on $[0,1]^2$ with $df=\alpha$. 
Notice that $f$ does not descend to a well defined function on $T$; rather, 
$$f(x,1) - f(x,0) = \int_{y=0}^1 \alpha(x,y) = \int_{a} \alpha \quad (\ast).$$
Since $\alpha$ is closed, this quantity is independent of $x$.
Similarly,
$$f(1,y) - f(0,y) = \int_{b} \alpha. \quad (\ast \ast)$$
Using that $\beta$ is closed, we have $\alpha \beta = d(f \beta)$, so by Stokes theorem
$$\int_{[0,1]^2} \alpha \beta = \int_{\partial [0,1]^2} f \beta.$$
The boundary of $[0,1]^2$ consists of $\{0 \} \times [0,1]$, $\{ 1 \} \times [0,1]$, $[0,1] \times \{ 0 \}$ and $[0,1] \times \{ 1 \}$. We'll concentrate on the first two paths. We have
$$\int_{x=0}^1 f(x,1) \beta(x,1) - \int_{x=0}^1 f(x,0) \beta(x,0) = \int_{x=0}^1 \left( f(x,1) - f(x,0) \right) \beta(x,0)$$
since $\beta$ is a well-defined form on $T$. From $(\ast)$, we know that $f(x,1)-f(x,0)$ is a constant equal to $\int_{a} \alpha$, so our integral is
$$\int_{x=0}^1 \left( \int_{a} \alpha \right) \beta(x,0) = \int_{a} \alpha \int_{b} \beta.$$
Similarly, the paths $[0,1] \times \{ 0 \}$ and $[0,1] \times \{ 1 \}$ contribute $\int_{b} \alpha \int_{a} \alpha$.
The case of a genus $g$ curve is the same idea, just notationally messier, using the standard picture of a $4g$-gon with the sides identified.
