Evaluating the integral of an exact differential What is wrong with evaluating the closed path integral as the following?
$$
\oint_\gamma \frac{x\,dy-y\,dx}{x^2+y^2}= 2\pi\ne\oint_\gamma d\left(\arctan\left(\frac{y}{x}\right)\right)=0
$$
where the region inside of the curve $\gamma$ contains the origin, and the curve is simple, smooth, positively oriented, and closed.
If we cannot evaluate it as such, then what are the conditions for evaluating such integrals as exact differentials?
 A: A Riemann--Stieltjes integral
$$
\int_a^b f(x)\, dg(x)
$$
is the limit as the mesh of a partition $a=x_0<x_1<\cdots<x_{n-1}<x_n=b$ approaches $0$, of
$$
\sum_{k=0}^{n-1} f(x^{*}_k) \,(g(x_{k+1})-g(x_k)).
$$
If $g$ happens to be everywhere differentiable, then this is the same as
$$
\int_a^b f(x)g'(x)\,dx.
$$
But if $g$ has a jump discontinuity, then one adds the value of $f$ at that point times the size of the jump.  And there are yet other ways to be non-differentiable, but those don't concern us in this case.
As one goes around the circle, $y/x$ goes up to $\infty$, so $\arctan(y/x)$ approaches $\pi/2$ from below.  As one crosses the $y$ axis, $y/x$ jumps from $+\infty$ to $-\infty$ and the arctangent jumps from $+\pi/2$ to $-\pi/2$, thus adding $-\pi$ to the integral.  The curve crosses the $y$-axis twice, thus adding $-2\pi$.
As far as I can see, one must view this as a Riemann--Stieltjes integral for this to be true.
The other integral, however, has no such problem.  In place of the arctangent, one in effect has the total angle through which the ray from the origin to the curve has turned so far.  That just goes once around the circle.
A: The arctangent is a multivalued function: if you continuously follow its branches, you'll find that $\arctan(y/x)$ is larger at the end of the contour than at the beginning of the contour by $2\pi$, and thus the integral on the right will be $2\pi$, as desired.
However, if you make a branch cut (which happens at $\infty$ for the typical single-valued variation of $\arctan$ on the projective reals) and you switch branches when you pass through the branch cut, you'll accumulate those jump discontinuities into the overall integral, making the integral on the right come out to $0$.
A different geometric picture of what I describe above is to consider the space $X$ of all points in $(x,y,z)$ space that satisfy $\tan(z) = y/x $. (where the operations are projective real-valued: e.g. so $1/0 = \infty = \tan(\pi/2)$)
On $X$, we can define "$\arctan(y/x)$" to mean the function whose value at the point $(x,y,z)$ is $z$.
We can then lift the contour $\gamma$ to be a continuous path in $X$ that traces out the same $(x,y)$ coordinates... but note that it will no longer be a loop, because the $z$ coordinates are different at the beginning and end of the path. And since we are integrating an exact differential, we do indeed have that $\int_\gamma d\arctan(y/x)$ is the difference of the values of $\arctan(y/x)$ at the two endpoints.
A: If $\gamma$ were a closed curve lying completely in the half plane $x>0$ we could make use of the fact that
$$\arg(x,y)=\arctan{y\over x}\qquad(x>0)\ ,$$
and then the formula
$$\int_\gamma{x\>dy-y\>dx\over x^2+y^2}=\int_\gamma\nabla\arg({\bf z})\ d{\bf z}=\arg\bigl({\rm endpoint}(\gamma)\bigr)-\arg\bigl({\rm initial\ point}(\gamma)\bigr)=0$$
would hold. But this is not the case for the  $\gamma$ envisaged here. In fact $\arctan{y\over x}$ is not even defined on all of $\gamma$, let alone differentiable.
