Evaluation of $\int_0^{\pi/3} \ln^2\left(\frac{\sin x }{\sin (x+\pi/3)}\right)\,\mathrm{d}x$ I plan to evaluate
$$\int_0^{\pi/3} \ln^2\left(\frac{\sin x }{\sin (x+\pi/3)}\right)\, \mathrm{d}x$$
and I need a starting point for both real and complex methods. Thanks !
Sis.

It turns out that this integral takes on a very simple form amenable to analysis via residues.  Let $u = \sin{x}/\sin{(x+\pi/3)}$.  We may then find that (+)
$$\tan{x} = \frac{(\sqrt{3}/2)u}{1-(u/2)}$$
A little bit of algebra reveals a very nice form for the differential:
$$dx = \frac{\sqrt{3}}{2} \frac{du}{1-u+u^2}$$
so the original integral takes on a much simpler-looking form:
$$\frac{\sqrt{3}}{2} \int_0^1 du \frac{\log^2{u}}{1-u+u^2}$$
This is not ready for contour integration yet.  We may transform this into such an integral by substituting $u=1/v$ and observing that
$$\int_0^1 du \frac{\log^2{u}}{1-u+u^2} = \int_1^\infty du \frac{\log^2{u}}{1-u+u^2} = \frac{1}{2} \int_0^\infty du \frac{\log^2{u}}{1-u+u^2}$$
We may now analyze that last integral via the residue theorem.  Consider the integral
$$\oint_C dz \frac{\log^3{z}}{1-z+z^2}$$
where $C$ is a keyhole contour that passes up and back along the positive real axis.  It may be shown that the integral along the large and small circular arcs vanish as the radii of the arcs goes to $\infty$ and $0$, respectively.  We may then write the integral in terms of positive contributions just above the real axis and negative contributions just below.  The result is
$$\oint_C dz \frac{\log^3{z}}{1-z+z^2} = \begin{array}\\ i \left ( - 6 \pi \int_0^\infty du \frac{\log^2{u}}{1-u+u^2} + 8 \pi^3 \int_0^\infty du \frac{1}{1-u+u^2} \right ) \\ + 12 \pi^2 \int_0^\infty du \frac{\log{u}}{1-u+u^2} \end{array}$$
We set this equal to $i 2 \pi$ times the sum of the residues of the poles of the integrand within $C$.  The poles are $z \in \{e^{i \pi/3},e^{i 5\pi/3}\}$.  The residues are
$$\mathrm{Res}_{z=e^{i \pi/3}} = -\frac{\pi^3}{27 \sqrt{3}}$$
$$\mathrm{Res}_{z=e^{i 5\pi/3}} = \frac{125 \pi^3}{27 \sqrt{3}}$$
$i 2 \pi$ times the sum of these residues is then
$$i \frac{248 \pi^4}{27 \sqrt{3}}$$
Equating imaginary parts of the integral to the above quantity, we see that
$$ - 6 \pi \int_0^\infty du \frac{\log^2{u}}{1-u+u^2} + 8 \pi^3 \int_0^\infty du \frac{1}{1-u+u^2} = \frac{248 \pi^4}{27 \sqrt{3}}$$
Now, I will state without proof for now that (++)
$$\int_0^\infty du \frac{1}{1-u+u^2} = \frac{4 \pi}{3 \sqrt{3}}$$
Then with a little arithmetic, we find that
$$\int_0^\infty du \frac{\log^2{u}}{1-u+u^2} = \frac{20 \pi^3}{81 \sqrt{3}}$$
The integral we want is $\sqrt{3}/4$ times this value; therefore

$$\int_0^{\pi/3} dx \log^2{\left [ \frac{\sin{x}}{\sin{(x + \pi/3)}}
 \right ]} = \frac{5\pi^3}{81}$$

Proof of (++)
Now, to prove (++), we go right back to the observation (+) that
$$ x = \int \frac{du}{1-u+u^2} \implies \tan{\left ( \frac{\sqrt{3}}{2} x \right )} = \frac{(\sqrt{3}/2)u}{1-(u/2)}$$
Therefore
$$\int_0^1 \frac{du}{1-u+u^2} = \frac{2}{\sqrt{3}} \left [ \arctan \left ( \frac{(\sqrt{3}/2) u}{1-(u/2)} \right ) \right ]_0^1 = \frac{2}{\sqrt{3}} \frac{\pi}{3}$$
and we showed that this is $1/2$ the integral over $[0,\infty)$, and
$$\int_0^\infty \frac{du}{1-u+u^2} = \frac{4 \pi}{3 \sqrt{3}}$$
QED
