I'm facing a problem in digital signal processing and am wondering if there is a closed form expression for the sum
$$Y[n] = \sum_{k=0}^{n-1}\cos(\frac{2\pi k}{f}),$$
where $n$ < $f$.
In case I haven't worded my question correctly, I'd like to be able to calculate $Y[n]$ with only $n$ and $f$ and no discrete sum. Intuitively, I think it should be a sinusoid and if I plot y[n] it seems that this is true, however I haven't found a way to simplify the sum of cosinusoids into this closed form.
Mathematica and WolframAlpha give the following result.
$$Y_f(n)=\sum\limits_{k=0}^{n-1} \cos\left(\frac{2 \pi k}{f}\right)=\csc\left(\frac{\pi}{f}\right)\, \sin\left(\frac{n \pi}{f}\right)\, \cos\left(\frac{(n-1) \pi}{f}\right)$$