Suppose I have the square of a saw-tooth Fourier series . . . something like
$$\left(\sin(x) + \frac{\sin(2x)}{2} +\frac {\sin(3x)}{3}\right)^2$$
Is there a way to integrate the natural log of this function? I.e.,
$$\ln\left[\left(\sin(x) + \frac{\sin(2x)}{2} +\frac {\sin(3x)}{3}\right)^2\right]$$ over some interval (say, $0$ to $2\pi$)?
If the antiderivative of this is too gnarly (Mathematica spits out a pretty large antiderivative), is there a way to approximate this?
Define
$$f(\theta):=\ln\left[\left(\sin(\theta)+\frac{\sin(2\theta)}2+\frac{\sin(3\theta)}3\right)^2\right]$$
$$I:=\int_0^{2\pi}f(\theta)~\mathrm d\theta$$
Unfortunately, $f(\theta)$ diverges at $\{0,\pi,2\pi\}$, but this can easily be fixed by subtracting $\ln[\sin^2(\theta)]$ from the integrand:
$$I=-4\pi\ln(2)+\int_0^{2\pi}g(\theta)~\mathrm d\theta$$
Where
$$g(\theta)=2\ln\left(\frac43+\cos(\theta)+\frac23\cos(2\theta)\right)$$
defines an analytic periodic function. Integrals of these kinds are fairly easy to approximate, as
$$\int_0^{2\pi}g(\theta)~\mathrm d\theta\approx S(n)=\frac{2\pi}n\sum_{k=1}^ng(2\pi k/n)$$
Where the error is given by the Euler-Maclaurin formula. The first few values for $n$ are given by
And thus,
$$\begin{align}I&\dot=-4\pi\ln(2)+1.176909737067\\&\dot=-7.53343462414\end{align}$$