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.
You can try Triangle (0,0),(1,0),(0,1)
Rectangle (0,0),(1,0),(1,1),(0,1)