Application of Green's Theorem leading to different solutions of area integral I have an area integral problem over an irregular convex polygon. I use Green's Theorem to convert the area integral to a contour integral, and solve using standard methods.
Green's Theorem says I can pick any functions $L$, $M$ such that $\left( \frac{\partial M}{\partial x} - \frac{\partial L}{\partial y} \right)$ gives my original integrand. Or, equivalently, to pick any vector function $\mathbf{F}$ such that the divergence $\nabla \cdot \mathbf{F}$ gives the same integrand.
So to check my answer, I picked different functions $L, M$ satisfying this property, expecting to get the same result. However, I get a slightly different result and I am unable to find the source of my error.
Problem
Here is the original area integral problem:
$$ \iint_P \frac{ax + by + c}{dx + ey + f} + g \; dx \; dy, $$
where $a$ through $g$ are constants. And here I am specifically considering the case where $d = 0$, i.e. 
$$ \iint_P \frac{ax + by + c}{ey + f} + g \; dx \; dy. $$
The polygon $P$ is comprised of $N$ vertices $\mathbf{v}_i, i=1..N$.
First solution
In the first attempt, I chose the function 
$$F_x = \frac{ax^2/2 + bxy + cx}{ey+f} + gx, F_y = 0.$$
I substituted these functions into Green's Theorem to get the contour integral, and substituted for the variables $x, y$ the parametric forms, $v_{ix} + t \Delta_{ix}, v_{iy} + t \Delta_{iy}$, where $\Delta = v_{i+1} - v_{i}$:
$$ \iint_P \frac{ax + by + c}{dx + ey + f} + g \; dx \; dy = \iint_P \nabla \cdot \mathbf{F} \; dx \; dy = \oint_P \mathbf{F}.[dy, -dx] $$
$$ = \sum_{i=1}^{N} \int_0^1 \mathbf{F}(t).[\Delta_{iy}, -\Delta_{ix}] \; dt.$$
This leads to a form like
$$\iint_P = \sum_{i=1}^N \int_0^1 \frac{\alpha t^2 + \beta t + \gamma}{\delta t + \epsilon} + g \Delta_{iy}(\Delta_{ix} t + v_{ix}) \; dt, $$ 
for other constants $\alpha$ through $\gamma$, and where $v_{N+1} := v_1$.
Solving this definite integral gives the solution
$$\sum_{i=1}^N \frac{\alpha + 2\beta}{2\delta} - \frac{\alpha \epsilon}{\delta^2} + g \Delta_{iy}(v_{ix} + \frac{\Delta_{ix}}{2}) + (\frac{\gamma}{\delta} - \frac{\beta \epsilon}{\delta^2} + \frac{\alpha \epsilon^2}{\delta^3}) \ln(1 + \frac{\delta}{\epsilon}), $$
for $\delta \neq 0$.
Second solution
Here I picked a different function $F$ to check my solution:
$$F_x = \frac{bxy + cx}{ey + f} + gx, F_y = \frac{ax}{e} \ln(ey + f).$$
Following the same procedure, this results in a slightly different answer. Specifically the terms that are linear in the constants all match, but the log terms do not.
I cannot see that the two solutions agree, nor can I find any error in my working. Help at this point is appreciated.
EDIT: Parameterization and closed curve
OK, I will try to be explicit about the parameterization.
Let $P$ be a polygon specified by $N$ vertices $v_1, v_2, ..., v_N$, ordered counter-clockwise. For notational convenience, let $v_{N+1} := v_1$.
Let the $i$th segment of the polygon be parameterized with the linear interpolation $\mathbf{p}(t) = (x(t), y(t)) = \mathbf{v}_i + t (\mathbf{v}_{i+1} - \mathbf{v}_i) = \mathbf{v}_i + \mathbf{\Delta}_i t, t \in [0, 1].$
Then a function $g(x, y)$ can be integrated along the positively oriented closed polygon boundary $\partial P$ as:
$$ \oint_{\partial P} g(x, y) = \sum_{i=1}^N \int_0^1 g(x(t), y(t)) dt$$.
You can see the curve is closed because all $N$ segments are being used and $v_{N+1}$ is defined as $v_1$.
EDIT: Detail of differences in solutions
Both solutions involve terms in $\ln(ev_{i+1y}+f)$, but the coefficients of this term disagree between my two solutions.
For the second solution I get a coefficient that includes the additional term $-\frac{a}{2e}v_{i+1x}^2$, which does not appear in the first solution. All other terms of this coefficient agree.
 A: I think the reason you get a mistake is due to wrong sign in $F_y$ in second solution, perhaps not only, but I didn't try to follow. Hopefully the following helps.
In following example we consider rectangular domain $$P=[\alpha,\beta]\times[\gamma,\delta],$$
the extension to more general polygon is analogous. 
The arrows in the line integrals denotes the counter clock walking along the boundary curve lines starting from bottom left corner. Note also the notation $dx$ along a fixed $x=x_0$ is denoted as $dx_0=0$.  
Green's theorem
$$\oint_{\partial P} (L\, dx + M\, dy) = \iint_{P} \left(\frac{\partial M}{\partial x} - \frac{\partial L}{\partial y}\right)\, dx\, dy$$
Problem
$$\iint_P \frac{ax + by + c}{ey + f} + g \; dx \; dy.$$
Zero Solution
$$(1) \;\iint_P \frac{ax + by + c}{ey + f} + g \; dx \; dy=
\int_\gamma^\delta \frac{a x^2}{2 (e y+f)}+\frac{x (b y+c)}{e y+f}+g x\Bigg|_{x=\alpha}^\beta\;dy
=\frac{1}{2} x \left(\frac{\ln (e y+f) (a e x-2 b f+2 c e)}{e^2}+\frac{2 y (b+e g)}{e}\right)\Bigg|_{x=\alpha}^\beta \Bigg|_{y=\gamma}^\delta$$
similarly
$$(2)\;\iint_P \frac{ax + by + c}{ey + f} + g \; dx \; dy
=\iint_P \frac{ax + by + c}{ey + f} + g \; dy \; dx \quad\\=
\int_\alpha^\beta\frac{\ln (e y+f) (a e x-b f+c e)}{e^2}+\frac{b y}{e}+g y
\Bigg|_{y=\gamma}^\delta \;dx
\quad=
\frac{1}{2} x \left(\frac{\ln (e y+f) (a e x-2 b f+2 c e)}{e^2}+\frac{2 y (b+e g)}{e}\right)
\Bigg|_{y=\gamma}^\delta
\Bigg|_{x=\alpha}^\beta $$
First Solution
$$M(x,y) = \frac{ax^2/2 + bxy + cx}{ey+f} + gx,\\ L(x,y)= 0$$
$$\iint_P \frac{ax + by + c}{ey + f} + g \; dx \; dy = 
\oint_{\partial P} 0\, dx + M\, dy=\\
\oint_{\rightarrow}  M(x,\gamma)\, d\gamma+
\oint_{\uparrow}  M(\beta,y)\, dy+
\oint_{\leftarrow}  M(x,\delta)\, d\delta+
\oint_{\downarrow}  M(\alpha,y)\, dy
\\
=\oint_{\uparrow}  M(\beta,y)\, dy+
\oint_{\downarrow}  M(\alpha,y)\, dy=
\oint_{\uparrow}  M(\beta,y)\, dy-
\oint_{\uparrow}  M(\alpha,y)\, dy\\=
\int_\gamma^\delta \frac{a x^2}{2 (e y+f)}+\frac{x (b y+c)}{e y+f}+g x\Bigg|_{x=\alpha}^\beta\;dy=(1)$$
Second Solution
$$M = \frac{bxy + cx}{ey + f} + gx, \\
L = -\frac{ax}{e} \ln(ey + f).$$
$$ %comment     
\oint_{\partial P} (L\, dx + M\, dy)=\\ 
\oint_{\rightarrow} L(x,\gamma)dx + M(x,\gamma)\, d\gamma+
\oint_{\uparrow}  L(\beta,y)d\beta + M(\beta,y)\, dy\\+
\oint_{\leftarrow}  L(x,\delta)dx + M(x,\delta)\, d\delta+
\oint_{\downarrow} L(\alpha,y)d\alpha + M(\alpha,y)\, dy\\
=
\oint_{\rightarrow} L(x,\gamma)dx +
\oint_{\uparrow}   M(\beta,y)\, dy+
\oint_{\leftarrow}  L(x,\delta)dx +
\oint_{\downarrow}   M(\alpha,y)\, dy\\
=
\oint_{\uparrow}   M(\beta,y)-M(\alpha,y)\, dy+
\oint_{\leftarrow}  L(x,\delta) -  L(x,\gamma)\,dx \\
=
\iint_P  \frac{\partial M}{\partial x}\,dx\, dy
-\iint_P   \frac{\partial L}{\partial y}\,dy\, dx
=
\iint_P \frac{ax + by + c}{ey + f} + g \; dx \; dy$$
A:     Term1[i_, t_, x_, y_] := ((b (x[[i]] + t dx[i]) (y[[i]] + t dy[i]) + 
        c (x[[i]] + t dx[i]))/(e (y[[i]] + t dy[i]) + f) + 
       g (x[[i]] + t dx[i])) dy[i] - (a dx[i] (x[[i]] + t dx[i]))/
     e Log[e (y[[i]] + t dy[i]) + f] /. 
   dx[i] -> (x[[i + 1]] - x[[i]]) /. dy[i] -> (y[[i + 1]] - y[[i]])

Term2[i_, t_, x_, y_] := ((a ((x[[i]] + t dx[i]))^2/2 + 
       b (x[[i]] + t dx[i]) (y[[i]] + t dy[i]) + 
       c (x[[i]] + t dx[i]))/(e (y[[i]] + t dy[i]) + f) + 
      g (x[[i]] + t dx[i])) dy[i] /. 
   dx[i] -> (x[[i + 1]] - x[[i]]) /. dy[i] -> (y[[i + 1]] - y[[i]])

Integdand1[t_, N_, x_, y_] := \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(N\)]\((Term1[i, t, x, y

Integdand2[t_, N_, x_, y_] := \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(N\)]\((Term2[i, t, x, y])\)\)

You can try 
Triangle (0,0),(1,0),(0,1)
x = {0, 1, 0, 0}
y = {0, 0, 1, 0}
IntegrandTriangle = Integdand2[t, 3, x, y] - Integdand1[t, 3, x, y] // FullSimplify

\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \
\(1\)]\(\((IntegrandTriangle)\) \[DifferentialD]t\)\)

Rectangle (0,0),(1,0),(1,1),(0,1)
x = {0, 1, 1, 0, 0}
y = {0, 0, 1, 1, 0}
IntegrandRectangle = Integdand2[t, 4, x, y] - Integdand1[t, 4, x, y] // FullSimplify

\!\(\*SubsuperscriptBox[\(\[Integral]\), \(0\), \
\(1\)]\(\((IntegrandRectangle)\) \[DifferentialD]t\)\)

