The integral $\int \ln{(1+m^{2} +2m\cos{x})}\,\mathrm{d}x?$ I am trying to integrate the following:
$$\int \ln{(1+m^{2} +2m\cos{x})}\,\mathrm{d}x.$$
Note that $m$ is a constant.
I tried using integration by parts but I didn't get the answer.
 A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\cos\pars{x} = {z^{2} + 1 \over 2z}\,,\quad z \equiv \expo{\ic x}}$.

\begin{align}
&\color{#f00}{\int\ln\pars{1+m^{2} + 2m\cos\pars{x}}\,\dd x} =
\int\ln\pars{mz^{2} + \bracks{1 + m^{2}}z + m \over z}\,{\dd z \over \ic z}
\\[5mm] = &
-\ic\int\ln\pars{m\bracks{z + m}\bracks{z + 1/m} \over z}\,{\dd z \over z} =
-\ic\int\ln\pars{m\bracks{1 + z/m}\bracks{1 + mz} \over z}\,{\dd z \over z}
\\[1cm] = &\
-\ic\,\ln\pars{m}\int{\dd z \over z} -
\ic\int{\ln\pars{1 - \bracks{-z/m}} \over -z/m}\,\dd\pars{-\,{z \over m}} -
\ic\int{\ln\pars{1 - \bracks{-mz}} \over -mz}\,\dd\pars{-mz}
\\[5mm] + &\
\ic\int{\ln\pars{z} \over z}\,\dd z
\\[1cm] = &\
-\ic\ln\pars{m}\ln\pars{z} +
\ic\int\Li{2}\, '\pars{-\,{z \over m}}\,\dd\pars{-\,{z \over m}} +
\ic\int\Li{2}\, '\pars{-mz}\,\dd\pars{-mz} + \half\,\ic\ln^{2}\pars{z}
\\[5mm] = &\
\ln\pars{m}x + \ic\,\Li{2}\pars{-\,{z \over m}} +
\ic\,\Li{2}\pars{-mz} - \half\,x^{2}\,\ic
\\[5mm] = &\
\color{#f00}{\ln\pars{m}x + \ic\,\Li{2}\pars{-\,{\expo{\ic x} \over m}} +
\ic\,\Li{2}\pars{-m\expo{\ic x}} - \half\,x^{2}\,\ic} + \mbox{a constant}
\end{align}
A: Wikipedia's page on Chebyshev polynomials includes the following generating function: $$\sum_{n=1}^\infty T_n(x)\frac{t^n}{n} = \ln\frac{1}{\sqrt{1-2xt+t^2}}.$$ Replacing $x\to \cos x$ and $t\to -m$, the above can be rearranged to $$ \ln (1+2m\cos x+m^2) = -2 \sum_{n=1}^\infty T_n(\cos x)\frac{(-m)^n}{n}=-2 \sum_{n=1}^\infty \cos(n x)\frac{(-m)^n}{n}.$$ Integrated term-by-term gives $$\int \ln (1+2m\cos x+m^2)\,dx=-2 \sum_{n=1}^\infty \sin(n x)\frac{(-m)^n}{n^2}+C$$ i.e. the Fourier series for this integral.
A: I can give you the answer Mathematica gave me:
$$\int \ln{(1+m^{2} +2m\cos{x})}\,\mathrm{d}x = \\\frac{1}{2} \, x \left(\mathrm{i}\,x-2\,\ln\left(\frac{\mathrm{e}^{\mathrm{i}\,x}+m}{m}\right)- 2\, \ln\left(1+\mathrm{e}^{\mathrm{i}\,x}\,m\right)+2\,\ln{(1+m^{2} +2m\cos{x})}\right)\\+\mathrm{i}\,\mathrm{Li}_2\left(-\frac{\mathrm{e}^{\mathrm{i}\,x}}{m}\right)+\mathrm{i}\,\mathrm{Li}_2\left(-\mathrm{e}^{\mathrm{i}\,x}\,m\right)$$
with $\mathrm{Li}_n()$ the polylogarithm function.
