I have an indefinite integral of the form:
$$ \int \frac{\sin(n\theta(x)))}{\sin(\theta(x))} dx. $$
$\theta$ is a function of $x$ (and actually a complicated one).
Is it possible to integrate it --- analytically and/or numerically? The Dirichlet kernel for Fourier series makes me feel very optimistic about this one because they appear so similar. But I am not able to go too far with it.
What if the integral was a definite integral? like -- from $x = 0$ to $x = \pi/2$.
Note that, by Euler's formula, we have $$ \sin(x)=\frac1{2i}\left(e^{ix}-e^{-ix}\right) $$ Substituting the above into the quotient, we have $$ \begin{align} \frac{\sin(n\theta)}{\sin(\theta)}&=\frac{e^{in\theta}-e^{-in\theta}}{e^{i\theta}-e^{-i\theta}}\\ &=\frac{\left(e^{i\theta}\right)^n-\left(e^{-i\theta}\right)^n}{e^{i\theta}-e^{-i\theta}} \\ &= \sum_{k=0}^{n-1}\left(e^{i\theta}\right)^{n-1-2k}\\ &= \sum_{k=0}^{n-1}e^{i(n-1-2k)\theta}\\ &= \begin{cases} 1+2\sum_{k=1}^{(n-1)/2} \cos(2k\theta) & n\text{ is odd}\\ 2\sum_{k=1}^{n/2} \cos((2k-1)\theta) & n\text{ is even} \end{cases} \end{align} $$ Whether or not this is in fact easier to integrate depends on your $\theta(x)$