<s>[INST] How to integrate this function over this surface? I'm solving a physics problem, and at some point I need to solve this integral
$$\iint\limits_S \frac{1}{x+2a} dxdy$$
where 
$$S=\{(x,y,z):x^2+y^2\leq a^2, \ x\geq0, \ z=0\}$$
So $S$ is the right semicircle corresponding to the circle centered at the origin with radius $a$. This seemed a bit difficult so I decided to calculate the integral over the quarter circle in the first quadrant (let's call this surface $S'$) and then multiply that by two to get the value of the whole surface integral. Doing this, I got
$$2\iint\limits_{S'} \frac{1}{x+2a} dxdy=2\int\limits_0^a dy\int\limits_0^{\sqrt{a^2-y^2}}\frac{1}{2a+x}dx=2\int\limits_0^a\ln\left(\sqrt{a^2-y^2}+2a\right)-\ln(2a)\ dy=\int\limits_0^a 2\ln\left(\sqrt{a^2-y^2}+2a\right)\ dy \ - a\ln(2a)$$
And this function doesn't seem to have a primitive, or at least it is very hard to find it (I looked up in some tables and found nothing). The problem shouldn't be so hard so I expect that this integral can be calculated in a much easier way. Any ideas?
 [/INST] Integrating $y$ first and using the trig substitution $x = a\sin\theta$ leads to
$$
\int_{0}^{a} \frac{2\sqrt{a^{2} - x^{2}}\, dx}{2a + x}
  = \int_{0}^{\pi/2} \frac{2a\cos^{2}\theta\, d\theta}{2 + \sin\theta}.
\tag{1}
$$
The tangent half-angle substitution $t = \tan\frac{\theta}{2}$ gives
$$
\cos\theta = \frac{1 - t^{2}}{1 + t^{2}},\qquad
\sin\theta = \frac{2t}{1 + t^{2}},\qquad
d\theta = \frac{2\, dt}{1 + t^{2}},
$$
upon which (1) becomes
$$
2a\int_{0}^{1} \frac{\left(\dfrac{1 - t^{2}}{1 + t^{2}}\right)^{2}}{2 + \dfrac{2t}{1 + t^{2}}} \cdot \frac{2\, dt}{1 + t^{2}}
  = 2a\int \frac{(1 - t^{2})^{2}}{(1 + t^{2})^{2}(1 + t + t^{2})}\, dt.
\tag{2}
$$
Partial fractions is a bit laborious (six equations, six unknowns); for the record, the decomposition is
$$
\frac{(1 - t^{2})^{2}}{(1 + t^{2})^{2}(1 + t + t^{2})}
  = \frac{A_{1}t + B_{1}}{(t^{2} + 1)^{2}} + \frac{A_{2}t + B_{2}}{t^{2} + 1} + \frac{A_{3}t + B_{3}}{t^{2} + t + 1},
$$
and the augmented matrix of the resulting linear system for $(A_{1}, B_{1}, A_{2}, B_{2}, A_{3}, B_{3})$ is
$$
\left[\begin{array}{@{}rrrrrr|r@{}}
0 & 0 & 1 & 0 & 1 & 0 & 0 \\
0 & 0 & 1 & 1 & 0 & 1 & 1 \\
0 & 1 & 0 & 1 & 0 & 1 & 1 \\
1 & 0 & 2 & 1 & 2 & 0 & 0 \\
1 & 1 & 1 & 2 & 0 & 2 & -2 \\
1 & 1 & 1 & 1 & 1 & 0 & 0 \\
\end{array}\right].
$$
The end result is easily checked to be
$$
\frac{(1 - t^{2})^{2}}{(1 + t^{2})^{2}(1 + t + t^{2})}
  = -\frac{4t}{(t^{2} + 1)^{2}} + \frac{4}{t^{2} + 1} - \frac{3}{(t + \frac{1}{2})^{2} + \frac{3}{4}}.
$$
Consequently, (2) becomes
$$
2a\left[\frac{2}{t^{2} + 1} + 4\arctan t - 2\sqrt{3} \arctan\bigl(\tfrac{2}{\sqrt{3}}(t + \tfrac{1}{2})\bigr)\right]\bigg|_{0}^{1}
  = 2a\left[-1 + \pi + \frac{\pi}{\sqrt{3}}\right].
$$
</s>